Skip to content
Snippets Groups Projects
Commit 9c8c8929 authored by rink's avatar rink
Browse files

improve get_aeolus_time_dict_s

parent 4115a187
No related branches found
No related tags found
No related merge requests found
...@@ -193,9 +193,26 @@ def concat(t_dct_0, t_dct_1): ...@@ -193,9 +193,26 @@ def concat(t_dct_0, t_dct_1):
return t_dct_0 return t_dct_0
def get_aeolus_time_dict_s(filenames, lon360=False, do_sort=True): def get_aeolus_time_dict_s(files_path, lon360=False, do_sort=True):
ftimes = []
fnames = glob.glob(files_path + 'mie1day.out.*')
time_dct = {}
for pathname in fnames:
fname = os.path.split(pathname)[1]
toks = fname.split('.')
dstr = toks[2]
dto = datetime.datetime.strptime(dstr, '%Y-%m-%d').replace(tzinfo=timezone.utc)
ts = dto.timestamp()
ftimes.append(ts)
time_dct[ts] = fname
sorted_filenames = []
ftimes.sort()
for t in ftimes:
sorted_filenames.append(time_dct.get(t))
dct_s = [] dct_s = []
for fname in filenames: for fname in sorted_filenames:
a_dct = get_aeolus_time_dict(fname, lon360=lon360, do_sort=do_sort) a_dct = get_aeolus_time_dict(fname, lon360=lon360, do_sort=do_sort)
t_dct = time_dict_to_nd(a_dct) t_dct = time_dict_to_nd(a_dct)
dct_s.append(t_dct) dct_s.append(t_dct)
......
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