Conversation
Dimension names were only reachable through `array.metadata.dimension_names`, and only for Zarr format 3, because `ArrayV2Metadata` had no such attribute. Add a `dimension_names` property to `ArrayV2Metadata` that always returns None, following `shards`, and expose it on `AsyncArray` and `Array`. `from_array` now reads the property instead of branching on the format. Closes zarr-developers#3595 Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Link the dimension_names section of the v3 core spec from the Array.dimension_names and AsyncArray.dimension_names docstrings, and test that duplicate names round-trip. Assisted-by: ClaudeCode:claude-opus-5-5
d-v-b
marked this pull request as ready for review
September 24, 2026 11:44
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4401 +/- ##
=======================================
Coverage 94.37% 94.37%
=======================================
Files 93 93
Lines 13171 13180 +9
=======================================
+ Hits 12430 12439 +9
Misses 741 741
🚀 New features to boost your workflow:
|
Contributor
Author
|
I'm requesting review because this adds public API |
maxrjones
approved these changes
Sep 25, 2026
maxrjones
left a comment
Member
There was a problem hiding this comment.
I like this addition. Thanks, Davis.
This branch has not been deployed
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.
This PR adds a
.dimension_namesattribute toArray. It'sNonefor V2 arrays, andmetadata.dimension_namesfor v3 arrays. Closes #3595.🤖 AI text below 🤖
Closes #3595.
Until now, dimension names could only be read through
array.metadata.dimension_names, and only for Zarr format 3 arrays, becauseArrayV2Metadatahad no such attribute. As agreed in the issue, the new property returnsNonefor Zarr format 2 arrays, which matches the v3 spec's meaning of an absentdimension_names.Changes
ArrayV2Metadata.dimension_names: a property that always returnsNone. This mirrors the existingArrayV2Metadata.shards, so code can read the attribute from either metadata version.AsyncArray.dimension_namesandArray.dimension_names: properties that return the metadata's value, typedtuple[str | None, ...] | None.from_arraynow takes the source's dimension names fromdata.dimension_names, instead of readingmetadata.dimension_namesonly when the source is format 3. Behavior is unchanged: a format 2 source givesNoneeither way.Tests
test_array_dimension_namescovers v2 arrays, v3 arrays without names, with names, and with some names left asNone. It checks the sync and async properties and that the names are the same after reopening the array.I ran the full suite locally: 10813 passed.
🤖 Generated with Claude Code