MCPcopy Index your code
hub / github.com/pydata/xarray / copy

Method copy

xarray/core/treenode.py:239–272  ·  view source on GitHub ↗

Returns a copy of this subtree. Copies this node and all child nodes. If `deep=True`, a deep copy is made of each of the component variables. Otherwise, a shallow copy of each of the component variable is made, so that the underlying memory region of the ne

(self, *, inherit: bool = True, deep: bool = False)

Source from the content-addressed store, hash-verified

237 pass
238
239 def copy(self, *, inherit: bool = True, deep: bool = False) -> Self:
240 """
241 Returns a copy of this subtree.
242
243 Copies this node and all child nodes.
244
245 If `deep=True`, a deep copy is made of each of the component variables.
246 Otherwise, a shallow copy of each of the component variable is made, so
247 that the underlying memory region of the new datatree is the same as in
248 the original datatree.
249
250 Parameters
251 ----------
252 inherit : bool
253 Whether inherited coordinates defined on parents of this node should
254 also be copied onto the new tree. Only relevant if the `parent` of
255 this node is not yet, and "Inherited coordinates" appear in its
256 repr.
257 deep : bool
258 Whether each component variable is loaded into memory and copied onto
259 the new object. Default is False.
260
261 Returns
262 -------
263 object : DataTree
264 New object with dimensions, attributes, coordinates, name, encoding,
265 and data of this node and all child nodes copied from original.
266
267 See Also
268 --------
269 xarray.Dataset.copy
270 pandas.DataFrame.copy
271 """
272 return self._copy_subtree(inherit=inherit, deep=deep)
273
274 def _copy_subtree(
275 self, inherit: bool, deep: bool = False, memo: dict[int, Any] | None = None

Callers 1

__init__Method · 0.45

Calls 1

_copy_subtreeMethod · 0.95

Tested by

no test coverage detected