xarray.Dataset.identical

xarray.Dataset.identical#

Dataset.identical(other)[source]#

Like equals, but also checks all dataset attributes and the attributes on all variables and coordinates.

Example

>>> a = xr.Dataset(
...     {"Width": ("X", [1, 2, 3])},
...     coords={"X": [1, 2, 3]},
...     attrs={"units": "m"},
... )
>>> b = xr.Dataset(
...     {"Width": ("X", [1, 2, 3])},
...     coords={"X": [1, 2, 3]},
...     attrs={"units": "m"},
... )
>>> c = xr.Dataset(
...     {"Width": ("X", [1, 2, 3])},
...     coords={"X": [1, 2, 3]},
...     attrs={"units": "ft"},
... )
>>> a
<xarray.Dataset> Size: 48B
Dimensions:  (X: 3)
Coordinates:
  * X        (X) int64 24B 1 2 3
Data variables:
    Width    (X) int64 24B 1 2 3
Attributes:
    units:    m
>>> b
<xarray.Dataset> Size: 48B
Dimensions:  (X: 3)
Coordinates:
  * X        (X) int64 24B 1 2 3
Data variables:
    Width    (X) int64 24B 1 2 3
Attributes:
    units:    m
>>> c
<xarray.Dataset> Size: 48B
Dimensions:  (X: 3)
Coordinates:
  * X        (X) int64 24B 1 2 3
Data variables:
    Width    (X) int64 24B 1 2 3
Attributes:
    units:    ft
>>> a.equals(b)
True
>>> a.identical(b)
True
>>> a.equals(c)
True
>>> a.identical(c)
False