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 self.dtype.

  • kwargs (dict, optional) – Keyword arguments that are supported by the empty() constructor. If some are not specified, the default will be the ones 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