Skip to content

Fix drop_encoding to avoid copying data (GH#11390) - #11394

Merged
dcherian merged 1 commit into
pydata:mainfrom
wali-reheman:fix/drop-encoding-shallow-copy
Jun 24, 2026
Merged

Fix drop_encoding to avoid copying data (GH#11390)#11394
dcherian merged 1 commit into
pydata:mainfrom
wali-reheman:fix/drop-encoding-shallow-copy

Conversation

@wali-reheman

@wali-reheman wali-reheman commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

drop_encoding() was triggering a full copy of the underlying data array via _replace, which causes OOM on large datasets. Changed _replace to skip the data copy when only encoding/attrs/dims are being updated — this makes drop_encoding() a true shallow operation as the docs suggest.

@dcherian
dcherian merged commit 7ae5166 into pydata:main Jun 24, 2026
43 checks passed
@welcome

welcome Bot commented Jun 24, 2026

Copy link
Copy Markdown

Congratulations on completing your first pull request! Welcome to Xarray! We are proud of you, and hope to see you again! celebration gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop_encoding copies data of dataset

2 participants