ctdam.conv.hexdecoder module¶
- ctdam.conv.hexdecoder.hex_reading(hex)[source]¶
Converts raw data from a .hex file to structured raw data.
These can then be converted to physical values with calibration coefficients.
- Parameters:
hex (
HexFile) – Input .hex file to read raw CTD data from- Return type:
DataFrame
- ctdam.conv.hexdecoder.sorting_parameters(sensor_info, rule=['Pressure', 'Temperature', 'Temperature2', 'Conductivity', 'Conductivity2'])[source]¶
Brings sensor data from an .xmlcon file in a pre-definded order.
This ensures the correct conversion order, for parameters that depend on others, like salinity or oxygen. The default list is not meant to be changed.
- Parameters:
sensor_info (
list) – The parsed .xmlcon inforule (
list) – A list defining the initial conversion order of certain parameters
- Return type:
list
- ctdam.conv.hexdecoder.get_time_gaps(raw_data)[source]¶
Detect missing data points in the raw CTD data.
- Parameters:
raw_data (
DataFrame) – Pandas DataFrame holding the structured CTD raw data- Return type:
dict
- ctdam.conv.hexdecoder.handle_time(gap_sizes, hex, data_size, parameters)[source]¶
Fills data gaps and creates correct time arrays.
Data gaps are filled with NaNs. Time array created are
a time elapsed one, counting the seconds from the cast start,
a unix timestamp.
- Parameters:
gap_sizes (
dict) – A dictionary with the indices and sizes of time gapshex (
HexFile) – A .hex file to get the cast start timedata_size (
int) – The size of the data, to enable skipping of upcast time gapsparameters (
Parameters) – Parameters object to create the time arrays in
- ctdam.conv.hexdecoder.decode_hex(hex, xmlcon='', downcast_only=True, **kwargs)[source]¶
Orchestrates the conversion of CTD data from a .hex file.
- Runs the following steps:
Reads raw data from .hex file
- Converts that using calibration information from a corresponding
.xmlcon file
Fixes the time array (filling time gaps)
Determines cast start and end points
Adds Location and Flag columns
- Writes conversion metadata to a structure that resembles .cnv
file format
- Parameters:
hex (
HexFile|Path|str) – The .hex file to convertxmlcon (
XMLCONFile|Path|str) – The corresponding .xmlcon file, if blank, the HexFile will try to it itselfdowncast_only (
bool) – Whether to only convert downcast data (Default value = True)**kwargs – These options will be parsed to the cast border detection logic
- Return type: