diff --git a/Convert_Matlab/inst_eddies_v6.py b/Convert_Matlab/inst_eddies_v6.py index 75d21a0e7be3d2c9639033fcaa2cfbd3fa6ab1ee..a90d74eb8de1d792683b261b7ae593804ad38958 100755 --- a/Convert_Matlab/inst_eddies_v6.py +++ b/Convert_Matlab/inst_eddies_v6.py @@ -17,6 +17,7 @@ import f90nml import sys import pty import os +from dateutil import parser def define_fields(writers): """writers is a dictionary of shapefile.Writer objects.""" @@ -95,10 +96,12 @@ def write(writers, cell, cyclone): if len(sys.argv) == 1: sys.exit("Required argument: first input .mat file") adt_file = sys.argv[1] dirname, basename = path.split(adt_file) -my_date = datetime.datetime.strptime(basename, "adt_%Y-%m-%d.mat").date() +my_date = parser.parse(basename, yearfirst=True, dayfirst = False, + fuzzy = True).date() if len(sys.argv) == 3: - final_date = datetime.datetime.strptime(sys.argv[2], "%Y-%m-%d").date() + final_date = parser.parse(sys.argv[2], yearfirst=True, dayfirst = False)\ + .date() else: final_date = my_date