From 8dd6d906600601de7fae2b903d15d846aeb72bec Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 7 Feb 2022 16:14:17 -0700 Subject: [PATCH 1/2] Compute global stats on obs only where not land --- mpas_analysis/shared/plot/climatology_map.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mpas_analysis/shared/plot/climatology_map.py b/mpas_analysis/shared/plot/climatology_map.py index 07a009e9e..287b99001 100644 --- a/mpas_analysis/shared/plot/climatology_map.py +++ b/mpas_analysis/shared/plot/climatology_map.py @@ -67,7 +67,7 @@ def plot_polar_comparison( the configuration, containing a [plot] section with options that control plotting - Lons, Lats : numpy.ndarray + lon, lat : float arrays longitude and latitude arrays modelArray, refArray : numpy.ndarray @@ -663,6 +663,13 @@ def _add_stats(modelArray, refArray, diffArray, Lats, axes): ax=axes[0], loc='upper') if refArray is not None: + if isinstance(modelArray, np.ma.MaskedArray): + # make sure we're using the MPAS land mask for all 3 sets of stats + mask = modelArray.mask + if isinstance(refArray, np.ma.MaskedArray): + # mask invalid where either model or ref array is invalid + mask = np.logical_or(mask, refArray.mask) + refArray = np.ma.array(refArray, mask=mask) modelAnom = modelArray - modelMean modelVar = np.average(modelAnom ** 2, weights=weights) refMean = np.average(refArray, weights=weights) From 45f4be1c861ea4447b9b1be0bc26723fd0d7f872 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 7 Feb 2022 17:16:15 -0700 Subject: [PATCH 2/2] Update pyremap version --- ci/recipe/meta.yaml | 2 +- dev-spec.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index 9dedce6ab..297cef9f4 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -40,7 +40,7 @@ requirements: - pillow - progressbar2 - pyproj - - pyremap >=0.0.13,<0.1.0 + - pyremap >=0.0.14,<0.1.0 - python-dateutil - requests - scipy diff --git a/dev-spec.txt b/dev-spec.txt index ab788cd35..ac43d1594 100644 --- a/dev-spec.txt +++ b/dev-spec.txt @@ -21,7 +21,7 @@ pandas pillow progressbar2 pyproj -pyremap>=0.0.13,<0.1.0 +pyremap>=0.0.14,<0.1.0 python-dateutil requests scipy