blosc2.NDArray.copy#

NDArray.copy(dtype: dtype = None, **kwargs: dict) NDArray#

Create a copy of an array with same parameters.

Parameters:
  • dtype (np.dtype) – The new array dtype. Default is self.dtype.

  • kwargs (dict, optional) – Additional keyword arguments supported by the empty() constructor. If not specified, the defaults will be taken from the original array (except for the urlpath).

Returns:

out – A NDArray with a copy of the data.

Return type:

NDArray

See also

copy()

Examples

>>> import blosc2
>>> import numpy as np
>>> shape = (10, 10)
>>> blocks = (10, 10)
>>> dtype = np.bool_
>>> # Create a NDArray with default chunks
>>> a = blosc2.zeros(shape, blocks=blocks, dtype=dtype)
>>> # Get a copy with default chunks and blocks
>>> b = a.copy(chunks=None, blocks=None)
>>> np.array_equal(b[...], a[...])
True