Skip to content

Commit b0307e6

Browse files
committed
Update test to run on other copernicus dataset
1 parent 6c7e604 commit b0307e6

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/v4/test_fieldset.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,14 @@ def test_fieldset_add_field_after_pset():
216216
...
217217

218218

219-
def test_fieldset_from_copernicusmarine(caplog):
220-
ds = datasets_circulation_models["ds_copernicusmarine_globcurrent"]
219+
_COPERNICUS_DATASETS = [
220+
datasets_circulation_models["ds_copernicusmarine"],
221+
datasets_circulation_models["ds_copernicusmarine_globcurrent"],
222+
]
223+
224+
225+
@pytest.mark.parametrize("ds", _COPERNICUS_DATASETS)
226+
def test_fieldset_from_copernicusmarine(ds, caplog):
221227
fieldset = FieldSet.from_copernicusmarine(ds)
222228
assert "U" in fieldset.fields
223229
assert "V" in fieldset.fields
@@ -226,9 +232,14 @@ def test_fieldset_from_copernicusmarine(caplog):
226232
assert "renamed it to 'V'" in caplog.text
227233

228234

229-
def test_fieldset_from_copernicusmarine_no_logs(caplog):
230-
ds = datasets_circulation_models["ds_copernicusmarine_globcurrent"]
231-
fieldset = FieldSet.from_copernicusmarine(ds.rename({"ve": "V", "ue": "U"}))
235+
@pytest.mark.parametrize("ds", _COPERNICUS_DATASETS)
236+
def test_fieldset_from_copernicusmarine_no_logs(ds, caplog):
237+
ds = ds.copy()
238+
zeros = xr.zeros_like(list(ds.data_vars.values())[0])
239+
ds["U"] = zeros
240+
ds["V"] = zeros
241+
242+
fieldset = FieldSet.from_copernicusmarine(ds)
232243
assert "U" in fieldset.fields
233244
assert "V" in fieldset.fields
234245
assert "UV" in fieldset.fields

0 commit comments

Comments
 (0)