xarray.testing.assert_allclose

xarray.testing.assert_allclose(a, b, rtol=1e-05, atol=1e-08, decode_bytes=True)

Like numpy.testing.assert_allclose(), but for xarray objects.

Raises an AssertionError if two objects are not equal up to desired tolerance.

Parameters:
a : xarray.Dataset, xarray.DataArray or xarray.Variable

The first object to compare.

b : xarray.Dataset, xarray.DataArray or xarray.Variable

The second object to compare.

rtol : float, optional

Relative tolerance.

atol : float, optional

Absolute tolerance.

decode_bytes : bool, optional

Whether byte dtypes should be decoded to strings as UTF-8 or not. This is useful for testing serialization methods on Python 3 that return saved strings as bytes.