Skip to content

quality_manager

Classes:

Name Description
QualityManager

Groups a QualityChecker and one or more QualityHandlers together.

Classes#

QualityManager #

Bases: BaseModel

Groups a QualityChecker and one or more QualityHandlers together.

Methods:

Name Description
run

Attributes:

Name Type Description
apply_to List[str]

A list of variables that the check should run for. Accepts keywords of 'COORDS'

checker QualityChecker

The quality check that should be run.

exclude List[str]

A list of variables that the check should exclude. Accepts the same keywords as

handlers List[QualityHandler]

One or more QualityHandlers that should be run given the results of the

name str

The name of the quality manager.

Attributes#

apply_to instance-attribute #
apply_to: List[str]

A list of variables that the check should run for. Accepts keywords of 'COORDS' or 'DATA_VARS', or any number of specific variables that should be run.

checker instance-attribute #
checker: QualityChecker

The quality check that should be run.

exclude class-attribute instance-attribute #
exclude: List[str] = []

A list of variables that the check should exclude. Accepts the same keywords as apply_to.

handlers instance-attribute #
handlers: List[QualityHandler]

One or more QualityHandlers that should be run given the results of the checker.

name instance-attribute #
name: str

The name of the quality manager.

Functions#

run #
run(dataset: xr.Dataset) -> xr.Dataset

Runs the quality manager on the dataset.

Parameters:

Name Type Description Default
dataset Dataset

The dataset to apply quality checks / controls to.

required

Returns:

Type Description
Dataset

xr.Dataset: The dataset after the quality check and controls have been applied.


Source code in tsdat/qc/base/quality_manager.py
def run(self, dataset: xr.Dataset) -> xr.Dataset:
    """-----------------------------------------------------------------------------
    Runs the quality manager on the dataset.

    Args:
        dataset (xr.Dataset): The dataset to apply quality checks / controls to.

    Returns:
        xr.Dataset: The dataset after the quality check and controls have been
            applied.

    -----------------------------------------------------------------------------"""
    variables = self._get_variables_to_run(dataset)
    for variable_name in variables:
        issues = self.checker.run(dataset, variable_name)
        if issues is None:
            continue
        for handler in self.handlers:
            dataset = handler.run(dataset, variable_name, issues)
    return dataset