Skip to content
Snippets Groups Projects
Commit dc04124d authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Do not re-compute `date_index`, just increment it

parent 42ac7a69
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,8 @@ adt_file = sys.argv[1]
dirname, basename = path.split(adt_file)
my_date = parser.parse(basename, yearfirst=True, dayfirst = False,
fuzzy = True).date()
date_index = my_date - datetime.date(1950, 1, 1)
date_index = date_index.days
if len(sys.argv) == 3:
final_date = parser.parse(sys.argv[2], yearfirst=True, dayfirst = False)\
......@@ -140,8 +142,6 @@ while True:
# matlab_data is a dictionary.
assert datetime.date.fromordinal(matlab_data["date_num"] - 366) == my_date
date_index = my_date - datetime.date(1950, 1, 1)
date_index = date_index.days
for f in factories:
write(f["writers"], matlab_data[f["cell_name"]], f["cyclone"])
......@@ -149,6 +149,7 @@ while True:
os.remove("adt.mat")
my_date += datetime.timedelta(1)
if my_date > final_date: break
date_index += 1
basename = my_date.strftime("adt_%Y-%m-%d.mat")
adt_file = path.join(dirname, basename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment