SChunk.remove_postfilter#

SChunk.remove_postfilter(func_name: str, _new_ctx: bool = True) None#

Remove the postfilter from the SChunk instance.

Parameters:

func_name (str) – The name of the postfilter function to remove.

Returns:

out

Return type:

None

Examples

>>> import blosc2
>>> import numpy as np
>>> dtype = np.dtype(np.int32)
>>> cparams = blosc2.CParams(typesize=dtype.itemsize)
>>> dparams = blosc2.DParams(nthreads=1)
>>> data = np.arange(500, dtype=np.int32)
>>> schunk = blosc2.SChunk(data=data, cparams=cparams, dparams=dparams)
>>> # Define the postfilter function
>>> @schunk.postfilter(dtype)
>>> def postfilter(input, output, offset):
>>>     output[:] = input + offset + np.arange(input.size)
>>> out = np.empty(data.size, dtype=dtype)
>>> schunk.get_slice(out=out)
>>> f"Data slice with postfilter applied (first 8 elements): {out[:8]}"
Data slice with postfilter applied (first 8 elements): [ 0  2  4  6  8 10 12 14]
>>> schunk.remove_postfilter('postfilter')
>>> retrieved_data = np.empty(data.size, dtype=dtype)
>>> schunk.get_slice(out=retrieved_data)
>>> f"Original data (first 8 elements): {data[:8]}"
Original data (first 8 elements): [0 1 2 3 4 5 6 7]