Omaha #5733 Fix display of sea level pressure for DAT products
Values from metar are in Pa; convert to hPa before storing in fssobs. Change-Id: I39e245a65001fc197737ffa5b6bfe7eca1891219
This commit is contained in:
parent
db9a73d703
commit
4b9bca7a2e
3 changed files with 62 additions and 1 deletions
35
deltaScripts/16.2.2/DR5733/_update_fssobs_slp_values.py
Executable file
35
deltaScripts/16.2.2/DR5733/_update_fssobs_slp_values.py
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
|
# #5733
|
||||||
|
# Convert sea level pressure from Pa to hPa in an hdf5 file
|
||||||
|
# Do nothing if all values are already in hPa
|
||||||
|
# Author: tom.gurney@raytheon.com
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import h5py
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print "usage: {} filename.h5".format(sys.argv[0])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
didstuff = False
|
||||||
|
try:
|
||||||
|
with h5py.File(sys.argv[1], 'r+') as f:
|
||||||
|
if 'seaLevelPress' in f:
|
||||||
|
for i, data in enumerate(f['seaLevelPress']):
|
||||||
|
if data > 10000:
|
||||||
|
f['seaLevelPress'][i] = data / 100.0
|
||||||
|
didstuff = True
|
||||||
|
except Exception as e:
|
||||||
|
print "ERROR: " + str(sys.exc_info()[0]) + ": " + str(e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if didstuff:
|
||||||
|
print "INFO: {}: updated".format(sys.argv[1])
|
||||||
|
else:
|
||||||
|
print "INFO: {}: no update needed".format(sys.argv[1])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
22
deltaScripts/16.2.2/DR5733/update_fssobs_slp_values.sh
Executable file
22
deltaScripts/16.2.2/DR5733/update_fssobs_slp_values.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# #5733
|
||||||
|
# Convert sea level pressure from Pa to hPa in all fssobs h5 files
|
||||||
|
# Author: tom.gurney@raytheon.com
|
||||||
|
|
||||||
|
TARGET=/awips2/edex/data/hdf5/fssobs
|
||||||
|
THIS_LOCATION=$(dirname $0)
|
||||||
|
success=0
|
||||||
|
|
||||||
|
for item in $(find $TARGET -type f -name "*.h5"); do
|
||||||
|
$THIS_LOCATION/_update_fssobs_slp_values.py $item
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
success=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ success -eq 0 ]]; then
|
||||||
|
echo INFO: No errors reported.
|
||||||
|
else
|
||||||
|
echo "ERROR: There was a problem with one or more updates; see above."
|
||||||
|
fi
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||||
* Jul 23, 2014 3410 bclement location changed to floats
|
* Jul 23, 2014 3410 bclement location changed to floats
|
||||||
* Sep 18, 2015 3873 skorolev Fixed assigning timeObs for maritime record.
|
* Sep 18, 2015 3873 skorolev Fixed assigning timeObs for maritime record.
|
||||||
* Dec 02, 2015 3873 dhladky Added missing point data params.
|
* Dec 02, 2015 3873 dhladky Added missing point data params.
|
||||||
|
* Jul 08, 2016 5733 tgurney Convert metar sea level pressure to mbar
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -343,7 +344,10 @@ public class FSSObsDataTransform {
|
||||||
fssr.setTimeObs(pdv.getCalendar(TIME_OBS));
|
fssr.setTimeObs(pdv.getCalendar(TIME_OBS));
|
||||||
fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs()));
|
fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs()));
|
||||||
// in mbar
|
// in mbar
|
||||||
fssr.setSeaLevelPress(pdv.getNumber(SEA_LEVEL_PRESS).floatValue());
|
float seaLevelPress = pdv.getNumber(SEA_LEVEL_PRESS).floatValue();
|
||||||
|
if (seaLevelPress != MISSING) {
|
||||||
|
fssr.setSeaLevelPress(seaLevelPress / 100.0f);
|
||||||
|
}
|
||||||
// in mmHg
|
// in mmHg
|
||||||
fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue());
|
fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue());
|
||||||
fssr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue());
|
fssr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue());
|
||||||
|
|
Loading…
Add table
Reference in a new issue