refactor(zarr): clean up how the Zarr backend consumes the encoding dict - #11479
Open
d-v-b wants to merge 1 commit into
Open
refactor(zarr): clean up how the Zarr backend consumes the encoding dict#11479d-v-b wants to merge 1 commit into
d-v-b wants to merge 1 commit into
Conversation
… path Define the encoding keys the Zarr backend accepts as module-level constants (ZARR_V2_ENCODING_KEYS, ZARR_V3_ENCODING_KEYS, ZARR_READ_ONLY_ENCODING_KEYS) and extract a pure _validate_zarr_variable_encoding helper from extract_zarr_variable_encoding. _create_new_array now assembles zarr create() arguments in its own dict instead of mutating the variable's encoding, takes the dimension names explicitly, and records them in one place for both zarr formats (native dimension_names metadata for format 3, the hidden _ARRAY_DIMENSIONS attribute for format 2). Remove unreachable "order" handling from array creation, and correct the formatting of the conflicting-write_empty_chunks error message. Behavior is otherwise unchanged; tests are split one case per function and new tests pin the constants and the conflict error. Assisted-by: ClaudeCode:claude-fable-5 Co-authored-by: Claude <noreply@anthropic.com>
d-v-b
force-pushed
the
claude/zarr-encoding-refactor
branch
from
July 30, 2026 09:03
d4a4923 to
eab28a3
Compare
5 tasks
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.
Description
This PR consolidates logic for the encoding dict when working with Zarr arrays. New module-level constants are defined for the keys xarray cares about, a new function is added for validating the encoding dict, and the v2 / v3 differences re: dimension names are pushed down into a utility function.
There are no behavioral changes.
AI Disclosure
This work was done with claude. See the AI-generated source PR here: d-v-b#1