fix(zarr-metadata): model stored metadata more closely#3962
Open
d-v-b wants to merge 5 commits intozarr-developers:mainfrom
Open
fix(zarr-metadata): model stored metadata more closely#3962d-v-b wants to merge 5 commits intozarr-developers:mainfrom
d-v-b wants to merge 5 commits intozarr-developers:mainfrom
Conversation
Zarr V2 uses a separate JSON document named `.zattrs` for the attributes of an array or group. This package was inconsistent about how it modelled this fact. The array metadata document type modelled array fields (`shape`, `dtype`, etc), which would be stored in `.zarray`, AND the `attributes` field, which would be stored in `.zattrs`. Thus the array metadata model matched the representation of an array that a program might use, rather than the stored layout. But the group metadata type didn't follow this pattern -- it has no `attributes` field. This PR addresses that inconsistency by adding an `attributes` field to `GroupMetadataV2`. That field is not required. To model the stored representation of V2 data, this PR adds 3 new types: `ZArrayMetadata`, `ZGroupMetadata`, and `ZAttrsMetadata`, that closely model the contents of the `.zarray`, `.zgroup`, and `.zattrs` documents, respectively. This change makes the V2 consolidated metadata type more accurate, as consolidated metadata for Zarr V2 is comprised of inlined metadata documents.
This reverts commit 629e565.
…Metadata at top level The on-disk file types added in 8b7af90 were importable from the v2 submodule but not from the package root. Add them to the top-level __init__.py so consumers can import them as `zarr_metadata.ZArrayMetadata` etc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3962 +/- ##
=======================================
Coverage 93.26% 93.26%
=======================================
Files 87 87
Lines 11721 11721
=======================================
Hits 10932 10932
Misses 789 789 🚀 New features to boost your workflow:
|
Contributor
Author
|
cc @chuckwondo |
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.
Zarr V2 uses a separate JSON document named
.zattrsfor the attributes of an array or group.This package was inconsistent about how it modelled this fact. The array metadata document type modelled
array fields (
shape,dtype, etc), which would be stored in.zarray, AND theattributesfield,which would be stored in
.zattrs. Thus the array metadata model matched the representationof an array that a program might use, rather than the stored layout. But the group metadata type didn't
follow this pattern -- it has no
attributesfield.This PR addresses that inconsistency by adding an
attributesfield toGroupMetadataV2. That field isnot required. To model the stored representation of V2 data, this PR adds 3 new types:
ZArrayMetadata,ZGroupMetadata, andZAttrsMetadata, that closely model the contents of the.zarray,.zgroup, and.zattrsdocuments, respectively.This change makes the V2 consolidated metadata type more accurate, as consolidated metadata for Zarr V2
is comprised of inlined metadata documents.