Preserve StringDType in Zarr v3 round trips#11474
Open
stanbot8 wants to merge 1 commit into
Open
Conversation
|
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
stanbot8
force-pushed
the
fix/11466-stringdtype-zarr
branch
from
July 25, 2026 17:27
9897f7d to
db97531
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Zarr format 3 round trips change NumPy StringDType arrays to fixed-width Unicode arrays. Preserve NumPy StringDType for variables and coordinates in Zarr format 3 round trips. Closes #11466.
Design
The shared string encoder converts native StringDType arrays to fixed-width Unicode before the Zarr format 3 writer receives them. The Zarr format 3 path preserves the native stored dtype, and the shared decoder retains that dtype when the storage encoding matches it.
The implementation changes
doc/whats-new.rst,xarray/backends/zarr.py, andxarray/coding/variables.py.Tests
The baseline failed, and the candidate passed the same reproducer. The focused A/B reproducer passed on the candidate. 417 tests passed, 55 tests skipped, and 4 tests had expected failures. The repository quality checks passed in CI.
The tests are in
xarray/tests/test_backends.py.Commands
Checklist
whats-new.rst.