tsdat.qc.base
Classes
Base class for code that checks the dataset / data variable quality. |
|
Base class for code that handles the dataset / data variable quality. |
|
Main class for orchestrating the dispatch of QualityCheckers and QualityHandlers. |
|
Groups a QualityChecker and one or more QualityHandlers together. |
- class tsdat.qc.base.QualityChecker[source]
Bases:
tsdat.utils.ParameterizedClass
,abc.ABC
Base class for code that checks the dataset / data variable quality.
Class Methods
Identifies and flags quality problems with the data.
Method Descriptions
- abstract run(self, dataset: xarray.Dataset, variable_name: str) numpy.typing.NDArray[numpy.bool8] [source]
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
dataset (xr.Dataset) – The dataset containing the variable to check.
variable_name (str) – The name of the variable to check.
- Returns
NDArray[np.bool8] – The results of the quality check, where True values indicate a quality problem.
- class tsdat.qc.base.QualityHandler[source]
Bases:
tsdat.utils.ParameterizedClass
,abc.ABC
Base class for code that handles the dataset / data variable quality.
Class Methods
Takes some action on data that has had quality issues identified.
Method Descriptions
- abstract run(self, dataset: xarray.Dataset, variable_name: str, failures: numpy.typing.NDArray[numpy.bool8]) xarray.Dataset [source]
Takes some action on data that has had quality issues identified.
Handles the quality of a variable in the dataset and returns the dataset after any corrections have been applied.
- Parameters
dataset (xr.Dataset) – The dataset containing the variable to handle.
variable_name (str) – The name of the variable whose quality should be handled.
failures (NDArray[np.bool8]) – The results of the QualityChecker for the provided variable, where True values indicate a quality problem.
- Returns
xr.Dataset – The dataset after the QualityHandler has been run.
- class tsdat.qc.base.QualityManagement[source]
Bases:
pydantic.BaseModel
Main class for orchestrating the dispatch of QualityCheckers and QualityHandlers.
- Parameters
managers (List[QualityManager]) – The list of QualityManagers that should be run.
Class Methods
Runs the registered QualityManagers on the dataset.
Method Descriptions
- class tsdat.qc.base.QualityManager[source]
Bases:
pydantic.BaseModel
Groups a QualityChecker and one or more QualityHandlers together.
- Parameters
name (str) – The name of the quality manager.
checker (QualityChecker) – The quality check that should be run.
handlers (QualityHandler) – One or more QualityHandlers that should be run given the results of the checker.
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.
exclude (List[str]) – A list of variables that the check should exclude. Accepts the same keywords as apply_to.
Class Methods
Runs the quality manager on the dataset.
Method Descriptions