Skip to content

Commit 72478c5

Browse files
authored
Merge pull request #182 from csiro-coasts/latest-xarray-changes
Fix some warnings from latest xarray versions
2 parents ade7bf4 + 1e7c14e commit 72478c5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tests/misc/test_xarray_timedelta_units.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_xarray_timedelta_units_unsafe_cast(
5757
dataset.to_netcdf(tmp_path / "period.nc")
5858

5959

60-
@only_versions('xarray >= 2024.02.0')
60+
@only_versions('xarray >= 2024.02.0, < 2025.03.0')
6161
def test_xarray_timedelta_units_cast_runtimewarning(
6262
tmp_path: pathlib.Path,
6363
):
@@ -69,9 +69,12 @@ def test_xarray_timedelta_units_cast_runtimewarning(
6969
when casting a data array with dtype timedelta64 to int16
7070
if it contains NaT (not a time) values.
7171
72+
This check was later refactored out in favour of something more robust.
73+
7274
See also
7375
========
7476
https://github.com/pydata/xarray/issues/9134
77+
https://github.com/pydata/xarray/pull/9498
7578
"""
7679
dataset = make_dataset()
7780
message = "Not possible to cast encoded times from dtype('int64') to dtype('int16') without overflow."

tests/operations/test_cache.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ def test_cache_key_with_multifile_dataset_ugrid_mesh2d(datasets: pathlib.Path):
212212

213213
dataset_paths = [ugrid_path1, ugrid_path2]
214214

215-
multifile_dataset = xarray.open_mfdataset(dataset_paths, data_vars=['values'])
215+
multifile_dataset = xarray.open_mfdataset(
216+
dataset_paths, data_vars=['values'], compat='no_conflicts')
216217

217218
multifile_ds_hash = hashlib.sha1()
218219

@@ -230,7 +231,8 @@ def test_cache_key_with_multifile_dataset_cfgrid2d(datasets: pathlib.Path):
230231

231232
dataset_paths = [cfgrid_path1, cfgrid_path2]
232233

233-
multifile_dataset = xarray.open_mfdataset(dataset_paths, data_vars=['values'])
234+
multifile_dataset = xarray.open_mfdataset(
235+
dataset_paths, data_vars=['values'], compat='no_conflicts')
234236

235237
multifile_ds_hash = hashlib.sha1()
236238

0 commit comments

Comments
 (0)