pelagos_py.steps.quality_control.range_qc#
- class pelagos_py.steps.quality_control.range_qc.range_qc(data, **kwargs)[source]#
Bases:
pelagos_py.steps.base_qc.BaseQCFlag measurements by value range: a single replacement for the old separate “gross range” and “impossible range” tests.
Each
{flag: bounds}entry describes one or more bands:``[low, high, “outside”]`` — a good band; data outside it gets the flag (accepts
outside/out/o).``[low, high, “inside”]`` — an impossible band; data between the bounds inclusive gets the flag (accepts
inside/in/i).A single scalar
value— flags exact matches (e.g. a fill value4: 0.0).
A flag may give a list of bands to cover several ranges. If the keyword is omitted the bound order decides: ascending
[low, high]means outside, descending[high, low]means inside. Entries apply most-severe-flag-first, so the worse flag wins on overlap; anything checked but not flagged is marked good (1).Target Variable: Any Flag Number: Any (user-defined) Variables Flagged: Any (the tested variables, minus any
flag_insteadsources, plus anyalso_flag/flag_insteadcompanions)Example
- name: "Apply QC" parameters: qc_settings: range qc: variable_ranges: PRES: 3: [-2.4, -5, inside] # impossible band: flag data INSIDE it 4: [-5, -.inf, inside] 9: 0.0 # single scalar -> flag the exact fill value 0.0 TEMP: 3: [0, 30, outside] # good band: flag data OUTSIDE it 4: [-2.5, 40, outside] CNDC: # one flag, two bands: flag bad both inside [2, 3] and outside [0.1, 10] 4: [[2, 3, inside], [0.1, 10, outside]] also_flag: CNDC: [PRES, TEMP] # CNDC's flags propagate onto PRES & TEMP (worst wins) test_depth_range: [0, 100] # OPTIONAL: only check this DEPTH window diagnostics: true # plots every flagged variable, coloured by flag
Flagging one variable by another’s range (
flag_instead) — here CHLA is judged by DEPTH (probably-bad in the quenched top 5 m, probably-good below it) while DEPTH itself is left unflagged:- name: "Apply QC" parameters: qc_settings: range qc: variable_ranges: DEPTH: 3: [0, 5, inside] # top 5 m -> probably bad (correctable) 2: [0, 5, outside] # deeper -> probably good flag_instead: DEPTH: [CHLA] # DEPTH's flags go onto CHLA; no DEPTH_QC written