From 9803d54a568b9c3b140594953c84abb9ce9565b0 Mon Sep 17 00:00:00 2001 From: Viktor VN Date: Tue, 20 Aug 2024 10:23:19 +0200 Subject: [PATCH] Small optimisation in excprob function (#424) Co-authored-by: vikvnieu --- pysteps/postprocessing/ensemblestats.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pysteps/postprocessing/ensemblestats.py b/pysteps/postprocessing/ensemblestats.py index 54d90aaeb..351ec4a31 100644 --- a/pysteps/postprocessing/ensemblestats.py +++ b/pysteps/postprocessing/ensemblestats.py @@ -99,10 +99,9 @@ def excprob(X, X_thr, ignore_nan=False): scalar_thr = False for x in X_thr: - X_ = X.copy() + X_ = np.zeros(X.shape) X_[X >= x] = 1.0 - X_[X < x] = 0.0 X_[~np.isfinite(X)] = np.nan if ignore_nan: