SChunk.remove_prefilter#

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

Remove the prefilter from the SChunk instance.

Parameters:

func_name (str) – Name of the prefilter function.

Returns:

out

Return type:

None

Examples

>>> import blosc2
>>> import numpy as np
>>> dtype = np.dtype(np.int32)
>>> cparams = blosc2.CParams(typesize=dtype.itemsize, nthreads=1)
>>> data = np.arange(1000, dtype=np.int32)
>>> output_dtype = np.float32
>>> schunk = blosc2.SChunk(cparams=cparams)
>>> # Define the prefilter function
>>> @schunk.prefilter(dtype, output_dtype)
>>> def prefilter(input, output, offset):
>>>     output[:] = input - np.pi
>>> schunk[:1000] = data
>>> # Retrieve and convert compressed data with the prefilter to a NumPy array.
>>> compressed_array_with_filter = np.frombuffer(schunk.get_slice(), dtype=output_dtype)
>>> f"Compressed data with prefilter applied (first 8 elements): {compressed_array_with_filter[:8]}"
Compressed data with prefilter applied (first 8 elements): [-3.1415927  -2.1415927  -1.1415926  -0.14159265  0.8584073   1.8584074
 2.8584073   3.8584073 ]
>>> schunk.remove_prefilter('prefilter')
>>> schunk[:1000] = data
>>> compressed_array_without_filter = np.frombuffer(schunk.get_slice(), dtype=dtype)
>>> f"Compressed data without prefilter (first 8 elements): {compressed_array_without_filter[:8]}"
Compressed data without prefilter (first 8 elements): [0. 1. 2. 3. 4. 5. 6. 7.]