diff --git a/modules/amv/aeolus.py b/modules/amv/aeolus.py index 7c68b246598c17fd5d4d150b0298597106ef7c89..0bab832c2e2d8406795d8892ab44b64bd0f9caf0 100644 --- a/modules/amv/aeolus.py +++ b/modules/amv/aeolus.py @@ -141,7 +141,7 @@ def get_file_containing_time(timestamp, files_path, dto_func, file_time_span): # 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: @@ -199,6 +199,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