From cad172fcf444074dc5f46a4dbb0523d14ab149da Mon Sep 17 00:00:00 2001 From: Michael <m.langguth@fz-juelich.de> Date: Fri, 28 May 2021 15:54:01 +0200 Subject: [PATCH] Add get_era5_varatts-function to general_utils.py. --- video_prediction_tools/utils/general_utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/video_prediction_tools/utils/general_utils.py b/video_prediction_tools/utils/general_utils.py index 4158144c..fdb7229b 100644 --- a/video_prediction_tools/utils/general_utils.py +++ b/video_prediction_tools/utils/general_utils.py @@ -7,6 +7,7 @@ Provides: * get_unique_vars * check_str_in_list * check_dir * provide_default + * get_era5_atts """ # import modules @@ -177,6 +178,12 @@ def provide_default(dict_in, keyname, default=None, required=False): def get_era5_varatts(data_arr: xr.DataArray, name): + """ + Writes longname and unit to data arrays given their name is known + :param data_arr: the data array + :param name: the name of the variable + :return: data array with added attributes 'longname' and 'unit' if they are known + """ era5_varname_map = {"2t": "2m temperature", "t_850": "850 hPa temperature", "tcc": "total cloud cover", "msl": "mean sealevel pressure", "10u": "10m u-wind", "10v": "10m v-wind"} -- GitLab