From f7b7f37a1b482738c91a11d9a4080d6ae998dc8d Mon Sep 17 00:00:00 2001
From: "v.gramlich1" <v.gramlichfz-juelich.de>
Date: Sat, 14 Aug 2021 16:18:48 +0200
Subject: [PATCH] reverted last commit

---
 mlair/helpers/statistics.py               |  3 +--
 mlair/plotting/postprocessing_plotting.py | 11 +----------
 mlair/run_modules/post_processing.py      | 11 ++++++++++-
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/mlair/helpers/statistics.py b/mlair/helpers/statistics.py
index 90f4a8c9..b63cbe80 100644
--- a/mlair/helpers/statistics.py
+++ b/mlair/helpers/statistics.py
@@ -301,7 +301,7 @@ class SkillScores:
                                                             observation_name=self.observation_name)
                                    for (first, second) in combinations]
         return skill_score
-
+    '''
     def climatological_skill_scores(self, internal_data: Data, forecast_name: str) -> xr.DataArray:
         """
         Calculate climatological skill scores according to Murphy (1988).
@@ -385,7 +385,6 @@ class SkillScores:
                     external_data=external_data).values.flatten())
 
         return skill_score
-    '''
 
     def _climatological_skill_score(self, internal_data, observation_name, forecast_name, mu_type=1,
                                     external_data=None):
diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py
index b7c0366e..6801addb 100644
--- a/mlair/plotting/postprocessing_plotting.py
+++ b/mlair/plotting/postprocessing_plotting.py
@@ -116,16 +116,7 @@ class PlotOversamplingContingency(AbstractPlotClass):
             except (FileNotFoundError, KeyError):
                 logging.debug(f"No competitor found for combination '{station_name}' and '{competitor_name}'.")
                 continue
-        if len(competing_predictions)==0:
-            return None
-        else:
-            comp_array = xr.concat(competing_predictions, "type")
-            if len(comp_array.coords[self.ahead_dim]) == self.window_lead_time:
-                return comp_array
-            else:
-                raise ValueError(f"Ahead dimensions of competitors do not match model."
-                                 f" Competitor ahead: {len(comp_array.coords[self.ahead_dim])}"
-                                 f" but window_lead_time is {self.window_lead_time}.")
+        return xr.concat(competing_predictions, "type") if len(competing_predictions) > 0 else None
 
     def _min_max_threshold(self):
         min_threshold = 0
diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py
index 80d40a66..0444ccf3 100644
--- a/mlair/run_modules/post_processing.py
+++ b/mlair/run_modules/post_processing.py
@@ -138,7 +138,16 @@ class PostProcessing(RunEnvironment):
             except (FileNotFoundError, KeyError):
                 logging.debug(f"No competitor found for combination '{station_name}' and '{competitor_name}'.")
                 continue
-        return xr.concat(competing_predictions, "type") if len(competing_predictions) > 0 else None
+        if len(competing_predictions) == 0:
+            return None
+        else:
+            comp_array = xr.concat(competing_predictions, "type")
+            if len(comp_array.coords[self.ahead_dim]) == self.window_lead_time:
+                return comp_array
+            else:
+                raise ValueError(f"Ahead dimensions of competitors do not match model."
+                                 f" Competitor ahead: {len(comp_array.coords[self.ahead_dim])}"
+                                 f" but window_lead_time is {self.window_lead_time}.")
 
     def bootstrap_postprocessing(self, create_new_bootstraps: bool, _iter: int = 0, bootstrap_type="singleinput",
                                  bootstrap_method="shuffle") -> None:
-- 
GitLab