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:
366366 def shape (self ) -> ChunkCoords :
367367 return self .metadata .shape
368368
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+
369378 @property
370379 def size (self ) -> int :
371380 return np .prod (self .metadata .shape ).item ()
@@ -639,6 +648,10 @@ def ndim(self) -> int:
639648 def shape (self ) -> ChunkCoords :
640649 return self ._async_array .shape
641650
651+ @property
652+ def chunks (self ) -> ChunkCoords :
653+ return self ._async_array .chunks
654+
642655 @property
643656 def size (self ) -> int :
644657 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:
7979 assert arr .dtype == data .dtype
8080
8181 # TODO: update this once the array api settles down
82- # assert arr.chunk_shape == (2, 2)
82+ assert arr .chunks == (2 , 2 )
8383
8484 bar2 = foo ["bar" ]
8585 assert dict (bar2 .attrs ) == {"baz" : "qux" }
You can’t perform that action at this time.
0 commit comments