tsdat.qc.qc

Module Contents

Classes

QualityManagement

Class that provides static helper functions for providing quality

QualityManager

Applies a single Quality Manager to the given Dataset, as defined by

class tsdat.qc.qc.QualityManagement

Class that provides static helper functions for providing quality control checks on a tsdat-standardized xarray dataset.

static run(ds: xarray.Dataset, config: tsdat.config.Config, previous_data: xarray.Dataset)xarray.Dataset

Applies the Quality Managers defined in the given Config to this dataset. QC results will be embedded in the dataset. QC metadata will be stored as attributes, and QC flags will be stored as a bitwise integer in new companion qc_ variables that are added to the dataset. This method will create QC companion variables if they don’t exist.

Parameters
  • ds (xr.Dataset) – The dataset to apply quality managers to

  • config (Config) – A configuration definition (loaded from yaml)

  • previous_data (xr.Dataset) – A dataset from the previous processing interval (i.e., file). This is used to check for consistency between files, such as for monitonic or delta checks when we need to check the previous value.

Returns

The dataset after quality checkers and handlers have been applied.

Return type

xr.Dataset

class tsdat.qc.qc.QualityManager(ds: xarray.Dataset, config: tsdat.config.Config, definition: tsdat.config.QualityManagerDefinition, previous_data: xarray.Dataset)

Applies a single Quality Manager to the given Dataset, as defined by the Config

Parameters
  • ds (xr.Dataset) – The dataset for which we will perform quality management.

  • config (Config) – The Config from the pipeline definition file.

  • definition (QualityManagerDefinition) – Definition of the quality test this class manages.

  • previous_data (xr.Dataset) – A dataset from the previous processing interval (i.e., file). This is used to check for consistency between files, such as for monitonic or delta checks when we need to check the previous value.

run(self)xarray.Dataset

Runs the QualityChecker and QualityHandler(s) for each specified variable as defined in the config file.

Returns

The dataset after the quality checker and the quality handlers have been run.

Raises

QCError – A QCError indicates that a fatal error has occurred.

Return type

xr.Dataset