Skip to content

Commit bb275c3

Browse files
Fixing unit test
1 parent 10a44f8 commit bb275c3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/test_interpolation.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ def create_interpolation_data_with_land():
6565
"lon": np.linspace(0, 1, xdim),
6666
},
6767
)
68-
# Set a land point (for testing freeslip)
69-
ds["U"][:, :, 2, 5] = 0.0
70-
ds["V"][:, :, 2, 5] = 0.0
71-
ds["W"][:, :, 2, 5] = 0.0
72-
7368
return ds
7469

7570

@@ -148,8 +143,11 @@ def test_scipy_vs_jit(interp_method):
148143
dimensions = {"time": "time", "lon": "lon", "lat": "lat", "depth": "depth"}
149144
fieldset = FieldSet.from_xarray_dataset(create_interpolation_data_with_land(), variables, dimensions, mesh="flat")
150145

151-
for field in [fieldset.U, fieldset.V, fieldset.W]: # Set a land point (for testing freeslip)
146+
for field in [fieldset.U, fieldset.V, fieldset.W]:
152147
field.interp_method = interp_method
148+
# Set a land point (for testing freeslip)
149+
if interp_method == "freeslip":
150+
field.data[0, :, 2, 5] = 0
153151

154152
x, y, z = np.meshgrid(np.linspace(0, 1, 7), np.linspace(0, 1, 13), np.linspace(0, 1, 5))
155153

@@ -162,7 +160,7 @@ def DeleteParticle(particle, fieldset, time):
162160
particle.delete()
163161

164162
for pset in [pset_scipy, pset_jit]:
165-
pset.execute([AdvectionRK4_3D, DeleteParticle], runtime=4e-3, dt=1e-3)
163+
pset.execute([AdvectionRK4_3D, DeleteParticle], runtime=4, dt=1)
166164

167165
tol = 1e-6
168166
for i in range(len(pset_scipy)):

0 commit comments

Comments
 (0)