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. |
|
Class that groups a single QualityChecker and one or more QualityHandlers so they |
-
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
Checks the quality of a specific variable in the dataset and returns the results
Method Descriptions
-
abstract
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]
-
abstract
-
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
Handles the quality of a variable in the dataset and returns the dataset after
Method Descriptions
-
abstract
run
(self, dataset: xarray.Dataset, variable_name: str, failures: numpy.typing.NDArray[numpy.bool8]) → xarray.Dataset[source]¶ 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
variable (provided) –
True values indicate a quality problem. (where) –
- Returns
The dataset after the QualityHandler has been run.
- Return type
xr.Dataset
-
abstract
-
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
Class that groups a single QualityChecker and one or more QualityHandlers so they can be dispatched 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
results of the checker. (the) –
apply_to (List[str]) – A list of variables that the check should run for. Accepts
of 'COORDS' or 'DATA_VARS' (keywords) –
any number of specific variables that (or) –
be run. (should) –
exclude (List[str]) – A list of variables that the check should exclude. Accepts
same keywords as apply_to. (the) –
Class Methods
Runs the quality manager on the dataset.
Method Descriptions