Skip to content

Commit d29d36b

Browse files
steps-reclaudeerikvansebille
authored
fix: correct misplaced parentheses in _Spatialslip zeta corrections (#2743)
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) <noreply@anthropic.com> Co-authored-by: Erik van Sebille <e.vansebille@uu.nl>
1 parent 5a0df96 commit d29d36b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/parcels/interpolators/_xinterpolators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,22 +455,22 @@ def is_land(ti: int, zi: int, yi: int, xi: int):
455455
f_v,
456456
)
457457
f_u = np.where(
458-
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)),
458+
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),
459459
f_u * (a + b * zeta) / zeta,
460460
f_u,
461461
)
462462
f_u = np.where(
463-
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)),
463+
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),
464464
f_u * (1 - b * zeta) / (1 - zeta),
465465
f_u,
466466
)
467467
f_v = np.where(
468-
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)),
468+
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),
469469
f_v * (a + b * zeta) / zeta,
470470
f_v,
471471
)
472472
f_v = np.where(
473-
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)),
473+
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),
474474
f_v * (1 - b * zeta) / (1 - zeta),
475475
f_v,
476476
)

0 commit comments

Comments
 (0)