Write the in-air gain correction of the oxygen optodes of a profiling-float programme: convert optode phase to oxygen partial pressure under two calibration models, build the air reference from a weather reanalysis with humidity, screen wave-washed in-air samples, fit gain, drift and surface-water carry-over per mounting period, propagate uncertainty and report corrected oxygen at depth; it is run under a time limit on further float records with known optode gains.
harbor run -t reactive-labs/float-oxygen-gainharbor download reactive-labs/float-oxygen-gainYou are Nadia Ferrand, data analyst in the float programme (BFP) of the Brannock Ocean Institute. The programme's four Petrel-3 floats (F021 to F024) carry a Gannet GO-4 oxygen optode on a stick, which measures the air for a few minutes after every surfacing. None of their oxygen data has had a gain applied yet. Today is Thursday 3 December 2026. Adaeze Okonkwo, the programme's data manager, wrote this morning:
Next is oxygen: SOP-FP-06 is signed, so the in-air method replaces my deployment-cast gains of last year. Could you write it as one program that takes a float in the archive layout and gives the gain at deployment and its drift with their uncertainties, the gain of every cycle and the corrected oxygen at the four reporting levels, and run it on F021 to F024? I will run the program on my validation records before anything goes to the data centre.
Her full mail is in docs/mail/.
You have 50 minutes. Whatever is in /app/output when the time is up is graded, so keep a working program saved as
you go.
In /app/inputs, the archive layout:
optode/<float>_optode.csv: the optode records of every cycle (ascent samples with the CTD temperature and
salinity, and the in-air sequence), optode/<float>_fixes.csv (the surface fix of each cycle) and
optode/calibration/ (the calibration file of each optode).floats/<float>_meta.json: the float metadata records (deployment, missions, firmware, optode and mounting, the
float's engineering-log entries).atmosphere/MetGrid6_2025-2026_6h_2deg.csv: the MetGrid-6 reanalysis extract for the region.docs/: SOP-FP-06 rev 1 (optode gain from in-air measurements), the Gannet note AN-GO4-02, the Petrel-3
integration note PN-311, the Petrel firmware release notes and mail/./app/output/o2gain.py, run as
python3 /app/output/o2gain.py <archive_dir> <float_id> <out.json>
<archive_dir> has the layout above with at least optode/<float_id>_optode.csv, optode/<float_id>_fixes.csv,
the float's calibration file in optode/calibration/, floats/<float_id>_meta.json and the MetGrid-6 file in
atmosphere/. The program writes one JSON object:
{"float": "F021", "gain_at_deployment": 1.0412, "gain_at_deployment_error": 0.0011,
"drift_per_year": 0.0045, "drift_per_year_error": 0.0012,
"cycles": {"1": {"gain": 1.0413, "doxy": {"500": 186.21, "1000": 189.93, "1500": 230.05, "1900": 248.40}},
"2": {...}, ...}}
| Key | Content |
|---|---|
gain_at_deployment |
G0: the true oxygen partial pressure divided by the one the optode reports with its calibration, at the deployment time of the metadata record |
drift_per_year |
D in G(t) = G0 (1 + D t), t in years since deployment (0.0045 is 0.45 % per year) |
..._error |
one-standard-deviation uncertainties of G0 and D |
cycles |
one entry for every cycle in the float's fixes file |
gain |
G of the cycle, at its surfacing time |
doxy |
corrected dissolved oxygen in umol/kg at 500, 1000, 1500 and 1900 dbar sea pressure, where the cycle's profile reached the level |
The program runs with Python 3.12, numpy 2.1.3, scipy 1.14.1, pandas 2.2.3 and gsw 3.6.19, on one CPU core
with 2 GB of memory and no network, and must finish a float within 6 seconds. It is run as another user from a
copy of /app/output: it may load helper files that you put in /app/output (found relative to __file__),
but /app/inputs is not there when it runs.
/app/output/results/<float>.json for each of the four floats (for example /app/output/results/F021.json):
the program's output for that float.
Adaeze runs your program on 36 further float records in the same layout, with the same MetGrid-6 file. They are Petrel-3 lives of the programme's floats and of floats like them, with the optode units, mountings, missions and weather such floats have or can have; the optode gain of every cycle and the oxygen at the reporting levels are known for them. The true gains and oxygen of the four floats in hand are known too, and your result files are compared with them in the same way.
Per float:
| Quantity | Full credit | Zero credit |
|---|---|---|
| gain: root-mean-square over all cycles of (reported / true - 1) (a missing value counts 0.05) | up to 0.10 % | 0.30 % |
| oxygen: root-mean-square over all cycles and the levels each profile reached of (reported / true - 1) (missing counts 0.05) | up to 0.18 % | 0.54 % |
drift: absolute error of drift_per_year |
up to 0.0012 | 0.0036 |
| uncertainty: error of G0 (and of D) in units of the reported uncertainty | up to 2 | 3 |
Credit falls linearly between the two columns.
gain_at_deployment_error is at most 0.3 % of G0 and falls linearly to 0 at 0.6 %.With G, O, D and U the gain, oxygen, drift and uncertainty credits, a float scores 0.35 G + G x (0.35 O + 0.20 D + 0.10 U); on a float where the drift is not scored, it scores 0.35 G + G x (0.35 O + 0.10 U), divided by 0.80. A float on which the program fails, runs out of time or writes no readable JSON scores zero. The final score is 85 % the mean over the 36 further records and 15 % the mean over the four result files.