Implement separate methods for separate data points
This commit is contained in:
parent
453a0efe89
commit
95120cec8f
1 changed files with 43 additions and 13 deletions
|
@ -60,19 +60,39 @@ class RAOBSounding():
|
||||||
|
|
||||||
return sounding
|
return sounding
|
||||||
|
|
||||||
def record(self, sample: SoundingSample):
|
def sample(self, pressure: float):
|
||||||
dest = SoundingSample()
|
if pressure in self.samples:
|
||||||
dest.pressure_qa = ' '
|
return self.samples[pressure]
|
||||||
dest.height_qa = ' '
|
|
||||||
dest.temp_qa = ' '
|
|
||||||
dest.pressure = sample.pressure
|
|
||||||
dest.height = sample.height
|
|
||||||
dest.temp = sample.temp
|
|
||||||
dest.dewpoint = sample.dewpoint
|
|
||||||
dest.wind_speed = sample.wind_speed
|
|
||||||
dest.wind_dir = sample.wind_dir
|
|
||||||
|
|
||||||
self.samples[sample.pressure] = dest
|
sample = SoundingSample()
|
||||||
|
sample.pressure = pressure
|
||||||
|
sample.pressure_qa = ' '
|
||||||
|
sample.height_qa = ' '
|
||||||
|
sample.temp_qa = ' '
|
||||||
|
|
||||||
|
self.samples[pressure] = sample
|
||||||
|
|
||||||
|
return sample
|
||||||
|
|
||||||
|
def record_height(self, pressure: float, height: float):
|
||||||
|
sample = self.sample(pressure)
|
||||||
|
sample.height = height
|
||||||
|
|
||||||
|
def record_temp_dewpoint(self,
|
||||||
|
pressure: float,
|
||||||
|
temp: float,
|
||||||
|
dewpoint: float):
|
||||||
|
sample = self.sample(pressure)
|
||||||
|
sample.temp = temp
|
||||||
|
sample.dewpoint = dewpoint
|
||||||
|
|
||||||
|
def record_wind_speed_dir(self,
|
||||||
|
pressure: float,
|
||||||
|
wind_speed: float,
|
||||||
|
wind_dir: float):
|
||||||
|
sample = self.sample(pressure)
|
||||||
|
sample.wind_speed = wind_speed
|
||||||
|
sample.wind_dir = wind_dir
|
||||||
|
|
||||||
class RAOBObs():
|
class RAOBObs():
|
||||||
DATA_SOURCE = 'UCAR'
|
DATA_SOURCE = 'UCAR'
|
||||||
|
@ -480,7 +500,17 @@ class RAOBReader():
|
||||||
sounding = self.sounding(station, timestamp)
|
sounding = self.sounding(station, timestamp)
|
||||||
|
|
||||||
for sample in samples:
|
for sample in samples:
|
||||||
sounding.record(sample)
|
pressure = sample.pressure
|
||||||
|
|
||||||
|
sounding.record_height(pressure, sample.height)
|
||||||
|
|
||||||
|
sounding.record_temp_dewpoint(pressure,
|
||||||
|
sample.temp,
|
||||||
|
sample.dewpoint)
|
||||||
|
|
||||||
|
sounding.record_wind_speed_dir(pressure,
|
||||||
|
sample.wind_speed,
|
||||||
|
sample.wind_dir)
|
||||||
|
|
||||||
for key in self.soundings:
|
for key in self.soundings:
|
||||||
yield self.soundings[key].finish()
|
yield self.soundings[key].finish()
|
||||||
|
|
Loading…
Add table
Reference in a new issue