Skip to content

Commit 83c4054

Browse files
authored
Merge pull request #980 from MPAS-Dev/develop
Merge `develop` to `main`
2 parents 26c0800 + 27d0c23 commit 83c4054

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

ci/recipe/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set name = "MPAS-Analysis" %}
2-
{% set version = "1.9.0" %}
2+
{% set version = "1.9.1" %}
33

44
package:
55
name: {{ name|lower }}
@@ -35,7 +35,7 @@ requirements:
3535
- lxml
3636
- mache >=1.11.0
3737
- matplotlib-base >=3.6.0,!=3.7.2
38-
- mpas_tools >=0.16.0
38+
- mpas_tools >=0.30.0
3939
- nco >=4.8.1
4040
- netcdf4
4141
- numpy

dev-spec.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mache >=1.11.0
1818
# 3.7.2 contains a bug with tight layouts and insets
1919
# https://github.com/matplotlib/matplotlib/pull/26291
2020
matplotlib-base>=3.6.0,!=3.7.2
21-
mpas_tools>=0.16.0
21+
mpas_tools>=0.30.0
2222
nco>=4.8.1
2323
netcdf4
2424
numpy

mpas_analysis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
import matplotlib as mpl
44
mpl.use('Agg')
55

6-
__version_info__ = (1, 9, 0)
6+
__version_info__ = (1, 9, 1)
77
__version__ = '.'.join(str(vi) for vi in __version_info__)

mpas_analysis/shared/html/pages.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def generate_html(config, analyses, controlConfig, customConfigFiles):
9292
html_dir = config.get('output', 'htmlSubdirectory')
9393
if html_dir.startswith(base_path):
9494
url = base_url + html_dir[len(base_path):]
95+
if not url.endswith('/'):
96+
# lack of trailing '/' is causing issues on NERSC's portal
97+
url = f'{url}/'
9598
print(f'Web page: {url}')
9699
if url is None:
97100
print("Done.")

mpas_analysis/shared/plot/climatology_map.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -702,42 +702,52 @@ def plot_panel(ax, title, array, colormap, norm, levels, ticks, contours,
702702
def _add_stats(modelArray, refArray, diffArray, Lats, axes):
703703
""" compute the means, std devs. and Pearson correlation """
704704
weights = np.cos(np.deg2rad(Lats))
705-
modelMean = np.average(modelArray, weights=weights)
705+
706+
model_weights = weights
707+
model_mask = None
708+
if isinstance(modelArray, np.ma.MaskedArray):
709+
# make sure we're using the MPAS land mask for all 3 sets of stats
710+
model_mask = modelArray.mask
711+
model_weights = np.ma.array(weights, mask=model_mask)
712+
713+
modelMean = np.average(modelArray, weights=model_weights)
706714

707715
_add_stats_text(
708716
names=['Min', 'Mean', 'Max'],
709717
values=[np.amin(modelArray), modelMean, np.amax(modelArray)],
710718
ax=axes[0], loc='upper')
711719

712720
if refArray is not None:
721+
ref_weights = weights
722+
ref_mask = None
713723
if isinstance(modelArray, np.ma.MaskedArray):
714724
# make sure we're using the MPAS land mask for all 3 sets of stats
715-
mask = modelArray.mask
716725
if isinstance(refArray, np.ma.MaskedArray):
717726
# mask invalid where either model or ref array is invalid
718-
mask = np.logical_or(mask, refArray.mask)
719-
refArray = np.ma.array(refArray, mask=mask)
727+
ref_mask = np.logical_or(model_mask, refArray.mask)
728+
ref_weights = np.ma.array(weights, mask=ref_mask)
729+
refArray = np.ma.array(refArray, mask=ref_mask)
720730
modelAnom = modelArray - modelMean
721-
modelVar = np.average(modelAnom ** 2, weights=weights)
722-
refMean = np.average(refArray, weights=weights)
731+
modelVar = np.average(modelAnom ** 2, weights=ref_weights)
732+
refMean = np.average(refArray, weights=ref_weights)
723733
refAnom = refArray - refMean
724-
refVar = np.average(refAnom**2, weights=weights)
734+
refVar = np.average(refAnom**2, weights=ref_weights)
725735

726736
_add_stats_text(
727737
names=['Min', 'Mean', 'Max'],
728738
values=[np.amin(refArray), refMean, np.amax(refArray)],
729739
ax=axes[1], loc='upper')
730740

731-
diffMean = np.average(diffArray, weights=weights)
732-
diffVar = np.average((diffArray - diffMean)**2, weights=weights)
741+
diffMean = np.average(diffArray, weights=ref_weights)
742+
diffVar = np.average((diffArray - diffMean)**2, weights=ref_weights)
733743
diffRMSE = np.sqrt(diffVar)
734744

735745
_add_stats_text(
736746
names=['Min', 'Mean', 'Max'],
737747
values=[np.amin(diffArray), diffMean, np.amax(diffArray)],
738748
ax=axes[2], loc='upper')
739749

740-
covar = np.average(modelAnom*refAnom, weights=weights)
750+
covar = np.average(modelAnom*refAnom, weights=ref_weights)
741751

742752
corr = covar/np.sqrt(modelVar*refVar)
743753

0 commit comments

Comments
 (0)