Unable to provide `decode_timedelta` to open_virtual_dataset
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.
Should that be added as an explicit kwarg here? Or should we pass arbitrary kwargs to the xr.open_zarr() call?
I guess we might need to do that yes. We basically just inherit the complexity of xarray here.
Happy to work on this. Would you prefer to keep things explicit by just adding keywords or catching arbitrary kwargs and passing them on (letting xr.open_zarr deal with whether they work or not)?
Happy to work on this. Would you prefer to keep things explicit by just adding keywords or catching arbitrary kwargs and passing them on (letting xr.open_zarr deal with whether they work or not)?
I'm pretty strongly in favor of adding keywords because pass-through kwargs make for more confusing errors and make autocompletion/linters less effective.
Took a swing at it in https://github.com/zarr-developers/VirtualiZarr/pull/800, still a WIP, but there are some open questions that I would love to get some input on.