From e5b95b30799260506e35aa43bb7627e3c6570a7b Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Sun, 30 Mar 2025 01:09:24 -0400 Subject: [PATCH] Implement hodograph_samples() to return sorted samples w/heights --- lib/xmet/sounding.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/xmet/sounding.py b/lib/xmet/sounding.py index 2ffedee..eae479f 100644 --- a/lib/xmet/sounding.py +++ b/lib/xmet/sounding.py @@ -285,6 +285,11 @@ class Sounding(DatabaseTable): return wind_speed_dir(shear_u / levels, shear_v / levels) + def hodograph_samples(self) -> list[SoundingSample]: + samples = filter(lambda s: s.height is not None, self.samples) + + return sorted(samples, key=lambda s: s.height) + def between(n, a, b): return n > a and n < b