From 9b4326ca09d9c57c1b8fa664a2179f3269c34b26 Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Thu, 14 Oct 2021 11:12:34 +0200
Subject: [PATCH] fixed another problem with missing station forecastas

---
 mlair/run_modules/post_processing.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py
index 3ce53c3c..72362c87 100644
--- a/mlair/run_modules/post_processing.py
+++ b/mlair/run_modules/post_processing.py
@@ -785,7 +785,7 @@ class PostProcessing(RunEnvironment):
                 model_list = None
 
             # test errors of competitors
-            for model_type in remove_items(model_list or [], errors.keys()):
+            for model_type in remove_items(model_list or [], list(errors.keys())):
                 if self.observation_indicator not in combined.coords[self.model_type_dim]:
                     continue
                 if model_type not in errors.keys():
@@ -815,10 +815,11 @@ class PostProcessing(RunEnvironment):
         avg_skill_score = 0
         n_total = None
         for vals in counts.values():
-            n_total = vals if n_total is None else n_total + vals
-        for station, station_errors in scores.items():
+            n_total = vals if n_total is None else n_total.add(vals, fill_value=0)
+        for station, station_scores in scores.items():
             n = counts.get(station)
-            avg_skill_score = station_errors * n / n_total + avg_skill_score
+            avg_skill_score = station_scores.mul(n.div(n_total, fill_value=0), fill_value=0).add(avg_skill_score,
+                                                                                                 fill_value=0)
         return avg_skill_score
 
 
-- 
GitLab