blosc2.load_array#

blosc2.load_array(urlpath, **kwargs)#

Load a serialized NumPy array in urlpath.

Parameters:
  • urlpath (str) – The file where the array is to be loaded.

  • kwargs (dict, optional) –

    Keyword arguments supported: dparams: dict

    A dictionary with the decompression parameters, which are the same that can be used in the decompress2() function.

Returns:

out – The unpacked NumPy array.

Return type:

ndarray

Raises:
  • TypeError – If urlpath is not in cframe format

  • RunTimeError – If some other problem is detected.

Examples

>>> import numpy as np
>>> a = np.arange(1e6)
>>> serial_size = blosc2.save_array(a, "test.bl2", mode="w")
>>> serial_size < a.size * a.itemsize
True
>>> a2 = blosc2.load_array("test.bl2")
>>> np.array_equal(a, a2)
True