awips2/deltaScripts/13.4.1/modelsoundingFileName.py
Steve Harris 4c6ff79e71 13.4.1-7 baseline
Former-commit-id: dd6304e82206bb46b0c0442d15ab5d9312d9f19f
2013-05-13 12:58:10 -04:00

20 lines
545 B
Python

#!/awips2/python/bin/python
import re
import sys
# we expect the filename, model name, and forecast hour as arguments
hdf5file = sys.argv[1]
model = sys.argv[2]
forecastHour = sys.argv[3]
matches = re.search(r'modelsounding-([0-9]+-[0-9]+-[0-9]+-[0-9]+).h5', hdf5file, re.M|re.I)
if matches:
# extract the reftime
reftime = matches.group(1)
newFileName = "modelsounding-" + model + "-" + reftime + "-FH-" + str(forecastHour) + ".h5"
print newFileName
else:
print "ERROR: unrecognized file - " + hdf5file + "!"
sys.exit(-1)