fixing scalar array handling#835
Closed
neilSchroeder wants to merge 11 commits intozarr-developers:mainfrom
Closed
fixing scalar array handling#835neilSchroeder wants to merge 11 commits intozarr-developers:mainfrom
neilSchroeder wants to merge 11 commits intozarr-developers:mainfrom
Conversation
Contributor
Author
|
@TomNicholas apologies, but it looks like I didn't do an actual stress test to see if real files would actually open. |
…Schroeder/VirtualiZarr into fix/issue-834-zarr-scalar-array-bug
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #835 +/- ##
==========================================
- Coverage 88.43% 88.40% -0.03%
==========================================
Files 35 35
Lines 1988 2009 +21
==========================================
+ Hits 1758 1776 +18
- Misses 230 233 +3
🚀 New features to boost your workflow:
|
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.
ValueError: Invalid format for chunk key#834docs/releases.mdSummary
This PR fixes an incorrect test assertion for Zarr V3 scalar array chunk keys, as well as fixing the
_handle_scalar_arrayfunction to return a correctly formatted dictionary.Problem
The test
test_scalar_chunk_mappingincorrectly expected Zarr V3 scalar arrays to use"c"as the chunk key in the manifest. This was based on a misunderstanding of how Zarr V3 stores scalar arrays.What Actually Happens
"0"→ manifest chunk key:"0""c"→ manifest chunk key:"0"The
_handle_scalar_arrayfunction in zarr.py correctly handles this difference by:scalar_key="0"for V2,"c"for V3)"0"as the chunk coordinate key in the manifestThis normalization is necessary because:
([1-9]+\d*|0)+(\.[1-9]+\d*|0)*$)"c"would fail validation since it's not numeric(0,), so they should have the same manifest keyContext
I tried to actually open a V2 scalar array and it threw an error. I've confirmed that with this fix it correctly reads both v2 and v3 arrays.