From 7e363fbd4086b6dd2704445fb785384ebafce025 Mon Sep 17 00:00:00 2001 From: Felix Kleinert <f.kleinert@fz-juelich.de> Date: Tue, 1 Feb 2022 15:25:05 +0100 Subject: [PATCH] expand logging --- mlair/data_handler/data_handler_wrf_chem.py | 2 ++ mlair/run_modules/post_processing.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mlair/data_handler/data_handler_wrf_chem.py b/mlair/data_handler/data_handler_wrf_chem.py index 1d42649b..94dcc9c2 100644 --- a/mlair/data_handler/data_handler_wrf_chem.py +++ b/mlair/data_handler/data_handler_wrf_chem.py @@ -1248,6 +1248,7 @@ class DataHandlerSectorGrid(DataHandlerSingleGridColumn): def wind_upstream_sector_by_name(self, wind_upstream_sector_by_name: xr.DataArray): self._wind_upstream_sector_by_name = wind_upstream_sector_by_name + @TimeTrackingWrapper def _store_wind_upstream_sector_by_name(self): file_name = os.path.join(self.experiment_path, f"data/{self.station[0]}_{self.start}_{self.end}_upstream_wind_sector.nc") @@ -1257,6 +1258,7 @@ class DataHandlerSectorGrid(DataHandlerSingleGridColumn): dim=list(set(dims_to_expand) - {self.iter_dim, self.target_dim}), drop=True) wind_upstream_sector_by_name = wind_upstream_sector_by_name.to_dataset(self.iter_dim) wind_upstream_sector_by_name.to_netcdf(file_name) + logging.info(f"_store_wind_upstream_sector_by_name: {file_name}") @TimeTrackingWrapper def extract_data_from_loader(self, loader): diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py index 04bcbf75..9e3fbdb0 100644 --- a/mlair/run_modules/post_processing.py +++ b/mlair/run_modules/post_processing.py @@ -164,7 +164,7 @@ class PostProcessing(RunEnvironment): logging.warning("Dimension `XTIME' does not exist") ds = ds.squeeze() logging.info(f"PostProcessing.load_upstream_wind_sector({name_of_set}: shape of `upstream_wind_sector' is " - f"{ds.shape}\ndims are {ds.dims}") + f"{ds.shape}\ndims are {ds.dims}, ds.isnull().any()={ds.isnull().any()}") self.upstream_wind_sector = ds @TimeTrackingWrapper @@ -957,7 +957,10 @@ class PostProcessing(RunEnvironment): file = os.path.join(path, f"forecasts_{str(station)}_test.nc") with xr.open_dataarray(file) as da: return da.load() - except (IndexError, KeyError, FileNotFoundError): + except (IndexError, KeyError, FileNotFoundError) as e: + logging.error(f"Could not load external test data for station {station} from " + f"{path}) due to the following error:\n{sys.exc_info()[0]}\n" + f"{sys.exc_info()[1]}\n{sys.exc_info()[2]}") return None def _combine_forecasts(self, forecast, competitor, dim=None): -- GitLab