From 43127055212eaeba77fd454453ac84025e9adbed Mon Sep 17 00:00:00 2001 From: "v.gramlich1" <v.gramlichfz-juelich.de> Date: Mon, 16 Aug 2021 10:52:27 +0200 Subject: [PATCH] For debugging on HPC --- mlair/helpers/statistics.py | 5 +---- mlair/plotting/postprocessing_plotting.py | 10 +++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mlair/helpers/statistics.py b/mlair/helpers/statistics.py index b63cbe80..2f47bac5 100644 --- a/mlair/helpers/statistics.py +++ b/mlair/helpers/statistics.py @@ -355,10 +355,7 @@ class SkillScores: :return: all CASES as well as all terms """ - if self.external_data is None: - ahead_names = [] - else: - ahead_names = list(self.external_data[self.ahead_dim].data) + ahead_names = list(internal_data[self.ahead_dim].data) all_terms = ['AI', 'AII', 'AIII', 'AIV', 'BI', 'BII', 'BIV', 'CI', 'CIV', 'CASE I', 'CASE II', 'CASE III', 'CASE IV'] diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 6801addb..55f74a1e 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -121,7 +121,9 @@ class PlotOversamplingContingency(AbstractPlotClass): def _min_max_threshold(self): min_threshold = 0 max_threshold = 0 + logging.info("min_max thresholds") for station in self._stations: + logging.info(f"{station}") file = os.path.join(self._file_path, self._file_name % station) forecast_file = xr.open_dataarray(file) obs = forecast_file.sel(type=self._obs_name) @@ -139,17 +141,23 @@ class PlotOversamplingContingency(AbstractPlotClass): for station in self._stations: file = os.path.join(self._file_path, self._file_name % station) forecast_file = xr.open_dataarray(file) + logging.info(f"{station}: load obs") obs = forecast_file.sel(type=self._obs_name) + logging.info(f"{station}: load pred") predictions = [forecast_file.sel(type=self._model_name)] + logging.info(f"{station}: load comp") competitors = [self._load_competitors(station, [comp]).sel(type=comp) for comp in self._comp_names] predictions.extend(competitors) + logging.info(f"itearate over thresholds") for threshold in range(self._min_threshold, self._max_threshold): - for pred in predictions: + for i, pred in enumerate(predictions): + logging.info(i) ta, fa, fb, tb = self._single_contingency(obs, pred, threshold) contingency_array.loc[dict(thresholds=threshold, contingency_cell="ta", type=pred.type.values)] = ta contingency_array.loc[dict(thresholds=threshold, contingency_cell="fa", type=pred.type.values)] = fa contingency_array.loc[dict(thresholds=threshold, contingency_cell="fb", type=pred.type.values)] = fb contingency_array.loc[dict(thresholds=threshold, contingency_cell="tb", type=pred.type.values)] = tb + logging.info(f"{station}: finished") return contingency_array def _single_contingency(self, obs, pred, threshold): -- GitLab