Skip to content

Commit

Permalink
Add from_netcdf path object test
Browse files Browse the repository at this point in the history
Contributes to #1706
  • Loading branch information
VeckoTheGecko committed Dec 5, 2024
1 parent d8713c8 commit 9013062
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,25 @@ def test_field_from_netcdf(with_timestamps):
Field.from_netcdf(filenames, variable, dimensions, interp_method="cgrid_velocity")


@pytest.mark.parametrize(
"f",
[
pytest.param(lambda x: x, id="Path"),
pytest.param(lambda x: str(x), id="str"),
],
)
def test_from_netcdf_path_object(f):
filenames = {
"lon": f(TEST_DATA / "mask_nemo_cross_180lon.nc"),
"lat": f(TEST_DATA / "mask_nemo_cross_180lon.nc"),
"data": f(TEST_DATA / "Uu_eastward_nemo_cross_180lon.nc"),
}
variable = "U"
dimensions = {"lon": "glamf", "lat": "gphif"}

Field.from_netcdf(filenames, variable, dimensions, interp_method="cgrid_velocity")


@pytest.mark.parametrize(
"calendar, cftime_datetime", zip(_get_cftime_calendars(), _get_cftime_datetimes(), strict=True)
)
Expand Down

0 comments on commit 9013062

Please sign in to comment.