From d1921d2d0bf08b3f5a4d3e87fd20fad9c4c9e673 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial <xan@xantronix.com> Date: Wed, 26 Feb 2025 18:25:22 -0500 Subject: [PATCH] Convert wind speed in m/s to knots --- lib/xmet/hodograph.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/xmet/hodograph.py b/lib/xmet/hodograph.py index 68baa90..c90e0c2 100644 --- a/lib/xmet/hodograph.py +++ b/lib/xmet/hodograph.py @@ -18,6 +18,9 @@ def radians(degrees: float) -> float: def degrees(radians: float) -> float: return (radians * (180.0 / math.pi)) - 90 +def knots(ms: float) -> float: + return ms * 1.944 + class Hodograph(): def __init__(self, width, height): self.width = min(width, height) @@ -151,7 +154,8 @@ class Hodograph(): if sx_last is not None and sy_last is not None: cr.move_to(x + sx_last, x + sy_last) - sx, sy = self.sample_to_screen(sample.wind_speed, sample.wind_dir) + sx, sy = self.sample_to_screen(knots(sample.wind_speed), + sample.wind_dir) if first: cr.move_to(x + sx, y + sy)