ctdproc.io.CTDHex
- class ctdproc.io.CTDHex(filename)[source]
Bases:
objectConverter for Seabird 9/11 CTD data in hex format.
Parses a Seabird
.hexdata file and its companion.xmlconcalibration file into time series of physical sensor values.- Parameters:
filename (str or pathlib.Path) – Path to the
.hexfile. The matching.xmlconfile must be in the same directory.- Variables:
filename (pathlib.Path) – Path to the source hex file.
cfgp (munch.Munch) – Parsed sensor configuration from the xmlcon file.
dataraw (pandas.DataFrame) – Raw voltage and frequency data.
data (pandas.DataFrame) – Sensor data converted to physical units (populated by
physicalunits()).
Examples
>>> c = CTDHex("path/to/cast.hex") >>> ds = c.to_xarray()
Notes
Outstanding gaps: oxygen hysteresis correction, fluorometer voltage conversion.
Methods
__init__(filename)mattime_to_datetime64(dtnum)Convert Matlab time format to numpy datetime64 time format.
Convert matlab time format to SBE time format.
Parse the hex file into a raw frequency/voltage DataFrame.
Convert raw frequencies and voltages into physical units.
Parse the companion
.xmlconcalibration file intoself.cfgp.Convert SBE time format to matlab time format.
to_mat(matname)Save the converted time series to a MATLAB
.matfile.Convert data into xarray.Dataset.
- parse_hex()[source]
Parse the hex file into a raw frequency/voltage DataFrame.
Reads the binary-encoded sensor words for the five frequency channels (pressure, two temperature, two conductivity), the eight voltage channels, the mod-count, the timestamp, SPAR, ship position, and CTD status into
self.dataraw. Called automatically byphysicalunits().
- physicalunits()[source]
Convert raw frequencies and voltages into physical units.
Applies the calibration coefficients in
self.cfgpto the contents ofself.datarawand stores the result inself.dataas amunch.Munchof named time series: pressure (dbar), temperature (deg C), conductivity (mS/cm), salinity, oxygen (ml/L), altimeter, transmissivity, PAR, SPAR, fluorescence, and time.
- read_xml_config()[source]
Parse the companion
.xmlconcalibration file intoself.cfgp.Locates the xmlcon file alongside the hex file, parses the
SensorArrayblock, and converts coefficient strings to floats. Sensors not in the supported set are skipped.
- to_mat(matname)[source]
Save the converted time series to a MATLAB
.matfile.- Parameters:
matname (str or pathlib.Path) – Output
.matfilename.