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

Method _pre_attach

xarray/core/datatree.py:563–573  ·  view source on GitHub ↗
(self: DataTree, parent: DataTree, name: str)

Source from the content-addressed store, hash-verified

561 self._close = dataset._close
562
563 def _pre_attach(self: DataTree, parent: DataTree, name: str) -> None:
564 super()._pre_attach(parent, name)
565 if name in parent.dataset.variables:
566 raise KeyError(
567 f"parent {parent.name} already contains a variable named {name}"
568 )
569 path = str(NodePath(parent.path) / name)
570 node_ds = self.to_dataset(inherit=False)
571 parent_ds = parent._to_dataset_view(rebuild_dims=False, inherit=True)
572 check_alignment(path, node_ds, parent_ds, self.children)
573 _deduplicate_inherited_coordinates(self, parent)
574
575 @property
576 def _node_coord_variables_with_index(self) -> Mapping[Hashable, Variable]:

Callers

nothing calls this directly

Calls 5

to_datasetMethod · 0.95
NodePathClass · 0.90
check_alignmentFunction · 0.85
_to_dataset_viewMethod · 0.80

Tested by

no test coverage detected