From 9d9cfab9e2b90e0e0fe84fefe3e5dcc411f45461 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Mon, 17 Mar 2025 22:15:34 -0400 Subject: [PATCH] Add wind_u(), wind_v() vector component functions --- lib/xmet/thermo.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/xmet/thermo.py b/lib/xmet/thermo.py index e06a7b5..c0fe75a 100644 --- a/lib/xmet/thermo.py +++ b/lib/xmet/thermo.py @@ -189,3 +189,9 @@ def follow_saturated_mixing_ratio(temp: float, pressure: float, step: float=1.0) p2 -= step return series + +def wind_u(speed: float, direction: float) -> float: + return speed * math.cos(rad(direction)) + +def wind_v(speed: float, direction: float) -> float: + return -speed * math.sin(rad(direction))