Handle -9999 BUFR pressure, height values
This commit is contained in:
parent
55b7cfb819
commit
1046b1c22d
1 changed files with 26 additions and 7 deletions
|
@ -20,8 +20,9 @@ class BUFRSounding(Sounding):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.samples_by_pressure = dict()
|
self.samples_by_pressure = dict()
|
||||||
|
self.samples_by_height = dict()
|
||||||
|
|
||||||
def sample(self, pressure: float) -> SoundingSample:
|
def sample_by_pressure(self, pressure: float) -> SoundingSample:
|
||||||
sample = self.samples_by_pressure.get(pressure)
|
sample = self.samples_by_pressure.get(pressure)
|
||||||
|
|
||||||
if sample is None:
|
if sample is None:
|
||||||
|
@ -32,6 +33,17 @@ class BUFRSounding(Sounding):
|
||||||
|
|
||||||
return sample
|
return sample
|
||||||
|
|
||||||
|
def sample_by_height(self, height: float) -> SoundingSample:
|
||||||
|
sample = self.samples_by_height.get(height)
|
||||||
|
|
||||||
|
if sample is None:
|
||||||
|
sample = SoundingSample()
|
||||||
|
sample.height = height
|
||||||
|
|
||||||
|
self.samples_by_height[height] = sample
|
||||||
|
|
||||||
|
return sample
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def init():
|
def init():
|
||||||
DataAccessLayer.changeEDEXHost(BUFRSounding.EDEX_HOST)
|
DataAccessLayer.changeEDEXHost(BUFRSounding.EDEX_HOST)
|
||||||
|
@ -73,25 +85,32 @@ class BUFRSounding(Sounding):
|
||||||
|
|
||||||
if set(params) & BUFRSounding.BUFR_PARAMS_MAN:
|
if set(params) & BUFRSounding.BUFR_PARAMS_MAN:
|
||||||
pressure = item.getNumber('prMan') / 100.0
|
pressure = item.getNumber('prMan') / 100.0
|
||||||
sample = sounding.sample(pressure)
|
height = item.getNumber('htMan')
|
||||||
|
|
||||||
|
if pressure == -99.99:
|
||||||
|
sample = sounding.sample_by_height(height)
|
||||||
|
else:
|
||||||
|
sample = sounding.sample_by_pressure(pressure)
|
||||||
|
|
||||||
sample.pressure = pressure
|
|
||||||
sample.height = item.getNumber('htMan')
|
|
||||||
sample.wind_speed = item.getNumber('wsMan')
|
sample.wind_speed = item.getNumber('wsMan')
|
||||||
sample.wind_dir = item.getNumber('wdMan')
|
sample.wind_dir = item.getNumber('wdMan')
|
||||||
|
|
||||||
if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
|
if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
|
||||||
pressure = item.getNumber('prSigT') / 100.0
|
pressure = item.getNumber('prSigT') / 100.0
|
||||||
sample = sounding.sample(pressure)
|
sample = sounding.sample_by_pressure(pressure)
|
||||||
|
|
||||||
sample.temp = celsius(item.getNumber('tpSigT'))
|
sample.temp = celsius(item.getNumber('tpSigT'))
|
||||||
sample.dewpoint = celsius(item.getNumber('tdSigT'))
|
sample.dewpoint = celsius(item.getNumber('tdSigT'))
|
||||||
|
|
||||||
if set(params) & BUFRSounding.BUFR_PARAMS_SIGW:
|
if set(params) & BUFRSounding.BUFR_PARAMS_SIGW:
|
||||||
pressure = item.getNumber('prSigW') / 100.0
|
pressure = item.getNumber('prSigW') / 100.0
|
||||||
sample = sounding.sample(pressure)
|
height = item.getNumber('htSigW')
|
||||||
|
|
||||||
|
if pressure == -99.99:
|
||||||
|
sample = sounding.sample_by_height(height)
|
||||||
|
else:
|
||||||
|
sample = sounding.sample_by_pressure(pressure)
|
||||||
|
|
||||||
sample.height = item.getNumber('htSigW')
|
|
||||||
sample.wind_speed = item.getNumber('wsSigW')
|
sample.wind_speed = item.getNumber('wsSigW')
|
||||||
sample.wind_dir = item.getNumber('wdSigW')
|
sample.wind_dir = item.getNumber('wdSigW')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue