From 8bea18af4d5b14610063461e76b7a251bb2157a5 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Sat, 29 Mar 2025 13:53:13 -0400 Subject: [PATCH] Ensure all samples are added to sounding Ensure all samples are added to sounding, even if the sample lacks either a pressure or a height --- lib/xmet/raob.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/xmet/raob.py b/lib/xmet/raob.py index 82d0dbc..547dea0 100644 --- a/lib/xmet/raob.py +++ b/lib/xmet/raob.py @@ -60,8 +60,19 @@ class RAOBSounding(): sounding.timestamp_observed = timestamp sounding.timestamp_released = timestamp - datetime.timedelta(minutes=45) + seen = dict() + for pressure in sorted(self.samples_by_pressure.keys(), reverse=True): - sounding.samples.append(self.samples_by_pressure[pressure]) + sample = self.samples_by_pressure[pressure] + seen[sample] = True + + sounding.samples.append(sample) + + for height in sorted(self.samples_by_height.keys()): + sample = self.samples_by_height[height] + + if sample not in seen: + sounding.samples.append(sample) return sounding @@ -94,7 +105,7 @@ class RAOBSounding(): return sample def record_height(self, pressure: float, height: float): - if pressure is None: + if height is None or pressure is None: return sample = self.sample_by_pressure(pressure)