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

Method identical

xarray/core/dataarray.py:4818–4874  ·  view source on GitHub ↗

Like equals, but also checks the array name, attributes, attributes on all coordinates, and indexes. Parameters ---------- other : DataArray DataArray to compare to. Returns ------- equal : bool True if the two DataArr

(self, other: Self)

Source from the content-addressed store, hash-verified

4816 return False
4817
4818 def identical(self, other: Self) -> bool:
4819 """Like equals, but also checks the array name, attributes,
4820 attributes on all coordinates, and indexes.
4821
4822 Parameters
4823 ----------
4824 other : DataArray
4825 DataArray to compare to.
4826
4827 Returns
4828 -------
4829 equal : bool
4830 True if the two DataArrays are identical.
4831
4832 See Also
4833 --------
4834 DataArray.broadcast_equals
4835 DataArray.equals
4836
4837 Examples
4838 --------
4839 >>> a = xr.DataArray([1, 2, 3], dims="X", attrs=dict(units="m"), name="Width")
4840 >>> b = xr.DataArray([1, 2, 3], dims="X", attrs=dict(units="m"), name="Width")
4841 >>> c = xr.DataArray([1, 2, 3], dims="X", attrs=dict(units="ft"), name="Width")
4842 >>> a
4843 <xarray.DataArray 'Width' (X: 3)> Size: 24B
4844 array([1, 2, 3])
4845 Dimensions without coordinates: X
4846 Attributes:
4847 units: m
4848 >>> b
4849 <xarray.DataArray 'Width' (X: 3)> Size: 24B
4850 array([1, 2, 3])
4851 Dimensions without coordinates: X
4852 Attributes:
4853 units: m
4854 >>> c
4855 <xarray.DataArray 'Width' (X: 3)> Size: 24B
4856 array([1, 2, 3])
4857 Dimensions without coordinates: X
4858 Attributes:
4859 units: ft
4860
4861 >>> a.equals(b)
4862 True
4863 >>> a.identical(b)
4864 True
4865
4866 >>> a.equals(c)
4867 True
4868 >>> a.identical(c)
4869 False
4870 """
4871 try:
4872 return self.name == other.name and self._all_compat(other, "identical")
4873 except (TypeError, AttributeError):
4874 return False
4875

Callers 3

test_equals_failuresMethod · 0.95
test_broadcast_equalsMethod · 0.95

Calls 1

_all_compatMethod · 0.95

Tested by 3

test_equals_failuresMethod · 0.76
test_broadcast_equalsMethod · 0.76