diff --git a/compass/ocean/mesh/remap_topography.py b/compass/ocean/mesh/remap_topography.py index c3505f9fef..52ce7d64bc 100644 --- a/compass/ocean/mesh/remap_topography.py +++ b/compass/ocean/mesh/remap_topography.py @@ -1,5 +1,6 @@ import os +import numpy as np import xarray as xr from mpas_tools.io import write_netcdf from pyremap import LatLonGridDescriptor, MpasCellMeshDescriptor, Remapper @@ -138,6 +139,11 @@ def run(self): out_var = rename[option] ds_out[out_var] = ds_in[in_var] + # make sure fractions don't exceed 1 + for var in ['landIceFracObserved', 'landIceGroundedFracObserved', + 'oceanFracObserved']: + ds_out[var] = np.minimum(ds_out[var], 1.) + # renormalize elevation variables norm = ds_out.oceanFracObserved valid = norm > renorm_threshold