Low 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. In addition, there are some new functions that are not present in the original python-blosc API that are mainly meant to overcome the 2 GB limit that the original API had.

Compress and decompress#

compress

Compress the given source data with specified parameters.

compress2

Compress the given src buffer with the specified compression parameters.

decompress

Decompresses a bytes-like compressed object.

decompress2

Decompress the given src buffer with the specified decompression params.

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 or 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 from a cframe.

unpack_tensor

Unpack (decompress) a packed TensorFlow or PyTorch tensor or a NumPy array from a cframe.

Set / get compression params#

clib_info

Return information about the compression libraries in the 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 any temporary memory 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 a user-defined filter.

set_blocksize

Force the use of a specific blocksize.

set_nthreads

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

set_releasegil

Set 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 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

dparams_dflts

storage_dflts

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 obtain a slice of a SChunk or a NDArray.

remove_urlpath(path)

Permanently remove the file or the directory specified by path.

Utility variables#

blosclib_version

The blosc2 version + date.

DEFINED_CODECS_STOP

Maximum possible Blosc2-defined codec id.

GLOBAL_REGISTERED_CODECS_STOP

Maximum possible Blosc2 global registered codec id.

USER_REGISTERED_CODECS_STOP

Maximum possible Blosc2 user registered 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.