Cross-Calibration#
Overview#
Two sensors measuring the same water rarely agree exactly. Cross-calibration adjusts one sensor to match a reference, such as another glider, a ship CTD cast or a lab sample.
pelagos-py applies a cross-calibration with the Correct Values step. The step does not compare against the reference itself. For now you work out the correction from your own comparison and enter it as a slope and an intercept.
The default pipeline runs it twice (for TEMP and PSAL_ADJUSTED) as placeholders that change nothing until real values are entered.
1. How the correction works#
Each value is corrected as
corrected = slope * value + intercept
Input. If
X_ADJUSTEDalready exists it is corrected instead ofX, so corrections build on each other.Time window. With
time_startand/ortime_end, only samples in that window (bounds included) are corrected; the rest keep their value. Use this when a sensor drifts or is swapped part-way through a deployment.Expected range check. With
expected_range: [min, max], the step first takes the median of the input (within the time window). If the median is already inside the range, the data is assumed correct and nothing is changed. Withoutexpected_rangethe correction is always applied. This is an advanced use case to automatically apply corrections to data with known errors.No-op.
slope: 1andintercept: 0change nothing, so the step skips.
All samples are corrected, including flagged ones, and their QC flags are not changed.
2. Configuration#
Parameter |
Default |
Meaning |
|---|---|---|
|
(required) |
Variable to correct, e.g. |
|
|
Multiplies each value |
|
|
Added after scaling |
|
|
Name, or list of names, to write the result to |
|
none |
Only correct samples in this time window |
|
none |
Skip when the median is already inside |
|
none |
New |
|
none |
Text added to the |
|
none |
Text replacing the |
|
|
Skip, rather than stop, if the variable is missing |
A temperature offset against a reference:
- name: Correct Values
parameters:
target_variable: TEMP
slope: 1.0
intercept: -0.012
append_description: "Offset to ship CTD"
A salinity correction for part of a deployment only:
- name: Correct Values
parameters:
target_variable: PSAL_ADJUSTED
slope: 1.0
intercept: 0.008
time_start: "2024-06-15T00:00:00"
With diagnostics: true the step plots the raw and corrected values, and their difference.
3. Outputs#
Output |
Change |
|---|---|
|
Corrected values; the raw |
its |
A copy of the input’s QC flags, when a new variable is written |
|
Set to |
|
Updated by |
If the correction is skipped (expected range or no-op) and no output_as or description is set, the dataset is left unchanged.