From 2ee82ffb1ba30d0833a4b5e39b22c3433b8d8c36 Mon Sep 17 00:00:00 2001 From: Valentin Gebhart Date: Fri, 14 Feb 2025 18:15:59 +0100 Subject: [PATCH] fixed error in testing --- climada/engine/impact.py | 2 +- climada/hazard/base.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/climada/engine/impact.py b/climada/engine/impact.py index bc07292bc..9d38b7944 100644 --- a/climada/engine/impact.py +++ b/climada/engine/impact.py @@ -570,7 +570,7 @@ def local_exceedance_impact( test_frequency = 1 / np.array(return_periods) exceedance_impact = np.full( - (self.imp_mat.shape[1], test_frequency.shape[0]), + (self.imp_mat.shape[1], len(test_frequency)), np.nan if method == "interpolate" else 0.0, ) diff --git a/climada/hazard/base.py b/climada/hazard/base.py index 508da8031..34169f172 100644 --- a/climada/hazard/base.py +++ b/climada/hazard/base.py @@ -557,7 +557,7 @@ def local_exceedance_intensity( test_frequency = 1 / np.array(return_periods) exceedance_intensity = np.full( - (self.intensity.shape[1], test_frequency.shape[0]), + (self.intensity.shape[1], len(test_frequency)), np.nan if method == "interpolate" else 0.0, ) @@ -687,7 +687,7 @@ def local_return_period( raise ValueError(f"Unknown method: {method}") return_periods = np.full( - (self.intensity.shape[1], threshold_intensities.shape[0]), np.nan + (self.intensity.shape[1], len(threshold_intensities)), np.nan ) nonzero_centroids = np.where(self.intensity.getnnz(axis=0) > 0)[0]