xarray.testing.assert_identical#
- xarray.testing.assert_identical(a, b, from_root=True)[source]#
Like
xarray.testing.assert_equal()
, but also matches the objects’ names and attributes.Raises an AssertionError if two objects are not identical.
For DataTree objects, assert_identical is mapped over all Datasets on each node, with the DataTrees being identical if both are isomorphic and the corresponding Datasets at each node are themselves identical.
- Parameters:
a (
xarray.Dataset
,xarray.DataArray
,xarray.Variable
orxarray.Coordinates
) – The first object to compare.b (
xarray.Dataset
,xarray.DataArray
,xarray.Variable
orxarray.Coordinates
) – The second object to compare.from_root (
bool
, optional, defaultis True
) – Only used when comparing DataTree objects. Indicates whether or not to first traverse to the root of the trees before checking for isomorphism. If a & b have no parents then this has no effect.
See also
assert_equal
,assert_allclose
,Dataset.equals
,DataArray.equals