SChunk.insert_data#
- SChunk.insert_data(nchunk: int, data: object, copy: bool) int #
Insert the data in the specified position in the SChunk.
- Parameters:
- Returns:
out – The number of chunks in the SChunk.
- Return type:
int
- Raises:
RunTimeError – If a problem is detected.
Examples
>>> import blosc2 >>> import numpy as np >>> # Create an SChunk with 2 chunks >>> data = np.arange(400 * 1000, dtype=np.int32) >>> cparams = blosc2.CParams(typesize=4) >>> schunk = blosc2.SChunk(chunksize=200*1000*4, data=data, cparams=cparams) >>> # Create a new array to insert into the second chunk of the SChunk >>> new_data = np.arange(200 * 1000, dtype=np.int32) >>> # Insert the new data at position 1, compressing it >>> schunk.insert_data(1, new_data, copy=True) >>> # Verify the total number of chunks after insertion >>> schunk.nchunks 3