From 08c206f547be6d3fbcb2eaf77d660e306576f8e5 Mon Sep 17 00:00:00 2001
From: Falco Weichselbaum <f.weichselbaum@fz-juelich.de>
Date: Tue, 20 Jul 2021 12:39:24 +0200
Subject: [PATCH] ahead_dim=ahead now as kwarg to skill_score() and
 climatological_skill_score()

---
 mlair/helpers/statistics.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mlair/helpers/statistics.py b/mlair/helpers/statistics.py
index 15cef734..2cc52ed6 100644
--- a/mlair/helpers/statistics.py
+++ b/mlair/helpers/statistics.py
@@ -288,7 +288,7 @@ class SkillScores:
         combination_strings = [f"{first}-{second}" for (first, second) in combinations]
         return combinations, combination_strings
 
-    def skill_scores(self, window_lead_time: int) -> pd.DataFrame:
+    def skill_scores(self, window_lead_time: int, ahead_dim="ahead") -> pd.DataFrame:
         """
         Calculate skill scores for all combinations of model names.
 
@@ -296,7 +296,7 @@ class SkillScores:
 
         :return: skill score for each comparison and forecast step
         """
-        ahead_names = list(self.external_data.ahead.data)
+        ahead_names = list(self.external_data[ahead_dim].data)
         combinations, combination_strings = self.get_model_name_combinations()
         skill_score = pd.DataFrame(index=combination_strings)
         for iahead in ahead_names:
@@ -309,7 +309,7 @@ class SkillScores:
         return skill_score
 
     def climatological_skill_scores(self, internal_data: Data, window_lead_time: int,
-                                    forecast_name: str) -> xr.DataArray:
+                                    forecast_name: str, ahead_dim="ahead") -> xr.DataArray:
         """
         Calculate climatological skill scores according to Murphy (1988).
 
@@ -322,7 +322,7 @@ class SkillScores:
 
         :return: all CASES as well as all terms
         """
-        ahead_names = list(self.external_data.ahead.data)
+        ahead_names = list(self.external_data[ahead_dim].data)
 
         all_terms = ['AI', 'AII', 'AIII', 'AIV', 'BI', 'BII', 'BIV', 'CI', 'CIV', 'CASE I', 'CASE II', 'CASE III',
                      'CASE IV']
-- 
GitLab