MCPcopy
hub / github.com/pydata/xarray / copy

Method copy

xarray/namedarray/core.py:372–402  ·  view source on GitHub ↗

Returns a copy of this object. If `deep=True`, the data array is loaded into memory and copied onto the new object. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same structure as original but entirely new data.

(
        self,
        deep: bool = True,
        data: duckarray[_ShapeType_co, _DType_co] | None = None,
    )

Source from the content-addressed store, hash-verified

370 return self._copy(deep=True, memo=memo)
371
372 def copy(
373 self,
374 deep: bool = True,
375 data: duckarray[_ShapeType_co, _DType_co] | None = None,
376 ) -> Self:
377 """Returns a copy of this object.
378
379 If `deep=True`, the data array is loaded into memory and copied onto
380 the new object. Dimensions, attributes and encodings are always copied.
381
382 Use `data` to create a new object with the same structure as
383 original but entirely new data.
384
385 Parameters
386 ----------
387 deep : bool, default: True
388 Whether the data array is loaded into memory and copied onto
389 the new object. Default is True.
390 data : array_like, optional
391 Data to use in the new object. Must have same shape as original.
392 When `data` is used, `deep` is ignored.
393
394 Returns
395 -------
396 object : NamedArray
397 New object with dimensions, attributes, and optionally
398 data copied from original.
399
400
401 """
402 return self._copy(deep=deep, data=data)
403
404 @property
405 def ndim(self) -> int:

Callers 3

permute_dimsMethod · 0.95
_newFunction · 0.45
_copyMethod · 0.45

Calls 1

_copyMethod · 0.95

Tested by

no test coverage detected