Skip to content

Commit

Permalink
Compute global stats on obs only where not land
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Feb 8, 2022
1 parent 82b1251 commit 8dd6d90
Showing 1 changed file with 8 additions and 1 deletion.
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 8dd6d90

Please sign in to comment.