How calibration comments are read
Each sensor’s serial number and calibration date come from a basestation calibration comment:
a sg_cal_calibcomm* variable, set in sg_calib_constants.m. The comments are typed by the
glider operator, not written by the basestation, so their format varies from mission to mission.
This page states the rules the converter uses to read them, and lists every comment it is tested
against, so you can check how yours will be read.
Where the comments come from
Each sensor key in the basestation instrument global is matched to a comment variable:
sg_cal_calibcomm_<key>(for examplesg_cal_calibcomm_coda);sg_cal_calibcommfor the CTD;sg_cal_calibcomm_oxygenorsg_cal_calibcomm_optodefor an oxygen sensor;sg_cal_calibcomm_wetlabsfor a WET Labs sensor.
The first dive with a comment is used. When that comment gives no serial number or no date and
a later dive’s comment does, without contradicting it (a different serial number, or a different
date), the value is taken from the later dive, and the sensor’s comment says which file and
comment it came from. Comments that give different values on different dives
are reported in the log. In the OG1 file, the SENSOR_* variable carries:
sensor_serial_numberThe serial number, or
UNKwhen it was not read.sensor_calibration_dateISO
YYYY-MM-DD, orUNK. For a comment with one date per channel, the latest.sensor_calibration_datesEvery channel date,
"<channel>: <YYYY-MM-DD>"joined by"; "(RBR comments only).original_calibcommThe comment exactly as written in the basestation file.
The conversion_sensor_calibration global records, per SENSOR_* variable, the basestation
variable the comment came from, the serial and date rules that read it, and any note. The
conversion page shows these in its Calibration comments table.
Serial number
The rules are tried in this order; the first that matches is used. The serial is kept as an
identifier: letters and dashes are not removed (25281-1, F0012). A model number before
the label is not the serial (SBE 43F s/n 005 reads 005).
Rule |
What it reads |
|---|---|
|
the token after s/n, S/N, sn, SN:, SN (glued), serial, serial #, serialnum: |
|
SBE#<serial>t<n>/c<n>: the CT serial; the T/C sensor pair is not part of it |
|
SBE t<n>/c<n>: a T/C sensor pair and no CT serial (UNK) |
|
the token after SBE when there is no label |
|
the whole comment is one token (it may be a model number) |
|
no serial in the comment (UNK) |
Calibration date
The date must come directly after cal, CAL:, calibration or calibrated; only a
serial label with its number (SN 1234), punctuation and the words on or date may stand
between them. A date later in the comment (recal due 2013-08-12) is not read, and
calibration was done 12 Aug 2011 gives UNK.
Dates with the year first (2012-05-12, 2012/05/12, 2012.05.12) have one reading.
Dates with the month as a word have one reading too, with the day or the month first
(May 12, 2012): 04FEB08, 15sep08, 12 Aug 01,
27 Feb 2025, 26 sept 07, 10 june 08, 24-May-17, 31-May-2017. RBR comments
give one ISO date per channel (temp15:2025-02-26T13:58:29Z doxy24:2025-03-20T11:45:16Z).
All-numeric dates can have more than one reading. The converter lists the readings the shape allows and keeps those that are calendar dates on or before the mission’s first sample and at most 30 years before it:
Shape |
Readings |
When more than one fits |
|---|---|---|
|
month first, day first |
month first ( |
|
day first, month first |
day first ( |
8 digits |
|
|
6 digits |
|
|
When only one reading fits, it is used, and the note says why the other was rejected. For
example 251114 on a mission whose first sample is 15 August 2015 reads 25 November 2014,
because the other reading (14 November 2025) is after the first sample. When the preferred
reading is not a calendar date, the other is used (28/4/08 is 28 April; 05.25.2012 is
25 May). Check original_calibcomm when a date matters: the preference is a convention, not
something the comment says. A two-digit year takes
the latest century that does not put it after the first sample.
The first sample is the earliest start_time global across the dive files.
A comment that matches none of these gives UNK with a note. The numbers after a serial
label (s/n, SN) are never read as a date.
Checks
The converter keeps what the comment says, and flags:
a calibration date after the mission’s first sample (a calibration cannot postdate the data it calibrated), or more than 30 years before it — in the log, in the sensor’s
commentand on the conversion page;two sensors with the same serial number (usually a comment copied from another instrument) — in the log and on the conversion page;
a serial number read from a comment that is a single token with no label (it may be a model number) — on the conversion page;
an all-numeric date with two readings, chosen by the convention above — in the log and on the conversion page;
two sensors that would get the same
SENSOR_*name (for example two fluorometers with no serial) — in the log; the second is written with its sensor key appended (SENSOR_FLUOROMETER_UNK_wlbb2fl) rather than overwriting the first.
The conversion_sensor_calibration record also stores the window (window_years) and the
first sample used, so the date choice can be reconstructed from the file.
A value corrected with sensors: (below) clears the flag on the conversion page.
If yours is not read correctly
Correct the serial number or calibration date with sensors: in mission.yaml (see
mission.yaml reference). For example, on the sg271 sample the RBR tridente comment carries the RBR
coda’s serial number:
sensors:
tridentebb700chla470fdom365:
serial_number: "237998"
The correction replaces the serial number; original_calibcomm still holds the comment as
written. To have a new comment format read, open an issue with the comment text and what it
means; it becomes a row in the table below.
Every comment the parser is tested against
The rows below are tests/data/calibcomm_answers.csv: each comment, what it means, and the
first-sample date the test uses. The expected values were read from the string, or decided by
the maintainers where the string is ambiguous.
As written |
Serial |
Serial rule |
Calibration date |
Date rule |
First sample |
Note |
|---|---|---|---|---|---|---|
|
25281-1 |
label |
2001-08-12 |
dd Mon yy |
2003-10-02 |
— |
|
29613 |
SBE#-tc |
2002-09-07 |
dd Mon yy |
2003-10-02 |
serial is the CT number; t1/c1 (T and C sensor pair) not part of it |
|
005 |
label |
2008-02-09 |
ddMonyy |
2008-06-06 |
— |
|
24520-1 |
SBE-token |
2008-02-04 |
ddMonyy |
2008-06-06 |
— |
|
042 |
label |
2008-04-05 |
ddMonyy |
2008-11-06 |
— |
|
0021 |
SBE-token |
2008-09-15 |
ddMonyy |
2008-11-06 |
lower-case month |
|
042 |
label |
2008-04-05 |
ddMonyy |
2009-08-29 |
— |
|
0015 |
SBE-token |
2008-04-28 |
mm/dd/yy |
2009-08-29 |
unambiguous month-first numeric date (28 > 12), hand-typed by the operator |
|
F0012 |
label |
2002-08-27 |
dd Mon yy |
2003-10-02 |
letter in serial |
|
24520 |
SBE#-tc |
2001-04-05 |
dd Mon yy |
2003-10-02 |
as sg004: t4/c4 not part of the serial |
|
0036 |
label |
2006-05-13 |
ddMonyy |
2007-08-31 |
— |
|
0013 |
label |
2007-06-01 |
ddMonyy |
2007-08-31 |
— |
|
033 |
label |
2004-01-15 |
ddMonyy |
2004-09-24 |
— |
|
UNK |
tc-only |
2003-12-12 |
ddMonyy |
2004-09-24 |
only a T/C sensor pair; no CT serial |
|
0043 |
bare-token |
UNK |
none |
2008-02-14 |
bare token taken as the serial (may be a model number); no date |
|
0019 |
label |
2007-09-26 |
dd Mon yy |
2008-02-14 |
4-letter month ‘sept’ |
|
0088 |
bare-token |
UNK |
none |
2008-08-29 |
bare token taken as the serial (may be a model number); no date |
|
0025 |
label |
2008-06-10 |
dd Mon yy |
2008-08-29 |
full month name |
|
041 |
label |
2004-01-22 |
ddMonyy |
2004-09-24 |
— |
|
UNK |
tc-only |
2003-12-30 |
ddMonyy |
2004-09-24 |
only a T/C sensor pair; no CT serial |
|
042 |
label |
2004-09-25 |
ddMonyy |
2005-04-06 |
— |
|
UNK |
tc-only |
2004-10-18 |
ddMonyy |
2005-04-06 |
only a T/C sensor pair; no CT serial |
|
042 |
label |
2006-02-17 |
ddMonyy |
2006-11-12 |
— |
|
0015 |
SBE-token |
2006-01-25 |
ddMonyy |
2006-11-12 |
— |
|
029 |
label |
2007-04-10 |
ddMonyy |
2007-11-13 |
— |
|
0013 |
SBE-token |
2007-02-21 |
ddMonyy |
2007-11-13 |
— |
|
103 |
label |
2008-04-02 |
ddMonyy |
2008-06-07 |
— |
|
0088 |
SBE-token |
2008-03-23 |
ddMonyy |
2008-06-07 |
— |
|
103 |
label |
2008-04-02 |
ddMonyy |
2009-06-05 |
— |
|
0093 |
SBE-token |
2008-06-30 |
ddMonyy |
2009-06-05 |
— |
|
182 |
label |
2009-05-09 |
ddMonyy |
2010-05-18 |
‘calibrated’ keyword; model 4330F is not the serial |
|
0112 |
label |
2009-04-20 |
ddMonyy |
2010-05-18 |
— |
|
182 |
label |
2009-05-09 |
ddMonyy |
2010-09-03 |
— |
|
0112 |
label |
2009-04-20 |
ddMonyy |
2010-09-03 |
— |
|
4746 |
label |
2017-05-24 |
dd-Mon-yy |
2022-07-18 |
‘SN’ glued to digits; ‘cal’ keyword |
|
453 |
label |
2017-05-31 |
dd-Mon-yyyy |
2022-07-18 |
‘SN:’ with colon |
|
0292 |
label |
2017-03-17 |
dd-Mon-yy |
2022-07-18 |
— |
|
029 |
label |
2004-06-16 |
ddMonyy |
2006-11-12 |
— |
|
0021 |
label |
2004-06-07 |
ddMonyy |
2006-11-12 |
— |
|
029 |
label |
2007-05-07 |
ddMonyy |
2007-06-09 |
— |
|
0021 |
label |
2007-04-15 |
ddMonyy |
2007-06-09 |
— |
|
0061 |
bare-token |
UNK |
none |
2008-11-08 |
bare token taken as the serial (may be a model number); no date |
|
19 |
label |
2008-09-10 |
mm/dd/yy |
2008-11-08 |
month-first rule: 10 Sep (day-first 9 Oct); both precede the 8 Nov dive, so the guard cannot decide |
|
043 |
label |
2004-06-16 |
ddMonyy |
2006-11-12 |
— |
|
0022 |
label |
2004-06-07 |
ddMonyy |
2006-11-12 |
— |
|
251 |
label |
2012-08-29 |
ddmmyyyy |
2015-08-15 |
8 digits, day-first; last four a year |
|
0135 |
label |
2014-11-25 |
ddmmyy |
2015-08-15 |
ddmmyy; yymmdd would give 2025-11-14, after the first dive (2015-08-15T14:08:40Z), so ruled out by the dive-date guard |
|
238007 |
label |
2025-02-27 |
dd Mon yyyy |
2026-03-02 |
— |
|
237790 |
label |
2025-03-11 |
rbr-iso |
2026-03-02 |
backscatter_00: 2025-02-26; chlorophyll_00: 2025-03-11; fdom_00: 2025-03-11; tridente serial is the coda’s; the sg271 mission.yaml corrects it to 237998 |
|
237790 |
label |
2025-03-20 |
rbr-iso |
2026-03-02 |
temp15: 2025-02-26; doxy24: 2025-03-20 |