tsdat.qc.checkers

Classes

CheckFailDelta

Checks the difference between consecutive values and reports a failure if the

CheckFailMax

Checks that no values for the specified variable are greater than a specified

CheckFailMin

Checks that no values for the specified variable are less than a specified minimum

CheckFailRangeMax

Checks that no values for the specified variable are greater than a specified

CheckFailRangeMin

Checks that no values for the specified variable are less than a specified minimum

CheckMissing

Checks if any data are missing. A variable’s data are considered missing if they are

CheckMonotonic

Checks if any values are not ordered strictly monotonically (i.e. values must all be

CheckValidDelta

Checks the difference between consecutive values and reports a failure if the

CheckValidMax

Checks that no values for the specified variable are greater than a specified

CheckValidMin

Checks that no values for the specified variable are less than a specified minimum

CheckValidRangeMax

Checks that no values for the specified variable are greater than a specified

CheckValidRangeMin

Checks that no values for the specified variable are less than a specified minimum

CheckWarnDelta

Checks the difference between consecutive values and reports a failure if the

CheckWarnMax

Checks that no values for the specified variable are greater than a specified

CheckWarnMin

Checks that no values for the specified variable are less than a specified minimum

CheckWarnRangeMax

Checks that no values for the specified variable are greater than a specified

CheckWarnRangeMin

Checks that no values for the specified variable are less than a specified minimum

class tsdat.qc.checkers.CheckFailDelta[source]

Bases: _CheckDelta

Checks the difference between consecutive values and reports a failure if the difference is less than the threshold specified by the value in the attribute provided to this check.

Parameters

attribute_name (str) – The name of the attribute containing the threshold to use.

attribute_name :str = fail_delta[source]
class tsdat.qc.checkers.CheckFailMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = fail_max[source]
class tsdat.qc.checkers.CheckFailMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = fail_min[source]
class tsdat.qc.checkers.CheckFailRangeMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = fail_range[source]
class tsdat.qc.checkers.CheckFailRangeMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = fail_range[source]
class tsdat.qc.checkers.CheckMissing[source]

Bases: tsdat.qc.base.QualityChecker

Checks if any data are missing. A variable’s data are considered missing if they are set to the variable’s _FillValue (if it has a _FillValue) or NaN (NaT for datetime- like variables).

Class Methods

run

Checks the quality of a specific variable in the dataset and returns the results

Method Descriptions

run(self, dataset: xarray.Dataset, variable_name: str)numpy.typing.NDArray[numpy.bool8][source]

Checks the quality of a specific variable in the dataset and returns the results of the check as a boolean array where True values represent quality problems and False values represent data that passes the quality check.

QualityCheckers should not modify dataset variables; changes to the dataset should be made by QualityHandler(s), which receive the results of a QualityChecker as input.

Parameters
  • dataset (xr.Dataset) – The dataset containing the variable to check.

  • variable_name (str) – The name of the variable to check.

Returns

The results of the quality check, where True values indicate a quality problem.

Return type

NDArray[np.bool8]

class tsdat.qc.checkers.CheckMonotonic[source]

Bases: tsdat.qc.base.QualityChecker

Checks if any values are not ordered strictly monotonically (i.e. values must all be increasing or all decreasing). The check marks all values as failed if any data values are not ordered monotonically.

class Parameters[source]

Bases: pydantic.BaseModel

dim :Optional[str][source]
require_decreasing :bool = False[source]
require_increasing :bool = False[source]

Class Methods

check_monotonic_not_increasing_and_decreasing

Method Descriptions

classmethod check_monotonic_not_increasing_and_decreasing(cls, inc: bool, values: Dict[str, Any])bool[source]
parameters :CheckMonotonic.Parameters[source]

Class Methods

get_axis

run

Checks the quality of a specific variable in the dataset and returns the results

Method Descriptions

get_axis(self, variable: xarray.DataArray)int[source]
run(self, dataset: xarray.Dataset, variable_name: str)numpy.typing.NDArray[numpy.bool8][source]

Checks the quality of a specific variable in the dataset and returns the results of the check as a boolean array where True values represent quality problems and False values represent data that passes the quality check.

QualityCheckers should not modify dataset variables; changes to the dataset should be made by QualityHandler(s), which receive the results of a QualityChecker as input.

Parameters
  • dataset (xr.Dataset) – The dataset containing the variable to check.

  • variable_name (str) – The name of the variable to check.

Returns

The results of the quality check, where True values indicate a quality problem.

Return type

NDArray[np.bool8]

class tsdat.qc.checkers.CheckValidDelta[source]

Bases: _CheckDelta

Checks the difference between consecutive values and reports a failure if the difference is less than the threshold specified by the value in the attribute provided to this check.

Parameters

attribute_name (str) – The name of the attribute containing the threshold to use.

attribute_name :str = valid_delta[source]
class tsdat.qc.checkers.CheckValidMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = valid_max[source]
class tsdat.qc.checkers.CheckValidMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = valid_min[source]
class tsdat.qc.checkers.CheckValidRangeMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = valid_range[source]
class tsdat.qc.checkers.CheckValidRangeMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = valid_range[source]
class tsdat.qc.checkers.CheckWarnDelta[source]

Bases: _CheckDelta

Checks the difference between consecutive values and reports a failure if the difference is less than the threshold specified by the value in the attribute provided to this check.

Parameters

attribute_name (str) – The name of the attribute containing the threshold to use.

attribute_name :str = warn_delta[source]
class tsdat.qc.checkers.CheckWarnMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = warn_max[source]
class tsdat.qc.checkers.CheckWarnMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = warn_min[source]
class tsdat.qc.checkers.CheckWarnRangeMax[source]

Bases: _CheckMax

Checks that no values for the specified variable are greater than a specified threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the maximum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = warn_range[source]
class tsdat.qc.checkers.CheckWarnRangeMin[source]

Bases: _CheckMin

Checks that no values for the specified variable are less than a specified minimum threshold. The value of the threshold is specified by an attribute on each data variable, and the attribute to search for is specified as a property of this base class.

If the specified attribute does not exist on the variable being checked then no failures will be reported.

Parameters
  • attribute_name (str) – The name of the attribute containing the minimum

  • If the attribute ends in '_range' then it is assumed to be a list (threshold.) –

:param : :param and the first value from the list will be used as the minimum threshold.: :param allow_equal: True if values equal to the threshold should pass the check, :type allow_equal: bool :param False otherwise.:

attribute_name :str = warn_range[source]