Skip to content

Commit

Permalink
Align with new xarray's defaults (#141)
Browse files Browse the repository at this point in the history
* align with xarray new defaults

* fix test
  • Loading branch information
malmans2 authored Feb 20, 2025
1 parent e94dcc8 commit 6acd346
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cacholote/extra_encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def decode_xr_object(
**{protocol: fs.storage_options for protocol in protocols},
) as of:
filename_or_obj = of.name

kwargs.setdefault("decode_timedelta", False)
if xr_type == "Dataset":
return xr.open_dataset(filename_or_obj, **kwargs)
return xr.open_dataarray(filename_or_obj, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_40_xarray_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_grib_ds() -> xr.Dataset:
pytest.importorskip("cfgrib")
eccodes = pytest.importorskip("eccodes")
filename = pathlib.Path(eccodes.codes_samples_path()) / "GRIB2.tmpl"
ds = xr.open_dataset(filename, engine="cfgrib")
ds = xr.open_dataset(filename, engine="cfgrib", decode_timedelta=False)
del ds.attrs["history"]
return ds

Expand Down

0 comments on commit 6acd346

Please sign in to comment.