eradiate.test_tools.regression.RegressionTest

eradiate.test_tools.regression.RegressionTest#

class eradiate.test_tools.regression.RegressionTest(name, value, reference=None, *, threshold, archive_dir)[source]#

Bases: ABC

Common interface for tests based on the comparison of a result array against reference values.

Parameters:
  • name (str) – Test case name.

  • value (xarray.Dataset) – Simulation result. Must be specified as a dataset.

  • reference (xarray.Dataset or path-like, optional, default: None) – Reference data. Can be specified as an xarray dataset, a path to a NetCDF file or a path to a resource served by the data store.

  • threshold (float) – Threshold for test evaluation

  • archive_dir (path-like) – Path to output artefact storage directory. Relative paths are interpreted with respect to the current working directory.

Fields:
  • name (str) – Test case name.

  • value (xarray.Dataset) – Simulation result.

  • reference (xarray.Dataset or None) – Reference data.

  • threshold (float) – Threshold for test evaluation.

  • archive_dir (pathlib.Path) – Path to output artefact storage directory.

run()[source]#

This method controls the execution steps of the regression test:

  • handle missing reference data

  • catch errors during text evaluation

  • create the appropriate plots and data archives

Returns:

bool – Result of the test criterion comparison.