From a97324fea8e8a2d769b15c4126107c5a4223336d Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Mon, 23 Aug 2021 09:10:00 +0200
Subject: [PATCH] add another fix for rare cases in clim skill scores

---
 mlair/helpers/statistics.py         | 5 ++++-
 mlair/run_modules/pre_processing.py | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/mlair/helpers/statistics.py b/mlair/helpers/statistics.py
index a1e713a8..fef52fb2 100644
--- a/mlair/helpers/statistics.py
+++ b/mlair/helpers/statistics.py
@@ -314,7 +314,10 @@ class SkillScores:
 
         :return: all CASES as well as all terms
         """
-        ahead_names = list(self.external_data[self.ahead_dim].data)
+        if self.external_data is not None:
+            ahead_names = list(self.external_data[self.ahead_dim].data)
+        else:
+            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/run_modules/pre_processing.py b/mlair/run_modules/pre_processing.py
index 08bff85c..791b8b7b 100644
--- a/mlair/run_modules/pre_processing.py
+++ b/mlair/run_modules/pre_processing.py
@@ -268,7 +268,7 @@ class PreProcessing(RunEnvironment):
                     valid_stations.append(s)
 
         logging.info(f"run for {t_outer} to check {len(set_stations)} station(s). Found {len(collection)}/"
-                     f"{len(set_stations)} valid stations.")
+                     f"{len(set_stations)} valid stations ({set_name}).")
         if set_name == "train":
             self.store_data_handler_attributes(data_handler, collection)
         return collection, valid_stations
-- 
GitLab