From 9b0d01b1ef9ab470c9c044b99200c069fa280bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Tue, 27 Jun 2023 15:37:55 +0200 Subject: [PATCH] Applying Philip's patch. --- .../event-generator/icon-remap-helper.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/templates/event-generator/icon-remap-helper.py b/templates/event-generator/icon-remap-helper.py index 3637f8a..294eefd 100644 --- a/templates/event-generator/icon-remap-helper.py +++ b/templates/event-generator/icon-remap-helper.py @@ -165,24 +165,24 @@ def remap_one_file(in_grid, out_grid, one_file, dst_fodler, rename=None, src_vgr # rename the file if requested if rename is not None: # read the time stamp - if content["time"].size != 1: - logging.error("more then one timestep, unable to rename the file!") - exit(-1) - if content["time"].attrs["units"] == "day as %Y%m%d.%f": - date_part = int(content["time"][0]) - time_part = float(content["time"][0]) - date_part - year = str(date_part)[0:4] - month = str(date_part)[4:6] - day = str(date_part)[6:8] - hour = "%02d" % round(time_part * 24) - else: - logging.error("unsupported timeformat!") - exit(-1) - # replace ICON-style placeholders: - rename = rename.replace("<y>", year) - rename = rename.replace("<m>", month) - rename = rename.replace("<d>", day) - rename = rename.replace("<h>", hour) + # if content["time"].size != 1: + # logging.error("more then one timestep, unable to rename the file!") + # exit(-1) + # if content["time"].attrs["units"] == "day as %Y%m%d.%f": + # date_part = int(content["time"][0]) + # time_part = float(content["time"][0]) - date_part + # year = str(date_part)[0:4] + # month = str(date_part)[4:6] + # day = str(date_part)[6:8] + # hour = "%02d" % round(time_part * 24) + # else: + # logging.error("unsupported timeformat!") + # exit(-1) + # # replace ICON-style placeholders: + # rename = rename.replace("<y>", year) + # rename = rename.replace("<m>", month) + # rename = rename.replace("<d>", day) + # rename = rename.replace("<h>", hour) rename = os.path.join(dst_fodler, rename) else: rename = os.path.join(dst_fodler, (os.path.basename(one_file))) -- GitLab