Skip to content

Unable to provide decode_timedelta to open_virtual_dataset #749

@jbusecke

Description

@jbusecke

I just refactored some code to use v2 of virtualizarr and with that probably updated my xarray dependencies too.

I am now getting:

[/home/jovyan/mursst-icechunk-updater/.venv/lib/python3.12/site-packages/virtualizarr/xarray.py:341](https://hub.openveda.cloud/user/jbusecke/lab/tree/mursst-icechunk-updater/notebooks/mursst-icechunk-updater/.venv/lib/python3.12/site-packages/virtualizarr/xarray.py#line=340): FutureWarning: In a future version, xarray will not decode timedelta values based on the presence of a timedelta-like units attribute by default. Instead it will rely on the presence of a timedelta64 dtype attribute, which is now xarray's default way of encoding timedelta64 values. To continue decoding timedeltas based on the presence of a timedelta-like units attribute, users will need to explicitly opt-in by passing True or CFTimedeltaCoder(decode_via_units=True) to decode_timedelta. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.

I tried to provide the argument as suggested by the warning

open_virtual_mfdataset(..., decode_timedelta=True)

but that kwarg is not accepted in the open_virtual_dataset function. Should that be added as an explicit kwarg here? Or should we pass arbitrary kwargs to the xr.open_zarr() call?

Id be happy to work on a PR for this, but wanted to first get a rough idea if I am on the right path.

Happy to provide a MRE if needed, this was just a fairly elaborate workflow, and I wanted to make some more progress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    xarrayRequires changes to xarray upstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions