blosc2.empty#
- blosc2.empty(shape: int | tuple | list, dtype: ~numpy.dtype | str | None = <class 'numpy.float64'>, **kwargs: ~typing.Any) NDArray #
Create an empty array.
- Parameters:
shape¶ (int, tuple or list) – The shape for the final array.
dtype¶ (np.dtype or list str) – The data type of the array elements in NumPy format. Default is np.uint8. This will override the typesize in the compression parameters if they are provided.
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 if they are provided.
The other keyword arguments supported are the same as for the
SChunk.__init__
constructor.
- Returns:
out – A NDArray is returned.
- Return type:
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')