From ba7dd43982c40a6b9b05548d908ef9c19865c1a0 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 8 Jan 2024 06:13:18 -0800 Subject: [PATCH] Limit lon to -180 to 180 in lon-lat region masks This is needed for grids where longitude is from 0 to 360 and it is inconvenient to modify the grid before passing it to the command-line tool. --- conda_package/mpas_tools/mesh/mask.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conda_package/mpas_tools/mesh/mask.py b/conda_package/mpas_tools/mesh/mask.py index 036bd5bb2..838a5a5d4 100644 --- a/conda_package/mpas_tools/mesh/mask.py +++ b/conda_package/mpas_tools/mesh/mask.py @@ -522,6 +522,9 @@ def compute_lon_lat_region_masks(lon, lat, fcMask, logger=None, pool=None, dsMasks = xr.Dataset() + # make sure lon is between -180 and 180 + lon = numpy.mod(lon + 180., 360.) - 180. + Lon, Lat = numpy.meshgrid(lon, lat) shape = Lon.shape