Two DataTrees are equal if they have isomorphic node structures, with matching node names, and if they have matching variables and coordinates, all of which are equal. Parameters ---------- other : DataTree The other tree object to compar
(self, other: DataTree)
| 1534 | return diff_treestructure(self, other) is None |
| 1535 | |
| 1536 | def equals(self, other: DataTree) -> bool: |
| 1537 | """ |
| 1538 | Two DataTrees are equal if they have isomorphic node structures, with |
| 1539 | matching node names, and if they have matching variables and |
| 1540 | coordinates, all of which are equal. |
| 1541 | |
| 1542 | Parameters |
| 1543 | ---------- |
| 1544 | other : DataTree |
| 1545 | The other tree object to compare to. |
| 1546 | |
| 1547 | See Also |
| 1548 | -------- |
| 1549 | Dataset.equals |
| 1550 | DataTree.isomorphic |
| 1551 | DataTree.identical |
| 1552 | """ |
| 1553 | if not self.isomorphic(other): |
| 1554 | return False |
| 1555 | |
| 1556 | # Note: by using .dataset, this intentionally does not check that |
| 1557 | # coordinates are defined at the same levels. |
| 1558 | return all( |
| 1559 | node.dataset.equals(other_node.dataset) |
| 1560 | for node, other_node in zip_subtrees(self, other) |
| 1561 | ) |
| 1562 | |
| 1563 | def _inherited_coords_set(self) -> set[str]: |
| 1564 | return set(self.parent.coords if self.parent else []) # type: ignore[arg-type] |
nothing calls this directly
no test coverage detected