blosc2.NDArray.iterchunks_info#

NDArray.iterchunks_info() Iterator[NamedTuple('info', nchunk=int, coords=tuple, cratio=float, special=blosc2.SpecialValue, repeated_value=bytes | None, lazychunk=bytes)]#

Iterate over self chunks of the array, providing information on index and special values.

Yields:

info (namedtuple) –

A namedtuple with the following fields:

nchunk: int

The index of the chunk.

coords: tuple

The coordinates of the chunk, in chunk units.

cratio: float

The compression ratio of the chunk.

special: SpecialValue

The special value enum of the chunk; if 0, the chunk is not special.

repeated_value: self.dtype or None

The repeated value for the chunk; if not SpecialValue.VALUE, it is None.

lazychunk: bytes

A buffer containing the complete lazy chunk.

Examples

>>> import blosc2
>>> a = blosc2.full(shape=(1000, ) * 3, fill_value=9, chunks=(500, ) * 3, dtype="f4")
>>> for info in a.iterchunks_info():
...     print(info.coords)
(0, 0, 0)
(0, 0, 1)
(0, 1, 0)
(0, 1, 1)
(1, 0, 0)
(1, 0, 1)
(1, 1, 0)
(1, 1, 1)