xdas.DataArray.copy#

DataArray.copy(deep=True, data=None)[source]#

Return a copy of this array.

If deep=True, a deep copy is made of the data array. Otherwise, a shallow copy is made, and the returned data array’s values are a new view of this data array’s values.

Use data to create a new object with the same structure as original but entirely new data.

Parameters:
  • deep (bool, optional) – Whether the data array and its coordinates are loaded into memory and copied onto the new object. Default is True.

  • data (array_like, optional) – Data to use in the new object. Must have same shape as original. When data is used, deep is ignored for all data variables, and only used for coords.

Returns:

New object with dimensions, attributes, coordinates, name, encoding, and optionally data copied from original.

Return type:

DataArray