blosc2.schunk.SChunk.delete_chunk#

SChunk.delete_chunk(nchunk: int) int#

Delete the specified chunk from the SChunk.

Parameters:

nchunk (int) – The index of the chunk that will be removed.

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 3 chunks
>>> nchunks = 3
>>> data = np.arange(200 * 1000 * nchunks, dtype=np.int32)
>>> cparams = blosc2.CParams(typesize=4)
>>> schunk = blosc2.SChunk(chunksize=200 * 1000 * 4, data=data, cparams=cparams)
>>> # Check the number of chunks before deletion
>>> schunk.nchunks
3
>>>  # Delete the second chunk (index 1)
>>> schunk.delete_chunk(1)
>>>  # Check the number of chunks after deletion
>>> schunk.nchunks
2