From a6bcfd9ead8f26bff57cfc8b1b96fc0247a13f83 Mon Sep 17 00:00:00 2001 From: Jan Niklas Lorenz <115928966+DL2JNL@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:26:24 +0100 Subject: [PATCH] added try except for model dl added try/except statement for the main model dl functions. Yet untested, needs testing! --- unisacsi/MET_model_download.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/unisacsi/MET_model_download.py b/unisacsi/MET_model_download.py index abba75e..4c9026d 100644 --- a/unisacsi/MET_model_download.py +++ b/unisacsi/MET_model_download.py @@ -52,7 +52,10 @@ def download_MET_model_data(config_file): print("############################################################") print("start downloading latest data") print("############################################################") - MET_model_download_class(config_settings) + try: + MET_model_download_class(config_settings) + except: + print("ERROR! download failed, skipping file") elif config_settings["save_daily_files"]: days = pd.date_range(config_settings["start_day"], config_settings["end_day"], freq="1D") daily_config = copy.copy(config_settings) @@ -65,10 +68,16 @@ def download_MET_model_data(config_file): print("############################################################") print(f"start downloading data from {d.strftime('%Y-%m-%d')}") print("############################################################") - MET_model_download_class(daily_config) + try: + MET_model_download_class(daily_config) + except: + print("ERROR! download failed, skipping file") else: config_settings["out_path"] = f"{config_settings['out_path']}_{config_settings['resolution']}.nc" - MET_model_download_class(config_settings) + try: + MET_model_download_class(config_settings) + except: + print("ERROR! download failed, skipping file") return @@ -1474,4 +1483,4 @@ def download_pressure_level_data(self): - \ No newline at end of file +