Skip to content

fix: allow non-mapping chunks in DataTree.chunk#11320

Open
SAY-5 wants to merge 2 commits intopydata:mainfrom
SAY-5:fix/datatree-chunk-auto-11315
Open

fix: allow non-mapping chunks in DataTree.chunk#11320
SAY-5 wants to merge 2 commits intopydata:mainfrom
SAY-5:fix/datatree-chunk-auto-11315

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 5, 2026

Description

Calling DataTree.chunk("auto") (or with any non-mapping value such as an int) raised TypeError: invalid type for chunks: <class 'str'>. Only mappings are supported, even though the type annotation T_ChunksFreq and the docstring both advertise that strings/ints/"auto" are valid.

This brings DataTree.chunk in line with Dataset.chunk: a non-mapping value is broadcast across all tree dimensions, None emits a FutureWarning instead of raising, and tuples/lists emit the same deprecation warning as Dataset.

Checklist

Match Dataset.chunk by accepting strings (e.g. "auto"), ints,
and tuples/lists in DataTree.chunk, broadcasting the value to
all dimensions of the tree. Previously any non-Mapping argument
raised TypeError.

Closes pydata#11315

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@github-actions github-actions Bot added the topic-DataTree Related to the implementation of a DataTree class label May 5, 2026
Signed-off-by: SAY-5 <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-DataTree Related to the implementation of a DataTree class

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot call .chunk('auto') on DataTree.

1 participant