Skip to content

Finalize change in behavior of decode_timedelta=None - #11173

Merged
keewis merged 1 commit into
pydata:mainfrom
spencerkclark:finalize-decode_timedelta-deprecation
Feb 19, 2026
Merged

keewis merged 1 commit into
pydata:mainfrom
spencerkclark:finalize-decode_timedelta-deprecation

Conversation

@spencerkclark

Copy link
Copy Markdown
Member

This PR finalizes the deprecation cycle in the behavior of decode_timedelta=None. Xarray will now no longer by default decode variables with only a timedelta-like "units" attribute into np.timedelta64 values.

@keewis keewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check the tests, but otherwise looks good to me.

@keewis
keewis merged commit 58de6d2 into pydata:main Feb 19, 2026
40 checks passed
@spencerkclark
spencerkclark deleted the finalize-decode_timedelta-deprecation branch February 19, 2026 17:20
@spencerkclark

Copy link
Copy Markdown
Member Author

Thanks all

tonybaloney pushed a commit to tonybaloney/swe-complex-xarray that referenced this pull request Mar 19, 2026
PR: pydata#11173
Issue: pydata#10382
Base commit: a2c5464
Changed lines: 113
ShinoKana added a commit to ShinoKana/xarray that referenced this pull request Oct 13, 2026
- reset_encoding warned with a plain UserWarning and the wrong version;
  it now uses FutureWarning like the other deprecations, and 2023.10.
- cftime_range's docstring cited 2025.02.0, which was never released.
- Drop the leftover decode_timedelta warnings filter; that change was
  finalized in pydata#11173.
- DataTree.lineage warned twice because it went through iter_lineage.

Co-authored-by: Claude <noreply@anthropic.com>
headtr1ck pushed a commit that referenced this pull request Oct 14, 2026
* Small deprecation cleanups from #11721

- reset_encoding warned with a plain UserWarning and the wrong version;
  it now uses FutureWarning like the other deprecations, and 2023.10.
- cftime_range's docstring cited 2025.02.0, which was never released.
- Drop the leftover decode_timedelta warnings filter; that change was
  finalized in #11173.
- DataTree.lineage warned twice because it went through iter_lineage.

* Annotate the object list in test_reset_encoding_deprecated for mypy

---------

Co-authored-by: ShinoKana <ShinoKana@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
zhaoruizhe81 added a commit to zhaoruizhe81/xarray that referenced this pull request Oct 17, 2026
Since pydata#11173, decode_timedelta=None only decodes variables whose
attributes contain both a timedelta units attribute and a dtype
attribute, regardless of decode_times. The docstrings of open_dataset,
open_dataarray, open_datatree, open_groups, open_zarr, decode_cf and
decode_cf_variable still described the pre-pydata#11173 behavior, and the
CFTimedeltaCoder.decode_via_units docstring said it defaults to True
when the signature default is False. Rewrite them to match the actual
behavior (fixing a decode_time typo in open_zarr along the way) and add
a units-only zarr regression test pinning the None behavior end to end.

No behavior is changed.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FutureWarning: decode_timedelta will default to False rather than None

4 participants