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

Method copy

xarray/core/coordinates.py:749–771  ·  view source on GitHub ↗

Return a copy of this Coordinates object.

(
        self,
        deep: bool = False,
        memo: dict[int, Any] | None = None,
    )

Source from the content-addressed store, hash-verified

747 return self._data._ipython_key_completions_()
748
749 def copy(
750 self,
751 deep: bool = False,
752 memo: dict[int, Any] | None = None,
753 ) -> Self:
754 """Return a copy of this Coordinates object."""
755 # do not copy indexes (may corrupt multi-coordinate indexes)
756 # TODO: disable variables deepcopy? it may also be problematic when they
757 # encapsulate index objects like pd.Index
758 variables = {
759 k: v._copy(deep=deep, memo=memo) for k, v in self.variables.items()
760 }
761
762 # TODO: getting an error with `self._construct_direct`, possibly because of how
763 # a subclass implements `_construct_direct`. (This was originally the same
764 # runtime code, but we switched the type definitions in #8216, which
765 # necessitates the cast.)
766 return cast(
767 Self,
768 Coordinates._construct_direct(
769 coords=variables, indexes=dict(self.xindexes), dims=dict(self.sizes)
770 ),
771 )
772
773 def drop_vars(
774 self,

Callers 5

assignMethod · 0.95
test_copyMethod · 0.95
__init__Method · 0.45
_update_coordsMethod · 0.45
to_datasetMethod · 0.45

Calls 3

itemsMethod · 0.80
_copyMethod · 0.45
_construct_directMethod · 0.45

Tested by 1

test_copyMethod · 0.76