Skip to content

Commit

Permalink
Merge pull request #861 from xylar/fix_sst_masking
Browse files Browse the repository at this point in the history
Fix masking of surface climatologies
  • Loading branch information
xylar committed Feb 8, 2022
2 parents 82b1251 + 45f4be1 commit f3772d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ci/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dev-spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion mpas_analysis/shared/plot/climatology_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f3772d2

Please sign in to comment.