blosc2.empty#

blosc2.empty(shape, dtype=<class 'numpy.uint8'>, **kwargs)#

Create an empty array.

Parameters:
  • shape (int, tuple or list) – The shape for the final array.

  • dtype (np.dtype) – The ndarray dtype in NumPy format. Default is np.uint8. This will override the typesize in the cparams in case they are passed.

  • kwargs (dict, optional) –

    Keyword arguments supported:
    chunks: tuple or list

    The chunk shape. If None (default), Blosc2 will compute an efficient chunk shape.

    blocks: tuple or list

    The block shape. If None (default), Blosc2 will compute an efficient block shape. This will override the blocksize in the cparams in case they are passed.

    The other keyword arguments supported are the same as for the SChunk.__init__ constructor.

Returns:

out – A NDArray is returned.

Return type:

NDArray

Examples

>>> import blosc2
>>> import numpy as np
>>> shape = [20, 20]
>>> dtype = np.int32
>>> # Create empty array with default chunks and blocks
>>> array = blosc2.empty(shape, dtype=dtype)
>>> array.shape
(20, 20)
>>> array.dtype
dtype('int32')