Skip to content

Commit b4137ee

Browse files
committed
Allow Zarr objects to be ingested by blosc2.asarray. Fixes #491.
1 parent 29f9e04 commit b4137ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/blosc2/ndarray.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5610,7 +5610,9 @@ def asarray(array: Sequence | blosc2.Array, copy: bool | None = None, **kwargs:
56105610
# Use the chunks and blocks from the array if they are not passed
56115611
if chunks is None and hasattr(array, "chunks"):
56125612
chunks = array.chunks
5613-
if blocks is None and hasattr(array, "blocks"):
5613+
# Zarr adds a .blocks property that maps to a zarr.indexing.BlockIndex object
5614+
# Let's avoid this
5615+
if blocks is None and hasattr(array, "blocks") and isinstance(array.blocks, (tuple, list)):
56145616
blocks = array.blocks
56155617
chunks, blocks = compute_chunks_blocks(array.shape, chunks, blocks, array.dtype, **kwargs)
56165618

0 commit comments

Comments
 (0)