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, configurable replacement for the old separate “gross range” and “impossible range” tests.
Each
{flag: bounds}entry describes one or more bands. A band is given as a[low, high]pair with aninside/outsidekeyword saying which side to flag:``[low, high, “outside”]`` — a good band; data
< lowor> highgets the flag. (The old “gross range” behaviour.) Acceptsoutside,outoro(any capitalisation).``[low, high, “inside”]`` — an impossible band; data strictly between the two bounds gets the flag. (The old “impossible range” behaviour.) Accepts
inside,inori(any capitalisation).A single scalar
value— flags exact matches (data == value). Handy for fill/filler values, e.g.4: 0.0to flag a pressure of exactly0as bad.
The same flag can cover several bands by giving a list of bands, e.g.
4: [[2, 3, "inside"], [0.1, 10, "outside"]]— a point is flagged if it falls in any of them.If the keyword is omitted the bound order is used as a fallback: an ascending
[low, high]meansoutside(a good band) and a descending[high, low]meansinside(an impossible band). An explicit keyword always wins over the order, so writeinside/outsidewhen in doubt.Within a variable, entries are applied most-severe-flag-first, so on overlap the worse flag wins. Anything checked but not flagged is marked good (1).
Target Variable: Any Flag Number: Any (user-defined) Variables Flagged: Any (the tested variables, plus any
also_flagcompanions)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: [-100, 0] # OPTIONAL: only check this DEPTH window diagnostics: true # plots every flagged variable, coloured by flag