From 1bcdc51c5539b37ef10b8ef8ede1bcbe9e3e7a85 Mon Sep 17 00:00:00 2001 From: FleetAdmiralJakob Date: Wed, 24 Jan 2024 19:43:14 +0100 Subject: [PATCH] fix: Fixed the calculating of the wind pressure --- apps/web/src/pages/home/index.tsx | 5 +++-- packages/api/src/routers/weather.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/web/src/pages/home/index.tsx b/apps/web/src/pages/home/index.tsx index a34ba474..bc55f626 100644 --- a/apps/web/src/pages/home/index.tsx +++ b/apps/web/src/pages/home/index.tsx @@ -935,7 +935,7 @@ const InternalHome = observer(() => { className="underline" href="https://en.wikipedia.org/wiki/Pascal_(unit)" > - Pascal (Pa) + Hectopascal (hPa)
@@ -954,7 +954,8 @@ const InternalHome = observer(() => { {translationHome("pressure")}
- {weatherData.data.wind_pressure.toPrecision(2)} Pa + {Math.round(weatherData.data.wind_pressure * 100) / 100}{" "} + hPa
diff --git a/packages/api/src/routers/weather.ts b/packages/api/src/routers/weather.ts index 2b8a40be..3a3eb86e 100644 --- a/packages/api/src/routers/weather.ts +++ b/packages/api/src/routers/weather.ts @@ -626,10 +626,10 @@ export const weatherRouter = createTRPCRouter({ : hourlyForecast[0]?.apparentTemperature, // In meters per second wind_speed: presentWeather?.wind.speed, - // Calculates the wind pressure in Pa + // Calculates the wind pressure in hPa wind_pressure: - presentWeather?.wind.speed !== undefined - ? 0.5 * 1.225 * Math.pow(presentWeather.wind.speed, 2) + presentWeather?.main.pressure !== undefined + ? presentWeather?.main.pressure : undefined, // Index from 0 to 100 air_quality: presentAirQualityIndex,