diff --git a/mlair/helpers/statistics.py b/mlair/helpers/statistics.py index b63cbe801abd9f0d325a689a959bc494ad1b4485..90f4a8c95dcd8be8de6243ec58be0404f1cad073 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,6 +385,7 @@ 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 6801addb7276d2638f44dd29fd7d521f6efa46a5..b7c0366e9cb9e165c63a13b567b89f220930b1fc 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -116,7 +116,16 @@ class PlotOversamplingContingency(AbstractPlotClass): 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 _min_max_threshold(self): min_threshold = 0 diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py index 4defc4d6439b720d61ce4617ced178531a921f50..80d40a66245ca0310dbb20a7cee8655c2fc3b9ec 100644 --- a/mlair/run_modules/post_processing.py +++ b/mlair/run_modules/post_processing.py @@ -138,16 +138,7 @@ class PostProcessing(RunEnvironment): 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 bootstrap_postprocessing(self, create_new_bootstraps: bool, _iter: int = 0, bootstrap_type="singleinput", bootstrap_method="shuffle") -> None: