Skip to content

Commit b10725b

Browse files
Fixing SpatialSlip interpolators for spherical meshes
1 parent 248e2e2 commit b10725b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/parcels/interpolators/_xinterpolators.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,17 @@ def is_land(ti: int, zi: int, yi: int, xi: int):
475475
f_v,
476476
)
477477

478-
u *= f_u
479-
v *= f_v
478+
if is_dask_collection(u):
479+
u = u.compute()
480+
v = v.compute()
481+
482+
u = u * f_u
483+
v = v * f_v
484+
485+
if vectorfield.grid._mesh == "spherical":
486+
u /= 1852 * 60 * np.cos(np.deg2rad(particle_positions["y"]))
487+
v /= 1852 * 60
488+
480489
if vectorfield.W:
481490
f_w = np.ones_like(zeta)
482491
f_w = np.where(
@@ -500,7 +509,7 @@ def is_land(ti: int, zi: int, yi: int, xi: int):
500509
f_w,
501510
)
502511

503-
w *= f_w
512+
w = w * f_w
504513
else:
505514
w = np.zeros_like(u)
506515
return u, v, w

0 commit comments

Comments
 (0)