Better readability

This commit is contained in:
XANTRONIX 2025-03-19 11:38:45 -04:00
parent 1ada48e544
commit 57ce901c01

View file

@ -194,10 +194,10 @@ def follow_saturated_mixing_ratio(temp: float, pressure: float, step: float=1.0)
return series return series
def wind_u(speed: float, direction: float) -> float: def wind_u(speed: float, direction: float) -> float:
return speed * math.cos(rad(direction)) return math.cos(rad(direction)) * speed
def wind_v(speed: float, direction: float) -> float: def wind_v(speed: float, direction: float) -> float:
return -speed * math.sin(rad(direction)) return math.sin(rad(direction)) * -speed
def wind_uv(speed: float, direction: float) -> float: def wind_uv(speed: float, direction: float) -> float:
return ( return (
@ -208,5 +208,5 @@ def wind_uv(speed: float, direction: float) -> float:
def wind_speed_dir(u: float, v: float) -> float: def wind_speed_dir(u: float, v: float) -> float:
return ( return (
math.sqrt(u**2 + v**2), math.sqrt(u**2 + v**2),
(180 - deg(math.atan2(v, u))) % 360 (deg(math.atan2(v, u)) - 180) % 360
) )