blosc2.unpack_array#
- blosc2.unpack_array(packed_array, **kwargs)#
Restore a packed NumPy array.
- Parameters:
packed_array¶ (str / bytes) – The packed array to be restored.
**kwargs¶ (fix_imports / encoding / errors) – Optional parameters that can be passed to the pickle.loads API.
- Returns:
out – The decompressed data in form of a NumPy array.
- Return type:
ndarray
- Raises:
TypeError – If
packed_array
is not of type bytes or string.
Examples
>>> import numpy as np >>> a = np.arange(1e6) >>> parray = blosc2.pack_array(a) >>> len(parray) < a.size*a.itemsize True >>> a2 = blosc2.unpack_array(parray) >>> np.array_equal(a, a2) True >>> a = np.array(['å', 'ç', 'ø']) >>> parray = blosc2.pack_array(a) >>> a2 = blosc2.unpack_array(parray) >>> np.array_equal(a, a2) True