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

Method _all_compat

xarray/core/dataset.py:1526–1548  ·  view source on GitHub ↗

Helper function for equals and identical

(
        self, other: Self, compat: str | Callable[[Variable, Variable], bool]
    )

Source from the content-addressed store, hash-verified

1524 __hash__ = None # type: ignore[assignment]
1525
1526 def _all_compat(
1527 self, other: Self, compat: str | Callable[[Variable, Variable], bool]
1528 ) -> bool:
1529 """Helper function for equals and identical"""
1530
1531 if not callable(compat):
1532 compat_str = compat
1533
1534 # For identical, also compare indexes
1535 if compat_str == "identical":
1536 from xarray.core.indexes import indexes_identical
1537
1538 if not indexes_identical(self.xindexes, other.xindexes):
1539 return False
1540
1541 # some stores (e.g., scipy) do not seem to preserve order, so don't
1542 # require matching order for equality
1543 def compat(x: Variable, y: Variable) -> bool:
1544 return getattr(x, compat_str)(y)
1545
1546 return self._coord_names == other._coord_names and utils.dict_equiv(
1547 self._variables, other._variables, compat=compat
1548 )
1549
1550 def broadcast_equals(self, other: Self) -> bool:
1551 """Two Datasets are broadcast equal if they are equal after

Callers 4

broadcast_equalsMethod · 0.95
equalsMethod · 0.95
identicalMethod · 0.95
diff_nodewise_summaryFunction · 0.45

Calls 1

indexes_identicalFunction · 0.90

Tested by

no test coverage detected