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

Move function `days_1950`to script `overlap_v6.py`

Only place where it is used. So we are reverting in part commit
68da90cd. We use again the function `days_1950` in script
`overlap_v6.py` since commit f46e1bc8.
parent ac2c45cb
No related branches found
No related tags found
No related merge requests found
import datetime
def days_1950(date_num):
"""Convert Matlab serial date number to number of days since Jan 1st
1950.
"""
date = datetime.date.fromordinal(date_num - 366) - datetime.date(1950, 1, 1)
return date.days
def get_ishape(d_init, ishape_last, days_1950, eddy_index):
k = days_1950 - d_init
......
......@@ -10,7 +10,15 @@ import scipy.io as sio
import csv
import sys
import json
import convert_id
import datetime
def days_1950(date_num):
"""Convert Matlab serial date number to number of days since Jan 1st
1950.
"""
date = datetime.date.fromordinal(date_num - 366) - datetime.date(1950, 1, 1)
return date.days
def adjust_n(n_Matlab):
k_Matlab = (n_Matlab - 1) // e_overestim
......@@ -27,7 +35,7 @@ n_dates = n_eddies.size
print("n_dates =", n_dates)
e_overestim = id_child.shape[0]
print("e_overestim =", e_overestim)
d_init = convert_id.days_1950(date_num[0])
d_init = days_1950(date_num[0])
with open("node_id_param.json", "w") as f:
json.dump({"e_overestim": e_overestim, "d_init": d_init}, f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment