Skip to content
Snippets Groups Projects
Commit 2a1e975e authored by rink's avatar rink
Browse files

snapshot...

parent c65df034
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,7 @@ def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='
# imports the S4 NOAA output
# filename: full path as a string, '/home/user/filename'
# returns a dict: time -> list of profiles (a profile is a list of levels)
def get_aeolus_time_dict(filename, lon360=False):
def get_aeolus_time_dict(filename, lon360=False, do_sort=True):
time_dict = {}
with open(filename) as file:
......@@ -138,6 +138,17 @@ def get_aeolus_time_dict(filename, lon360=False):
file.close()
if do_sort:
keys = np.array(list(time_dict.keys()))
keys.sort()
keys = keys.tolist()
sorted_time_dict = {}
for key in keys:
sorted_time_dict[key] = time_dict.get(key)
time_dict = sorted_time_dict
return time_dict
......@@ -154,6 +165,41 @@ def time_dict_to_nd(time_dict):
return time_dict
def concat(t_dct_0, t_dct_1):
keys_0 = list(t_dct_0.keys())
nda_0 = np.array(keys_0)
keys_1 = list(t_dct_1.keys())
nda_1 = np.array(keys_1)
comm_keys, comm0, comm1 = np.intersect1d(nda_0, nda_1, return_indices=True)
comm_keys = comm_keys.tolist()
for key in comm_keys:
t_dct_1.pop(key)
t_dct_0.update(t_dct_1)
return t_dct_0
def get_aeolus_time_dict_s(filenames, lon360=False, do_sort=True):
dct_s = []
for fname in filenames:
a_dct = get_aeolus_time_dict(fname, lon360=lon360, do_sort=do_sort)
t_dct = time_dict_to_nd(a_dct)
dct_s.append(t_dct)
print(fname)
t_dct = dct_s[0]
for dct in dct_s[1:]:
concat(t_dct, dct)
print(len(dct))
return t_dct
def get_search_box(nav, lon, lat):
cc, ll = nav.earth_to_lc(lon, lat)
......
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