Skip to content

quality_checker

Classes:

Name Description
QualityChecker

Classes#

QualityChecker #

Bases: ParameterizedClass, ABC


Base class for code that checks the dataset / data variable quality.


Methods:

Name Description
run

Functions#

run abstractmethod #
run(
    dataset: xr.Dataset, variable_name: str
) -> Union[NDArray[np.bool_], None]

Identifies and flags quality problems with the data.

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:

Name Type Description Default
dataset Dataset

The dataset containing the variable to check.

required
variable_name str

The name of the variable to check.

required

Returns:

Type Description
Union[NDArray[bool_], None]

NDArray[np.bool_]: The results of the quality check, where True values

Union[NDArray[bool_], None]

indicate a quality problem.


Source code in tsdat/qc/base/quality_checker.py
@abstractmethod
def run(
    self,
    dataset: xr.Dataset,
    variable_name: str,
) -> Union[NDArray[np.bool_], None]:
    """-----------------------------------------------------------------------------
    Identifies and flags quality problems with the data.

    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.

    Args:
        dataset (xr.Dataset): The dataset containing the variable to check.
        variable_name (str): The name of the variable to check.

    Returns:
        NDArray[np.bool_]: The results of the quality check, where True values
        indicate a quality problem.

    -----------------------------------------------------------------------------"""
    ...