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
axarray.Dataset, xarray.DataArray or xarray.Variable

The first object to compare.

bxarray.Dataset, xarray.DataArray or xarray.Variable

The second object to compare.

rtolfloat, optional

Relative tolerance.

atolfloat, optional

Absolute tolerance.

decode_bytesbool, 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.