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

Function _deduplicate_inherited_coordinates

xarray/core/datatree.py:196–215  ·  view source on GitHub ↗
(child: DataTree, parent: DataTree)

Source from the content-addressed store, hash-verified

194
195
196def _deduplicate_inherited_coordinates(child: DataTree, parent: DataTree) -> None:
197 # This method removes repeated indexes (and corresponding coordinates)
198 # that are repeated between a DataTree and its parents.
199 removed_something = False
200 for name in parent._indexes:
201 if name in child._node_indexes:
202 # Indexes on a Dataset always have a corresponding coordinate.
203 # We already verified that these coordinates match in the
204 # check_alignment() call from _pre_attach().
205 del child._node_indexes[name]
206 del child._node_coord_variables[name]
207 removed_something = True
208
209 if removed_something:
210 child._node_dims = calculate_dimensions(
211 child._data_variables | child._node_coord_variables
212 )
213
214 for grandchild in child._children.values():
215 _deduplicate_inherited_coordinates(grandchild, child)
216
217
218def _check_for_slashes_in_names(variables: Iterable[Hashable]) -> None:

Callers 2

_pre_attachMethod · 0.85
_replace_nodeMethod · 0.85

Calls 2

calculate_dimensionsFunction · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…