File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -366,6 +366,15 @@ def ndim(self) -> int:
366
366
def shape (self ) -> ChunkCoords :
367
367
return self .metadata .shape
368
368
369
+ @property
370
+ def chunks (self ) -> ChunkCoords :
371
+ if isinstance (self .metadata .chunk_grid , RegularChunkGrid ):
372
+ return self .metadata .chunk_grid .chunk_shape
373
+ else :
374
+ raise ValueError (
375
+ f"chunk attribute is only available for RegularChunkGrid, this array has a { self .metadata .chunk_grid } "
376
+ )
377
+
369
378
@property
370
379
def size (self ) -> int :
371
380
return np .prod (self .metadata .shape ).item ()
@@ -639,6 +648,10 @@ def ndim(self) -> int:
639
648
def shape (self ) -> ChunkCoords :
640
649
return self ._async_array .shape
641
650
651
+ @property
652
+ def chunks (self ) -> ChunkCoords :
653
+ return self ._async_array .chunks
654
+
642
655
@property
643
656
def size (self ) -> int :
644
657
return self ._async_array .size
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ def test_group(store: MemoryStore | LocalStore) -> None:
79
79
assert arr .dtype == data .dtype
80
80
81
81
# TODO: update this once the array api settles down
82
- # assert arr.chunk_shape == (2, 2)
82
+ assert arr .chunks == (2 , 2 )
83
83
84
84
bar2 = foo ["bar" ]
85
85
assert dict (bar2 .attrs ) == {"baz" : "qux" }
You can’t perform that action at this time.
0 commit comments