Top level API#

This API is meant to be compatible with the existing python-blosc API. There could be some parameters that are called differently, but other than that, they are largely compatible.

Compress and decompress#

compress

Compress src, with a given type size.

compress2

Compress src with the given compression params (if given)

decompress

Decompresses a bytes-like compressed object.

decompress2

Compress src with the given compression params (if given)

pack

Pack (compress) a Python object.

pack_array

Pack (compress) a NumPy array.

pack_array2

Pack (compress) a NumPy array.

pack_tensor

Pack (compress) a TensorFlow / PyTorch tensor or a NumPy array.

unpack

Unpack (decompress) an object.

unpack_array

Restore a packed NumPy array.

unpack_array2

Unpack (decompress) a packed NumPy array via a cframe.

unpack_tensor

Unpack (decompress) a packed TensorFlow / PyTorch via a cframe.

save_array

Save a serialized NumPy array in urlpath.

load_array

Load a serialized NumPy array in urlpath.

save_tensor

Save a serialized PyTorch / TensorFlow tensor or NumPy array in urlpath.

load_tensor

Load a serialized PyTorch / TensorFlow tensor or NumPy array in urlpath.

Set / Get compression params#

clib_info

Return info for compression libraries in C library.

compressor_list

Returns a list of compressors (codecs) available in the C library.

detect_number_of_cores

Detect the number of cores in this system.

free_resources

Free possible memory temporaries and thread resources.

get_clib

Return the name of the compression library for Blosc bytesobj buffer.

nthreads

Number of threads to be used in compression/decompression.

print_versions

Print all the versions of software that python-blosc2 relies on.

register_codec

Register a user defined codec.

register_filter

Register an user defined filter.

set_blocksize

Force the use of a specific blocksize.

set_nthreads

Set the number of threads to be used during Blosc operation.

set_releasegil

Sets a boolean on whether to release the Python global inter-lock (GIL) during c-blosc compress and decompress operations or not.

set_compressor

Set the compressor to be used.

get_compressor

Get the current compressor that is used for compression.

get_blocksize

Get the internal blocksize to be used during compression.

get_cbuffer_sizes

Get the sizes of a compressed src buffer.

cparams_dflts

Compression params defaults.

dparams_dflts

Decompression params defaults.

storage_dflts

Storage params defaults.

Enumerated classes#

Codec

Available codecs.

Filter

Available filters.

SpecialValue

Possible special values in a chunk.

SplitMode

Available split modes.

Tuner

Available tuners.

Utils#

compute_chunks_blocks(shape[, chunks, ...])

Compute educated guesses for chunks and blocks of a NDArray.

get_slice_nchunks(schunk, key)

Get the unidimensional chunk indexes needed to get a slice of a SChunk or a NDArray.

open(urlpath[, mode, offset])

Open a persistent SChunk (or NDArray).

remove_urlpath(path)

Permanently remove the file or the directory given by path.

Utility variables#

blosclib_version

The blosc2 version + date.

DEFINED_CODECS_STOP

Maximum possible Blosc2-defined codec id.

EXTENDED_HEADER_LENGTH

Blosc2 extended header length in bytes.

MAX_BUFFERSIZE

Maximum buffer size in bytes for a Blosc2 chunk.

MAX_OVERHEAD

Maximum overhead during compression (in bytes).

MAX_TYPESIZE

Blosc2 maximum type size (in bytes).

MIN_HEADER_LENGTH

Blosc2 minimum header length (in bytes).

prefilter_funcs

Registry for prefilter functions.

postfilter_funcs

Registry for postfilter functions.

ucodecs_registry

Registry for user-defined codecs.

ufilters_registry

Registry for user-defined filters.

VERSION_DATE

The C-Blosc2 version's date.

VERSION_STRING

The C-Blosc2 version's string.

__version__

Python-Blosc2 version.