9393 OrthogonalSelection ,
9494 Selection ,
9595 VIndex ,
96+ _iter_grid ,
97+ _iter_regions ,
9698 check_fields ,
9799 check_no_multi_fields ,
98100 is_pure_fancy_indexing ,
99101 is_pure_orthogonal_indexing ,
100102 is_scalar ,
101- iter_grid ,
102- iter_regions ,
103103 pop_fields ,
104104)
105105from zarr .core .metadata import (
@@ -1187,18 +1187,17 @@ def basename(self) -> str:
11871187 @property
11881188 def cdata_shape (self ) -> ChunkCoords :
11891189 """
1190- The shape of the chunk grid for this array. This property exists for backwards compatibility.
1191- See :func:`chunk_grid_shape` for the preferred method.
1190+ The shape of the chunk grid for this array.
11921191
11931192 Returns
11941193 -------
11951194 tuple[int, ...]
11961195 The shape of the chunk grid for this array.
11971196 """
1198- return self .chunk_grid_shape
1197+ return self ._chunk_grid_shape
11991198
12001199 @property
1201- def chunk_grid_shape (self ) -> ChunkCoords :
1200+ def _chunk_grid_shape (self ) -> ChunkCoords :
12021201 """
12031202 The shape of the chunk grid for this array.
12041203
@@ -1210,7 +1209,7 @@ def chunk_grid_shape(self) -> ChunkCoords:
12101209 return tuple (starmap (ceildiv , zip (self .shape , self .chunks , strict = True )))
12111210
12121211 @property
1213- def shard_grid_shape (self ) -> ChunkCoords :
1212+ def _shard_grid_shape (self ) -> ChunkCoords :
12141213 """
12151214 The shape of the shard grid for this array.
12161215
@@ -1239,10 +1238,10 @@ def nchunks(self) -> int:
12391238 int
12401239 The total number of chunks in the array.
12411240 """
1242- return product (self .chunk_grid_shape )
1241+ return product (self ._chunk_grid_shape )
12431242
12441243 @property
1245- def nshards (self ) -> int :
1244+ def _nshards (self ) -> int :
12461245 """
12471246 The number of shards in this array.
12481247
@@ -1251,16 +1250,16 @@ def nshards(self) -> int:
12511250 int
12521251 The total number of shards in the array.
12531252 """
1254- return product (self .shard_grid_shape )
1253+ return product (self ._shard_grid_shape )
12551254
12561255 async def nchunks_initialized (self ) -> int :
12571256 """
12581257 Calculate the number of chunks that have been initialized in storage.
12591258
1260- This value is calculated as the product of the number of initialized shards and the number of
1261- chunks per shard. For arrays that do not use sharding, the number of chunks per shard is effectively 1,
1262- and in that case the number of chunks initialized is the same as the number of stored objects associated with an
1263- array. For a direct count of the number of initialized stored objects, see ``nshards_initialized`` .
1259+ This value is calculated as the product of the number of initialized shards and the number
1260+ of chunks per shard. For arrays that do not use sharding, the number of chunks per shard is
1261+ effectively 1, and in that case the number of chunks initialized is the same as the number
1262+ of stored objects associated with an array .
12641263
12651264 Returns
12661265 -------
@@ -1289,9 +1288,9 @@ async def nchunks_initialized(self) -> int:
12891288 chunks_per_shard = product (
12901289 tuple (a // b for a , b in zip (self .shards , self .chunks , strict = True ))
12911290 )
1292- return (await self .nshards_initialized ()) * chunks_per_shard
1291+ return (await self ._nshards_initialized ()) * chunks_per_shard
12931292
1294- async def nshards_initialized (self ) -> int :
1293+ async def _nshards_initialized (self ) -> int :
12951294 """
12961295 Calculate the number of shards that have been initialized in storage.
12971296
@@ -1316,7 +1315,7 @@ async def nshards_initialized(self) -> int:
13161315 >>> await arr.nshards_initialized()
13171316 3
13181317 """
1319- return len (await shards_initialized (self ))
1318+ return len (await _shards_initialized (self ))
13201319
13211320 async def nbytes_stored (self ) -> int :
13221321 return await self .store_path .store .getsize_prefix (self .store_path .path )
@@ -1345,7 +1344,7 @@ def _iter_chunk_coords(
13451344 chunk_coords: ChunkCoords
13461345 The coordinates of each chunk in the selection.
13471346 """
1348- return iter_chunk_coords (
1347+ return _iter_chunk_coords (
13491348 array = self ,
13501349 origin = origin ,
13511350 selection_shape = selection_shape ,
@@ -1377,7 +1376,7 @@ def _iter_shard_coords(
13771376 chunk_coords: tuple[int, ...]
13781377 The coordinates of each shard in the selection.
13791378 """
1380- return iter_shard_coords (
1379+ return _iter_shard_coords (
13811380 array = self ,
13821381 origin = origin ,
13831382 selection_shape = selection_shape ,
@@ -1402,7 +1401,7 @@ def _iter_shard_keys(
14021401 The storage key of each chunk in the selection.
14031402 """
14041403 # Iterate over the coordinates of chunks in chunk grid space.
1405- return iter_shard_keys (
1404+ return _iter_shard_keys (
14061405 array = self ,
14071406 origin = origin ,
14081407 selection_shape = selection_shape ,
@@ -1426,7 +1425,7 @@ def _iter_chunk_regions(
14261425 region: tuple[slice, ...]
14271426 A tuple of slice objects representing the region spanned by each chunk in the selection.
14281427 """
1429- return iter_chunk_regions (
1428+ return _iter_chunk_regions (
14301429 array = self ,
14311430 origin = origin ,
14321431 selection_shape = selection_shape ,
@@ -1450,7 +1449,7 @@ def _iter_shard_regions(
14501449 region: tuple[slice, ...]
14511450 A tuple of slice objects representing the region spanned by each shard in the selection.
14521451 """
1453- return iter_shard_regions (array = self , origin = origin , selection_shape = selection_shape )
1452+ return _iter_shard_regions (array = self , origin = origin , selection_shape = selection_shape )
14541453
14551454 @property
14561455 def nbytes (self ) -> int :
@@ -1957,7 +1956,7 @@ async def info_complete(self) -> Any:
19571956 A property giving just the statically known information about an array.
19581957 """
19591958 return self ._info (
1960- await self .nshards_initialized (),
1959+ await self ._nshards_initialized (),
19611960 await self .store_path .store .getsize_prefix (self .store_path .path ),
19621961 )
19631962
@@ -2402,24 +2401,23 @@ def compressors(self) -> tuple[Numcodec, ...] | tuple[BytesBytesCodec, ...]:
24022401 @property
24032402 def cdata_shape (self ) -> ChunkCoords :
24042403 """
2405- The shape of the chunk grid for this array. This property exists for backwards compatibility.
2406- See :func:`chunk_grid_shape` for the preferred method.
2404+ The shape of the chunk grid for this array.
24072405 """
2408- return self ._async_array .chunk_grid_shape
2406+ return self ._async_array ._chunk_grid_shape
24092407
24102408 @property
2411- def chunk_grid_shape (self ) -> ChunkCoords :
2409+ def _chunk_grid_shape (self ) -> ChunkCoords :
24122410 """
24132411 The shape of the chunk grid for this array.
24142412 """
2415- return self ._async_array .chunk_grid_shape
2413+ return self ._async_array ._chunk_grid_shape
24162414
24172415 @property
2418- def shard_grid_shape (self ) -> ChunkCoords :
2416+ def _shard_grid_shape (self ) -> ChunkCoords :
24192417 """
24202418 The shape of the shard grid for this array.
24212419 """
2422- return self ._async_array .shard_grid_shape
2420+ return self ._async_array ._shard_grid_shape
24232421
24242422 @property
24252423 def nchunks (self ) -> int :
@@ -2433,11 +2431,11 @@ def nchunks(self) -> int:
24332431 return self ._async_array .nchunks
24342432
24352433 @property
2436- def nshards (self ) -> int :
2434+ def _nshards (self ) -> int :
24372435 """
24382436 The number of shards in the stored representation of this array.
24392437 """
2440- return self ._async_array .nshards
2438+ return self ._async_array ._nshards
24412439
24422440 @property
24432441 def nbytes (self ) -> int :
@@ -2502,7 +2500,7 @@ def nshards_initialized(self) -> int:
25022500 >>> arr.nshard_initialized
25032501 3
25042502 """
2505- return sync (self ._async_array .nshards_initialized ())
2503+ return sync (self ._async_array ._nshards_initialized ())
25062504
25072505 def nbytes_stored (self ) -> int :
25082506 """
@@ -4062,7 +4060,7 @@ def info_complete(self) -> Any:
40624060 return sync (self ._async_array .info_complete ())
40634061
40644062
4065- async def shards_initialized (
4063+ async def _shards_initialized (
40664064 array : AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ],
40674065) -> tuple [str , ...]:
40684066 """
@@ -5221,7 +5219,7 @@ def _parse_data_params(
52215219 return data , shape_out , dtype_out
52225220
52235221
5224- def iter_chunk_coords (
5222+ def _iter_chunk_coords (
52255223 array : Array | AsyncArray [Any ],
52265224 * ,
52275225 origin : Sequence [int ] | None = None ,
@@ -5249,10 +5247,10 @@ def iter_chunk_coords(
52495247 chunk_coords: ChunkCoords
52505248 The coordinates of each chunk in the selection.
52515249 """
5252- return iter_grid (array .chunk_grid_shape , origin = origin , selection_shape = selection_shape )
5250+ return _iter_grid (array ._chunk_grid_shape , origin = origin , selection_shape = selection_shape )
52535251
52545252
5255- def iter_shard_coords (
5253+ def _iter_shard_coords (
52565254 array : Array | AsyncArray [Any ],
52575255 * ,
52585256 origin : Sequence [int ] | None = None ,
@@ -5280,10 +5278,10 @@ def iter_shard_coords(
52805278 chunk_coords: ChunkCoords
52815279 The coordinates of each shard in the selection.
52825280 """
5283- return iter_grid (array .shard_grid_shape , origin = origin , selection_shape = selection_shape )
5281+ return _iter_grid (array ._shard_grid_shape , origin = origin , selection_shape = selection_shape )
52845282
52855283
5286- def iter_shard_keys (
5284+ def _iter_shard_keys (
52875285 array : Array | AsyncArray [Any ],
52885286 * ,
52895287 origin : Sequence [int ] | None = None ,
@@ -5308,11 +5306,11 @@ def iter_shard_keys(
53085306 The storage key of each chunk in the selection.
53095307 """
53105308 # Iterate over the coordinates of chunks in chunk grid space.
5311- _iter = iter_grid (array .shard_grid_shape , origin = origin , selection_shape = selection_shape )
5309+ _iter = _iter_grid (array ._shard_grid_shape , origin = origin , selection_shape = selection_shape )
53125310 return (array .metadata .encode_chunk_key (k ) for k in _iter )
53135311
53145312
5315- def iter_shard_regions (
5313+ def _iter_shard_regions (
53165314 array : Array | AsyncArray [Any ],
53175315 * ,
53185316 origin : Sequence [int ] | None = None ,
@@ -5342,12 +5340,12 @@ def iter_shard_regions(
53425340 else :
53435341 shard_shape = array .shards
53445342
5345- return iter_regions (
5343+ return _iter_regions (
53465344 array .shape , shard_shape , origin = origin , selection_shape = selection_shape , trim_excess = True
53475345 )
53485346
53495347
5350- def iter_chunk_regions (
5348+ def _iter_chunk_regions (
53515349 array : Array | AsyncArray [Any ],
53525350 * ,
53535351 origin : Sequence [int ] | None = None ,
@@ -5373,6 +5371,6 @@ def iter_chunk_regions(
53735371 A tuple of slice objects representing the region spanned by each shard in the selection.
53745372 """
53755373
5376- return iter_regions (
5374+ return _iter_regions (
53775375 array .shape , array .chunks , origin = origin , selection_shape = selection_shape , trim_excess = True
53785376 )
0 commit comments