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)