src.toolbox.steps.custom.apply_qc#

Class definition for quality control steps.

Classes#

ApplyQC

Step to apply quality control tests to the dataset.

Module Contents#

class src.toolbox.steps.custom.apply_qc.ApplyQC(name, parameters=None, diagnostics=False, context=None)[source]#

Bases: src.toolbox.steps.base_step.BaseStep

Step to apply quality control tests to the dataset.

Inherits properties from BaseStep (see base_step.py).

step_name = 'Apply QC'[source]#
organise_flags(new_flags)[source]#

Method for taking in new flags (new_flags) and cross checking against existing flags (self.flag_store), including upgrading flags when necessary, following ARGO flagging standards. See Wong et al. 2025 pp. 106 (http://dx.doi.org/10.13155/33951) and Mancini et al. 2021 pp. 43-44 for additional ARGO flag definitions.

Combinatrix logic: 0: No QC performed, the initial flag. 1: Good data. No adjustment needed. 2: Probably good data. 3: Probably bad data that are potentially correctable. 4: Bad data that are not correctable. 5: Value changed. 6, 7: Not used. 8: Estimated by interpolation, extrapolation, or other algorithm. 9: Missing value.

The combinatrix defines flagging priority when merging in new flags. The flag value itself acts as a kind of index. As an example, if an existing flag is 2 (probably good data) and a new flag is 4 (bad data), the resulting flag will be 4. 2 (probably good data) + 4 (bad data) -> 4 (bad data) 3 (probably bad data) + 5 (value changed) -> 3 (probably bad data)

Parameters:

new_flags (xarray.Dataset) – Dataset containing new QC flag variables to be merged into the existing flag store.

run()[source]#

Run the Apply QC step.

Raises:
  • KeyError – If no QC operations are specified, if requested QC tests are invalid, or esssential variables are missing.

  • ValueError – If no data is found in context.