Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix masking of surface climatologies #861

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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