Skip to content

Commit 9a4eb57

Browse files
committed
Delete tests that are handled by xarray
1 parent 2ffddf3 commit 9a4eb57

3 files changed

Lines changed: 0 additions & 164 deletions

File tree

docs/examples/example_globcurrent.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ def set_globcurrent_fieldset(
3030
)
3131

3232

33-
@pytest.mark.v4remove(
34-
reason="indices keryword is not supported in v4. Subsetting should be done on xarray level."
35-
)
36-
@pytest.mark.parametrize(
37-
"use_xarray", [True, pytest.param(False, marks=pytest.mark.xfail)]
38-
)
39-
def test_globcurrent_fieldset(use_xarray):
40-
fieldset = set_globcurrent_fieldset()
41-
assert fieldset.U.lon.size == 81
42-
assert fieldset.U.lat.size == 41
43-
assert fieldset.V.lon.size == 81
44-
assert fieldset.V.lat.size == 41
45-
46-
if not use_xarray:
47-
indices = {"lon": [5], "lat": range(20, 30)}
48-
fieldsetsub = set_globcurrent_fieldset(indices=indices)
49-
assert np.allclose(fieldsetsub.U.lon, fieldset.U.lon[indices["lon"]])
50-
assert np.allclose(fieldsetsub.U.lat, fieldset.U.lat[indices["lat"]])
51-
assert np.allclose(fieldsetsub.V.lon, fieldset.V.lon[indices["lon"]])
52-
assert np.allclose(fieldsetsub.V.lat, fieldset.V.lat[indices["lat"]])
53-
54-
5533
@pytest.mark.parametrize(
5634
"dt, lonstart, latstart", [(3600.0, 25, -35), (-3600.0, 20, -39)]
5735
)
@@ -103,55 +81,6 @@ def test_globcurrent_particles():
10381
assert abs(pset[0].lat - -35.3) < 1
10482

10583

106-
@pytest.mark.v4remove
107-
@pytest.mark.xfail(
108-
reason="Can't patch metadata without using xarray. v4 will natively use xarray anyway. GH1919."
109-
)
110-
@pytest.mark.parametrize("dt", [-300, 300])
111-
def test_globcurrent_xarray_vs_netcdf(dt):
112-
fieldsetNetcdf = set_globcurrent_fieldset(use_xarray=False)
113-
fieldsetxarray = set_globcurrent_fieldset(use_xarray=True)
114-
lonstart, latstart, runtime = (25, -35, timedelta(days=7))
115-
116-
psetN = parcels.ParticleSet(
117-
fieldsetNetcdf, pclass=parcels.Particle, lon=lonstart, lat=latstart
118-
)
119-
psetN.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
120-
121-
psetX = parcels.ParticleSet(
122-
fieldsetxarray, pclass=parcels.Particle, lon=lonstart, lat=latstart
123-
)
124-
psetX.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
125-
126-
assert np.allclose(psetN[0].lon, psetX[0].lon)
127-
assert np.allclose(psetN[0].lat, psetX[0].lat)
128-
129-
130-
@pytest.mark.v4remove
131-
@pytest.mark.xfail(
132-
reason="Timeslices will be removed in v4, as users will be able to use xarray directly."
133-
)
134-
@pytest.mark.parametrize("dt", [-300, 300])
135-
def test_globcurrent_netcdf_timestamps(dt):
136-
fieldsetNetcdf = set_globcurrent_fieldset()
137-
timestamps = fieldsetNetcdf.U.grid.timeslices
138-
fieldsetTimestamps = set_globcurrent_fieldset(timestamps=timestamps)
139-
lonstart, latstart, runtime = (25, -35, timedelta(days=7))
140-
141-
psetN = parcels.ParticleSet(
142-
fieldsetNetcdf, pclass=parcels.Particle, lon=lonstart, lat=latstart
143-
)
144-
psetN.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
145-
146-
psetT = parcels.ParticleSet(
147-
fieldsetTimestamps, pclass=parcels.Particle, lon=lonstart, lat=latstart
148-
)
149-
psetT.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
150-
151-
assert np.allclose(psetN.lon[0], psetT.lon[0])
152-
assert np.allclose(psetN.lat[0], psetT.lat[0])
153-
154-
15584
def test__particles_init_time():
15685
fieldset = set_globcurrent_fieldset()
15786

tests/test_field.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

tests/test_fieldset.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,6 @@ def multifile_fieldset(tmp_path):
7979
return FieldSet.from_netcdf(files, variables, dimensions)
8080

8181

82-
@pytest.mark.v4remove
83-
@pytest.mark.xfail(reason="GH1946")
84-
@pytest.mark.parametrize("xdim", [100, 200])
85-
@pytest.mark.parametrize("ydim", [100, 200])
86-
def test_fieldset_from_data(xdim, ydim):
87-
"""Simple test for fieldset initialisation from data."""
88-
data, dimensions = generate_fieldset_data(xdim, ydim)
89-
fieldset = FieldSet.from_data(data, dimensions)
90-
assert len(fieldset.U.data.shape) == 2
91-
assert len(fieldset.V.data.shape) == 2
92-
assert np.allclose(fieldset.U.data, data["U"], rtol=1e-12)
93-
assert np.allclose(fieldset.V.data, data["V"], rtol=1e-12)
94-
95-
96-
@pytest.mark.v4remove
97-
@pytest.mark.xfail(reason="vmin and vmax were removed as arguments")
98-
def test_fieldset_vmin_vmax():
99-
data, dimensions = generate_fieldset_data(11, 11)
100-
fieldset = FieldSet.from_data(data, dimensions, vmin=3, vmax=7)
101-
assert np.isclose(np.amin(fieldset.U.data[fieldset.U.data > 0.0]), 3)
102-
assert np.isclose(np.amax(fieldset.U.data), 7)
103-
104-
10582
@pytest.mark.v4remove
10683
@pytest.mark.xfail(reason="GH1946")
10784
@pytest.mark.parametrize("ttype", ["float", "datetime64"])

0 commit comments

Comments
 (0)