Obtain and set surface elevation where possible
This commit is contained in:
parent
79e1d4d3e3
commit
d1f961ecf2
1 changed files with 13 additions and 0 deletions
|
@ -115,6 +115,9 @@ class BUFRSounding(Sounding):
|
||||||
sounding.timestamp_observed = timestamp
|
sounding.timestamp_observed = timestamp
|
||||||
sounding.timestamp_released = timestamp - datetime.timedelta(minutes=45)
|
sounding.timestamp_released = timestamp - datetime.timedelta(minutes=45)
|
||||||
|
|
||||||
|
surface_pressure = None
|
||||||
|
surface_height = None
|
||||||
|
|
||||||
for item in response:
|
for item in response:
|
||||||
params = item.getParameters()
|
params = item.getParameters()
|
||||||
|
|
||||||
|
@ -124,6 +127,9 @@ class BUFRSounding(Sounding):
|
||||||
wind_dir = item.getNumber('wsMan')
|
wind_dir = item.getNumber('wsMan')
|
||||||
wind_speed = item.getNumber('wdMan')
|
wind_speed = item.getNumber('wdMan')
|
||||||
|
|
||||||
|
if surface_pressure is None and height == -9999.0:
|
||||||
|
surface_pressure = pressure
|
||||||
|
|
||||||
sounding.record_wind(pressure, height, wind_dir, wind_speed)
|
sounding.record_wind(pressure, height, wind_dir, wind_speed)
|
||||||
|
|
||||||
if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
|
if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
|
||||||
|
@ -142,6 +148,13 @@ class BUFRSounding(Sounding):
|
||||||
|
|
||||||
sounding.record_wind(pressure, height, wind_speed, wind_dir)
|
sounding.record_wind(pressure, height, wind_speed, wind_dir)
|
||||||
|
|
||||||
|
if set(params) & set(['staElev']):
|
||||||
|
if surface_pressure is not None and surface_height is None:
|
||||||
|
surface_height = item.getNumber('staElev')
|
||||||
|
|
||||||
|
if surface_pressure is not None and surface_height is not None:
|
||||||
|
sounding.sample_by_pressure(surface_pressure).height = surface_height
|
||||||
|
|
||||||
for pressure in sorted(sounding.samples_by_pressure.keys(), reverse=True):
|
for pressure in sorted(sounding.samples_by_pressure.keys(), reverse=True):
|
||||||
sounding.samples.append(sounding.samples_by_pressure[pressure])
|
sounding.samples.append(sounding.samples_by_pressure[pressure])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue