awips2/deltaScripts/13.4.1/determineRefTimeDirectory.py
Steve Harris ff7a21ac37 13.4.1-7 baseline
Former-commit-id: 8072752c77 [formerly 4c6ff79e71] [formerly 8347bed50e [formerly dd6304e82206bb46b0c0442d15ab5d9312d9f19f]]
Former-commit-id: 8347bed50e
Former-commit-id: b35027f661
2013-05-13 12:58:10 -04:00

20 lines
486 B
Python

#!/awips2/python/bin/python
import re
import sys
# we expect the filename as a command-line argument.
hdf5file = sys.argv[1]
matches = re.search(r'modelsounding-([0-9]+-[0-9]+-[0-9]+)-([0-9]+).h5', hdf5file, re.M|re.I)
if matches:
# extract the date
# extract the hour
date = matches.group(1)
hour = matches.group(2)
reftimeDirName = date + "_" + hour + ":00:00.0"
print reftimeDirName
else:
print "ERROR: unrecognized file - " + hdf5file + "!"
sys.exit(-1)