Write the processing program of a profiling-float programme that turns full-resolution CTD scans from two float platforms (pumped and unpumped CTDs) into 2-dbar temperature and salinity profiles: surface-pressure correction by firmware, sensor alignment, spike removal, speed-dependent cell thermal-mass correction fitted on descent/ascent pairs, bin averaging; it is run under a time limit on further deliveries with known reference profiles.
harbor run -t reactive-labs/float-ctd-processingharbor download reactive-labs/float-ctd-processingYou are Nadia Ferrand, data analyst in the float programme (BFP) of the Brannock Ocean Institute. The programme runs twelve profiling floats in the eastern subtropical North Atlantic. Eight are Petrel-2 floats with the pumped Fulmar FC-2 CTD. Four are Petrel-3 floats, deployed in 2025 to evaluate the unpumped Skua SK-1 CTD. Every float sends its ascent profile at full resolution, and the Petrel-3s also send the descent that opens each cycle. Today is Tuesday 1 December 2026. Maren Tolliver, the programme lead, wrote this morning:
Since Kristof left at the end of July the full-resolution deliveries still go through his rev 3 script, and everything from the Petrel-3s that has gone into the real-time chain since then is suspect. Please write the processing as one program, to SOP-FP-03 rev 4 as it stands, that takes a delivery folder as the decoder writes it and produces the 2 dbar profiles. Run it on the ten deliveries of the review set. Adaeze will run the program on her validation deliveries before we switch the cron job over, so it has to cope with everything our floats can send, not only what is in these ten.
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:
fullres/: the ten deliveries of the review set. Each folder holds one float's consecutive cycles as the Petrel
decoder writes them (<float>_c<cycle>_asc.prof, on Petrel-3 floats also <float>_c<cycle>_dsc.prof) and the
float's technical messages <float>_tech.csv.docs/: SOP-FP-03 rev 4, the FC-2 application note AN-41, the Petrel-3 integration note PN-311, the SK-1
thermal-inertia note TN-SK1-07, the Petrel firmware release notes, the programme's engineering log, and mail/.legacy/: Kristof Lindqvist's script fr_process.py and his handover note.rt_profiles/, reference/, atmosphere/: other folders of the programme's archive (real-time
profiles, ship CTD reference casts, a weather reanalysis extract)./app/output/ctd_process.py, run as
python3 /app/output/ctd_process.py <delivery_dir> <out.json>
It reads one delivery folder in the format of the ten in hand and writes one JSON object:
{"float": "F017",
"cycles": {"80": {"pressure_correction_dbar": 1.64, "temp": [null, null, 21.0412, ...], "psal": [...]}, ...}}
| Key | Content |
|---|---|
cycles |
one entry per ascent profile in the delivery, keyed by the cycle number as a string |
pressure_correction_dbar |
the value subtracted from the pressure column of that ascent file (dbar) |
temp |
list of 1000 values: element i is the mean in-situ temperature (degC, ITS-90) of bin i, which covers corrected sea pressure from 2i to 2i+2 dbar; null where the bin is not reported |
psal |
list of 1000 values, the practical salinity (PSS-78) of the same bins, computed with the conductivity calibration as delivered (no drift adjustment) |
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 delivery within 18 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/<delivery>.json for each of the ten deliveries in hand (for example
/app/output/results/F017_c080-c084.json): the program's output for that delivery.
Adaeze runs your program on 37 further deliveries from the programme's floats, in the same format, for which reference profiles of the water each ascent sampled are known. They come from both platforms and cover the firmware versions, sampling settings and ascent modes the floats have used since 2023. The ten deliveries in hand have reference profiles too, and your result files are compared with them in the same way.
Each ascent is scored on the bins that it covers completely, from 2 dbar down to 3 dbar above its deepest scan. With
g the reference temperature gradient at a bin (degC/dbar, centred over the neighbouring bins), the bin weighs
1 + g/0.01, and its temperature and salinity errors are divided by the scales
sqrt(0.0005^2 + (0.06 g)^2) degC and sqrt(0.0003^2 + (0.006 g)^2); each scaled error is capped at 10, and a
missing or non-numeric value counts 10, as do all bins of an ascent missing from the output. The weighted
root-mean-squares of the scaled errors over all graded bins of a delivery give its temperature and salinity indices
E_T and E_S.
| Quantity | Full credit | Zero credit |
|---|---|---|
temperature, E_T |
up to 1.07 | 3.21 |
salinity, E_S |
up to 1.10 | 3.30 |
| pressure correction, each ascent | within 0.12 dbar | 0.36 dbar |
Credit falls linearly between the two columns. With the pressure credit averaged over the ascents, a delivery scores 0.45 x salinity + 0.35 x temperature + 0.20 x pressure x salinity. A delivery on which the program fails, runs out of time or writes no readable JSON scores zero. The final score is 80 % the mean over the 37 further deliveries and 20 % the mean over the ten result files.