Skip to content

Commit 1c948dd

Browse files
Fixing stommel gyre CGrid interpolation test
1 parent 196c6e7 commit 1c948dd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

parcels/application_kernels/interpolation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def CGrid_Velocity(
269269

270270
# check whether the grid conversion has been applied correctly
271271
xx = (1 - xsi) * (1 - eta) * px[0] + xsi * (1 - eta) * px[1] + xsi * eta * px[2] + (1 - xsi) * eta * px[3]
272-
u = np.where(np.abs(xx - x) > 1e-4, np.nan, u)
272+
u = np.where(np.abs((xx - x) / x) > 1e-4, np.nan, u)
273273

274274
if vectorfield.W:
275275
data = vectorfield.W.data

tests/v4/test_advection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414
from parcels.application_kernels.advection import AdvectionEE, AdvectionRK4, AdvectionRK4_3D, AdvectionRK45
1515
from parcels.application_kernels.advectiondiffusion import AdvectionDiffusionEM, AdvectionDiffusionM1
16-
from parcels.application_kernels.interpolation import CGrid_Tracer, CGrid_Velocity, XLinear
16+
from parcels.application_kernels.interpolation import CGrid_Velocity, XLinear
1717
from parcels.field import Field, VectorField
1818
from parcels.fieldset import FieldSet
1919
from parcels.particle import Particle, Variable
@@ -342,10 +342,9 @@ def test_stommelgyre_fieldset(method, rtol, grid_type):
342342
ds = stommel_gyre_dataset(grid_type=grid_type)
343343
grid = XGrid.from_dataset(ds)
344344
vector_interp_method = None if grid_type == "A" else CGrid_Velocity
345-
tracer_interp_method = XLinear if grid_type == "A" else CGrid_Tracer
346345
U = Field("U", ds["U"], grid)
347346
V = Field("V", ds["V"], grid)
348-
P = Field("P", ds["P"], grid, interp_method=tracer_interp_method)
347+
P = Field("P", ds["P"], grid, interp_method=XLinear)
349348
UV = VectorField("UV", U, V, vector_interp_method=vector_interp_method)
350349
fieldset = FieldSet([U, V, P, UV])
351350

0 commit comments

Comments
 (0)