Skip to content

Commit

Permalink
fix: Fixed the calculating of the wind pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
FleetAdmiralJakob committed Jan 24, 2024
1 parent e432174 commit 1bcdc51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions apps/web/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ const InternalHome = observer(() => {
className="underline"
href="https://en.wikipedia.org/wiki/Pascal_(unit)"
>
Pascal (Pa)
Hectopascal (hPa)
<LuLink className="ml-1 inline h-4 w-4" />
</Link>
<br />
Expand All @@ -954,7 +954,8 @@ const InternalHome = observer(() => {
{translationHome("pressure")}
</span>
<div className="mt-2">
{weatherData.data.wind_pressure.toPrecision(2)} Pa
{Math.round(weatherData.data.wind_pressure * 100) / 100}{" "}
hPa
</div>
</div>
<div className="hyphens-auto break-words pr-3">
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/routers/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

1 comment on commit 1bcdc51

@vercel
Copy link

@vercel vercel bot commented on 1bcdc51 Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.