From fa452fbfaf03f2f4fc68d0f304973d46db4dc68f Mon Sep 17 00:00:00 2001 From: sloosvel Date: Thu, 23 Jul 2020 13:44:47 +0200 Subject: [PATCH 1/2] Use masked array routines in regmean --- diagonals/regmean.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diagonals/regmean.py b/diagonals/regmean.py index 8da71dc..efce77b 100644 --- a/diagonals/regmean.py +++ b/diagonals/regmean.py @@ -117,8 +117,8 @@ def _compute_regmean_2d_cpu(var, basins, area): weights = _compute_weights_2d(mask, area) regmean = np.empty(times) for t in range(times): - regmean[t] = np.average(var[t, :, :], axis=(0, 1), - weights=np.squeeze(weights)) + regmean[t] = np.ma.average( + var[t, :, :], axis=(0, 1), weights=np.squeeze(weights)) regmean_total[basin] = regmean return regmean_total @@ -148,8 +148,8 @@ def _compute_regmean_3d_cpu(var, basins, volume): weights = _compute_weights_3d(mask, volume) regmean = np.empty(times) for t in range(times): - regmean[t] = np.average(var[t, :, :, :], axis=(0, 1, 2), - weights=np.squeeze(weights)) + regmean[t] = np.ma.average( + var[t, :, :, :], axis=(0, 1, 2), weights=np.squeeze(weights)) regmean_total[basin] = regmean return regmean_total -- GitLab From 9a9a211de829ae9bcc1aec41ddfc154d24b59f57 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 23 Jul 2020 13:47:48 +0200 Subject: [PATCH 2/2] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 73fa056..2d08400 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ REQUIREMENTS = { setup(name='diagonals', - version='0.3.0', + version='0.3.1', description='Compute diagnostics targeting the CPU or the GPU', url='https://earth.bsc.es/gitlab/es/diagonals', author='BSC-CNS Earth Sciences Department', -- GitLab