SChunk.iterchunks#
- SChunk.iterchunks(dtype: dtype) Iterator[ndarray] #
Iterate over the
self
chunks of the SChunk.- Parameters:
dtype¶ (np.dtype) – The data type to use for the decompressed chunks.
- Yields:
chunk (NumPy ndarray) – The decompressed chunk.
Examples
>>> import blosc2 >>> import numpy as np >>> # Create sample data and an SChunk >>> data = np.arange(400 * 1000, dtype=np.int32) >>> cparams = blosc2.CParams(typesize=4) >>> schunk = blosc2.SChunk(data=data, cparams=cparams) >>> # Iterate over chunks using the iterchunks method >>> for chunk in schunk.iterchunks(dtype=np.int32): >>> f"Chunk shape: {chunk.shape} " >>> f"First 5 elements of chunk: {chunk[:5]}" Chunk shape: (400000,) First 5 elements of chunk: [0 1 2 3 4]