Repository navigation
Conversation
…rr array zarr.array documents its keyword arguments as passed through to create, but a zarr Array as data was sent to from_array instead, which requires store and takes a different set of arguments. zarr.array(zarr_array) raised "missing store", and create arguments such as compressor, mode or read_only raised TypeError, while the same call with NumPy data worked. A zarr Array now takes the create path like any other data. Its zarr dtype (not the native dtype, which cannot identify string types), shape and chunks are the defaults, and a rectilinear grid is kept through read_chunk_sizes. The data is still streamed one shard region at a time by _copy_from_array, factored out of from_array. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4419 +/- ##
==========================================
+ Coverage 94.37% 94.39% +0.01%
==========================================
Files 93 93
Lines 13171 13179 +8
==========================================
+ Hits 12430 12440 +10
+ Misses 741 739 -2
🚀 New features to boost your workflow:
|
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.
🤖 AI text below 🤖
zarr.arraydocuments its keyword arguments as "passed through tocreate". Since #2622, though, a zarrArraypassed asdatawas sent tofrom_arrayinstead.from_arrayrequiresstoreand takes a different set of arguments, so the same call behaved differently depending on the type ofdata:The agent found this in an audit of
**kwargsforwarding (see #4408).Change
A zarr
Arraynow takes the samecreatepath as any other data:from_arraymakes the same distinction.chunksis undefined for an unsharded rectilinear grid, so the default falls back toread_chunk_sizesand the grid is kept. Creating that array still needsarray.rectilinear_chunksenabled._copy_from_array, factored out offrom_arrayand shared by both functions.The docstring now points to
from_arrayfor copying a zarr array's codecs and other settings.Behaviour change
Before this PR, calls with a zarr source that happened to use only arguments
from_arrayaccepts (for examplezarr.array(src, store=s, overwrite=True)) worked, and inherited the source's codecs, fill value, attributes and zarr format. They now getcreate's defaults for those, exactly as NumPy data does. Code that relies on inheriting those settings should callzarr.from_array, which is the dedicated API for it.Tests
test_array_from_zarr_array: sources (v2, v3, sharded, rectilinear, variable-length string) × argument sets (none,store,store+path+mode+attributes,chunks,zarr_format,fill_value). Checks shape, data, zarr dtype, chunks, format, attributes, fill value and path. Onmain, 25 of the 29 cases fail; only the fourstore-only cases pass.test_array_from_zarr_array_rectilinear_v2(format 2 cannot hold a rectilinear grid) andtest_array_from_zarr_array_read_only. Both fail onmain, where a zarr source raisesTypeErrorfromfrom_arrayinstead.The full test suite passes locally, and so does mypy.
🤖 Generated with Claude Code