Skip to content

Commit 08fc1e6

Browse files
Also saving the rFieldSet for testing in v4
Because otherwise random generator may not yield the same fields
1 parent ee4dd32 commit 08fc1e6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_interpolation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import parcels._interpolation as interpolation
66
from parcels import AdvectionRK4_3D, FieldSet, JITParticle, ParticleSet, ScipyParticle
7-
from tests.utils import create_fieldset_zeros_3d
7+
from tests.utils import TEST_DATA, create_fieldset_zeros_3d
88

99

1010
@pytest.fixture
@@ -52,6 +52,7 @@ def create_interpolation_data():
5252

5353
def create_interpolation_data_random(*, with_land_point: bool) -> xr.Dataset:
5454
tdim, zdim, ydim, xdim = 20, 5, 10, 10
55+
np.random.seed(1636)
5556
ds = xr.Dataset(
5657
{
5758
"U": (("time", "depth", "lat", "lon"), (np.random.random((tdim, zdim, ydim, xdim)) / 1e2)),
@@ -145,8 +146,10 @@ def test_scipy_vs_jit(interp_method):
145146
"""Test that the scipy and JIT versions of the interpolation are the same."""
146147
variables = {"U": "U", "V": "V", "W": "W"}
147148
dimensions = {"time": "time", "lon": "lon", "lat": "lat", "depth": "depth"}
149+
ds = create_interpolation_data_random(with_land_point=interp_method == "freeslip")
150+
ds.to_netcdf(str(TEST_DATA / f"test_interpolation_data_random_{interp_method}.nc"))
148151
fieldset = FieldSet.from_xarray_dataset(
149-
create_interpolation_data_random(with_land_point=interp_method == "freeslip"),
152+
ds,
150153
variables,
151154
dimensions,
152155
mesh="flat",

0 commit comments

Comments
 (0)