From c8155c6f3b941e67e2672e675193e0a759e74e31 Mon Sep 17 00:00:00 2001 From: Mike German Date: Fri, 10 Jul 2026 13:52:06 -0400 Subject: [PATCH] fix: correct misplaced parentheses in _Spatialslip zeta corrections In the 3D branch of _Spatialslip, the four vertical (zeta) slip corrections had a misplaced closing parenthesis, e.g.: is_land(0, 0, 1, 0 & is_land(0, 0, 1, 1) & (zeta > 0)) so the `& is_land(...) & (zeta > 0)` mask meant to gate np.where was instead swallowed into is_land's 4th positional argument (the x-index). Both the land test and the zeta position gate were therefore wrong, breaking the vertical free-/partial-slip boundary correction for 3D C-grid velocities. Fixed to match the analogous, correctly-formed eta/xsi corrections in the same function: is_land(0, 0, 1, 0) & is_land(0, 0, 1, 1) & (zeta > 0) Existing interpolation and convert tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/parcels/interpolators/_xinterpolators.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parcels/interpolators/_xinterpolators.py b/src/parcels/interpolators/_xinterpolators.py index d20313ffb..388925d1a 100644 --- a/src/parcels/interpolators/_xinterpolators.py +++ b/src/parcels/interpolators/_xinterpolators.py @@ -455,22 +455,22 @@ def is_land(ti: int, zi: int, yi: int, xi: int): f_v, ) f_u = np.where( - is_land(0, 0, 0, 0) & is_land(0, 0, 0, 1) & is_land(0, 0, 1, 0 & is_land(0, 0, 1, 1) & (zeta > 0)), + is_land(0, 0, 0, 0) & is_land(0, 0, 0, 1) & is_land(0, 0, 1, 0) & is_land(0, 0, 1, 1) & (zeta > 0), f_u * (a + b * zeta) / zeta, f_u, ) f_u = np.where( - is_land(0, 1, 0, 0) & is_land(0, 1, 0, 1) & is_land(0, 1, 1, 0 & is_land(0, 1, 1, 1) & (zeta < 1)), + is_land(0, 1, 0, 0) & is_land(0, 1, 0, 1) & is_land(0, 1, 1, 0) & is_land(0, 1, 1, 1) & (zeta < 1), f_u * (1 - b * zeta) / (1 - zeta), f_u, ) f_v = np.where( - is_land(0, 0, 0, 0) & is_land(0, 0, 0, 1) & is_land(0, 0, 1, 0 & is_land(0, 0, 1, 1) & (zeta > 0)), + is_land(0, 0, 0, 0) & is_land(0, 0, 0, 1) & is_land(0, 0, 1, 0) & is_land(0, 0, 1, 1) & (zeta > 0), f_v * (a + b * zeta) / zeta, f_v, ) f_v = np.where( - is_land(0, 1, 0, 0) & is_land(0, 1, 0, 1) & is_land(0, 1, 1, 0 & is_land(0, 1, 1, 1) & (zeta < 1)), + is_land(0, 1, 0, 0) & is_land(0, 1, 0, 1) & is_land(0, 1, 1, 0) & is_land(0, 1, 1, 1) & (zeta < 1), f_v * (1 - b * zeta) / (1 - zeta), f_v, )