pelagos_py.steps.quality_control.visual_qc#

class pelagos_py.steps.quality_control.visual_qc.visual_qc(data, **kwargs)[source]#

Bases: pelagos_py.steps.base_qc.BaseQC

Flag samples inside (or outside) boxes drawn on an x_variable vs y_variable plot. Boxes can be drawn interactively or added to YAML; either way they are plain YAML, so the run can be repeated anywhere.

variables lists the variables to QC: a name, or a list of names flagged together. Each box flags its own variables (default: its y_variable).

  • A box replaces existing flags, bad -> good included, and later boxes win where they overlap. With override: false it merges by the Argo combinatrix instead, so a flag can only get worse.

  • A box with single x and y values is a point: it flags the nearest sample.

  • A box can name its own x_variable/y_variable, else it uses the test’s.

  • profiles (or cycles) limits a box to those PROFILE_NUMBER (or CYCLE) values, so Find Profiles must have run.

  • Missing samples stay 9. Samples no box touches get 1 when flag_remaining_good is on (the default), else keep their flag.

Target Variable: Any Flag Number: Any (user-defined, 0-9) Variables Flagged: variables, plus each box’s own

Example

- name: "Apply QC"
  parameters:
    qc_settings:
      visual qc:
        variables: [CHLA, [TEMP, PSAL]]   # CHLA alone, TEMP and PSAL together
        x_variable: TIME              # axes for boxes that don't name their own
        y_variable: PRES
        boxes:
          - {x: ["2024-05-02T10:00:00", "2024-05-02T14:30:00"], y: [0, 15], flag: 4, mode: inside, variables: [TEMP, PSAL]}
          # everything outside, merged so no flag gets better
          - {x: ["2024-05-01", "2024-05-20"], y: [0, 1000], flag: 3, mode: outside, override: false}
          # a point: the nearest sample only
          - {x: ["2024-05-03T08:12:30"], y: [42.5], flag: 4}
          - x: ["2024-05-04", "2024-05-05"]
            y: [10, 12]
            flag: 3
            y_variable: TEMP          # drawn on TEMP vs TIME, flags TEMP
          # only within profile 42
          - {x: [0.8, 3], y: [0, 20], flag: 4, x_variable: CHLA, y_variable: DEPTH, variables: [CHLA], profiles: [42]}
        flag_remaining_good: true     # untouched samples become 1 (good)
  diagnostics: true
return_qc()[source]#

Representative of QC processing, to be overridden by subclasses.

Returns:

flags – Output QC flags for the data specific to the test.

Return type:

array-like

plot_diagnostics()[source]#

Representative of diagnostic plotting (optional).