Blosc¶
-
class
numcodecs.blosc.
Blosc
¶ Codec providing compression using the Blosc meta-compressor.
Parameters: cname : string, optional
A string naming one of the compression algorithms available within blosc, e.g., ‘zstd’, ‘blosclz’, ‘lz4’, ‘lz4hc’, ‘zlib’ or ‘snappy’.
clevel : integer, optional
An integer between 0 and 9 specifying the compression level.
shuffle : integer, optional
Either NOSHUFFLE (0), SHUFFLE (1) or BITSHUFFLE (2).
blocksize : int
The requested size of the compressed blocks. If 0 (default), an automatic blocksize will be used.
See also
-
codec_id
= 'blosc'¶
-
NOSHUFFLE
= 0¶
-
SHUFFLE
= 1¶
-
BITSHUFFLE
= 2¶
-
-
numcodecs.blosc.
init
()¶ Initialize the Blosc library environment.
-
numcodecs.blosc.
destroy
()¶ Destroy the Blosc library environment.
-
numcodecs.blosc.
compname_to_compcode
(cname)¶ Return the compressor code associated with the compressor name. If the compressor name is not recognized, or there is not support for it in this build, -1 is returned instead.
-
numcodecs.blosc.
list_compressors
()¶ Get a list of compressors supported in the current build.
-
numcodecs.blosc.
get_nthreads
()¶ Get the number of threads that Blosc uses internally for compression and decompression.
-
numcodecs.blosc.
set_nthreads
(int nthreads)¶ Set the number of threads that Blosc uses internally for compression and decompression.
-
numcodecs.blosc.
cbuffer_sizes
(source)¶ Return information about a compressed buffer, namely the number of uncompressed bytes ( nbytes) and compressed (cbytes). It also returns the blocksize (which is used internally for doing the compression by blocks).
Returns: nbytes : int
cbytes : int
blocksize : int
-
numcodecs.blosc.
compress
(source, char *cname, int clevel, int shuffle, int blocksize=0)¶ Compress data.
Parameters: source : bytes-like
Data to be compressed. Can be any object supporting the buffer protocol.
cname : bytes
Name of compression library to use.
clevel : int
Compression level.
shuffle : int
Shuffle filter.
blocksize : int
The requested size of the compressed blocks. If 0, an automatic blocksize will be used.
Returns: dest : bytes
Compressed data.
-
numcodecs.blosc.
decompress
(source, dest=None)¶ Decompress data.
Parameters: source : bytes-like
Compressed data, including blosc header. Can be any object supporting the buffer protocol.
dest : array-like, optional
Object to decompress into.
Returns: dest : bytes
Object containing decompressed data.