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
This commit is contained in:
parent
650718a00b
commit
8bea18af4d
1 changed files with 13 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue