Skip to content

Commit 0809675

Browse files
Fix boundary mask for antimeridian generic dataset
1 parent 4dc0deb commit 0809675

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

parcels/_datasets/unstructured/generic.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,9 @@ def _fesom2_square_delaunay_antimeridian():
218218
All fields are placed on location consistent with FESOM2 variable placement conventions
219219
"""
220220
lon, lat = np.meshgrid(
221-
np.linspace(-210.0, -150.0, Nx, dtype=np.float32), np.linspace(0, 60.0, Nx, dtype=np.float32)
221+
np.linspace(-210.0, -150.0, Nx, dtype=np.float32), np.linspace(-40.0, 40.0, Nx, dtype=np.float32)
222222
)
223223
# wrap longitude from [-180,180]
224-
lon = np.where(lon < -180, lon + 360, lon)
225224
lon_flat = lon.ravel()
226225
lat_flat = lat.ravel()
227226
zf = np.linspace(0.0, 1000.0, 10, endpoint=True, dtype=np.float32) # Vertical element faces
@@ -231,7 +230,10 @@ def _fesom2_square_delaunay_antimeridian():
231230

232231
# mask any point on one of the boundaries
233232
mask = (
234-
np.isclose(lon_flat, 0.0) | np.isclose(lon_flat, 60.0) | np.isclose(lat_flat, 0.0) | np.isclose(lat_flat, 60.0)
233+
np.isclose(lon_flat, -210.0)
234+
| np.isclose(lon_flat, -150.0)
235+
| np.isclose(lat_flat, -40.0)
236+
| np.isclose(lat_flat, 40.0)
235237
)
236238

237239
boundary_points = np.flatnonzero(mask)

0 commit comments

Comments
 (0)