Skip to content

xarray FutureWarning on decoding time: update time.dtype in particlefile? #2427

@erikvansebille

Description

@erikvansebille

I just saw the following warning on the [particle interaction notebook](https://parcels--2426.org.readthedocs.build/en/2426/user_guide/examples/tutorial_interaction.html:

FutureWarning: In a future version, xarray will not decode the variable 'time' into a timedelta64 dtype 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 into a timedelta64 dtype, either set `decode_timedelta=True` when opening this dataset, or add the attribute `dtype='timedelta64[ns]'` to this variable on disk.
To opt-in to future behavior, set `decode_timedelta=False`.
  data_xarray = xr.open_zarr("InteractingParticles.zarr")

See also pydata/xarray#10382

We should probably update the time.dtype in ParticleFile to remove this warning?

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue that has not been reviewed by a Parcels team member

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions