tsdat.testing

Utility functions used in tsdat tests.

Functions

assert_close

Thin wrapper around xarray.assert_allclose which also checks dataset and variable

Function Descriptions

tsdat.testing.assert_close(a: xarray.Dataset, b: xarray.Dataset, check_attrs: bool = True, check_fill_value: bool = True, **kwargs: Any)None[source]

Thin wrapper around xarray.assert_allclose which also checks dataset and variable attrs. Removes global attributes that are allowed to be different, which are currently just the ‘history’ attribute and the ‘code_version’ attribute, and also handles some obscure edge cases for variable attributes.

Parameters
  • a (xr.Dataset) – The first dataset to compare.

  • b (xr.Dataset) – The second dataset to compare.

  • check_attrs (bool) – Check global and variable attributes in addition to the

  • Defaults to True. (data.) –

  • check_fill_value (bool) – Check the _FillValue attribute. This is a special case

  • xarray moves the _FillValue from a variable's attributes to its (because) –

  • upon saving the dataset. Defaults to True. (encoding) –