awips2/deltaScripts/archived/13.4.1/modelsoundingFileName.py
Richard Peter 55708f1d55 Issue #2854: Reorganize deltaScripts
Former-commit-id: 09f41a6b31 [formerly 56745c942e] [formerly 09f41a6b31 [formerly 56745c942e] [formerly c8e373c098 [formerly 469c2c597b80fd725f474e0d645656e4054fd69a]]]
Former-commit-id: c8e373c098
Former-commit-id: a526600e3e [formerly e1721cad00]
Former-commit-id: 18b4d133c7
2014-04-30 13:03:44 -05: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)