Skip to content

Commit 6acd346

Browse files
authored
Align with new xarray's defaults (#141)
* align with xarray new defaults * fix test
1 parent e94dcc8 commit 6acd346

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cacholote/extra_encoders.py

+2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ def decode_xr_object(
246246
**{protocol: fs.storage_options for protocol in protocols},
247247
) as of:
248248
filename_or_obj = of.name
249+
250+
kwargs.setdefault("decode_timedelta", False)
249251
if xr_type == "Dataset":
250252
return xr.open_dataset(filename_or_obj, **kwargs)
251253
return xr.open_dataarray(filename_or_obj, **kwargs)

tests/test_40_xarray_encoder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_grib_ds() -> xr.Dataset:
2121
pytest.importorskip("cfgrib")
2222
eccodes = pytest.importorskip("eccodes")
2323
filename = pathlib.Path(eccodes.codes_samples_path()) / "GRIB2.tmpl"
24-
ds = xr.open_dataset(filename, engine="cfgrib")
24+
ds = xr.open_dataset(filename, engine="cfgrib", decode_timedelta=False)
2525
del ds.attrs["history"]
2626
return ds
2727

0 commit comments

Comments
 (0)