blosc2.save_array#

blosc2.save_array(arr, urlpath, chunksize=None, **kwargs)#

Save a serialized NumPy array in urlpath.

Parameters:
  • arr (ndarray) – The NumPy array to be saved.

  • urlpath (str) – The path for the file where the array is saved.

  • chunksize (int) – The size (in bytes) for the chunks during compression. If not provided, it is computed automatically.

  • kwargs (dict, optional) – These are the same as the kwargs in SChunk.__init__.

Returns:

out – The number of bytes of the saved array.

Return type:

int

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