blosc2.unpack_array2#

blosc2.unpack_array2(cframe: bytes) ndarray#

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

Parameters:

cframe (bytes) – The packed array to be restored.

Returns:

out – The unpacked NumPy array.

Return type:

np.ndarray

Raises:
  • TypeError – If cframe is not of type bytes, or not a cframe.

  • RunTimeError – If an error occurs during decompression.

Examples

>>> import numpy as np
>>> a = np.arange(1e6)
>>> cframe = blosc2.pack_array2(a)
>>> len(cframe) < a.size*a.itemsize
True
>>> a2 = blosc2.unpack_array2(cframe)
>>> np.array_equal(a, a2)
True