blosc2.load_array#

blosc2.load_array(urlpath: str, dparams: dict | None = None) ndarray#

Load a serialized NumPy array from a file.

Parameters:
  • urlpath (str) – The path to the file containing the serialized array.

  • dparams (dict, optional) – A dictionary with the decompression parameters, which can be used in the decompress2() function.

Returns:

out – The deserialized NumPy array.

Return type:

np.ndarray

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

  • RunTimeError – If any other error 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