awips2/deltaScripts/archived/13.4.1/determineRefTimeDirectory.py
Richard Peter c8e373c098 Issue #2854: Reorganize deltaScripts
Former-commit-id: 469c2c597b80fd725f474e0d645656e4054fd69a
2014-04-30 13:03:44 -05: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)