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 info

  • rule (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

  1. a time elapsed one, counting the seconds from the cast start,

  2. a unix timestamp.

Parameters:
  • gap_sizes (dict) – A dictionary with the indices and sizes of time gaps

  • hex (HexFile) – A .hex file to get the cast start time

  • data_size (int) – The size of the data, to enable skipping of upcast time gaps

  • parameters (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:
  1. Reads raw data from .hex file

  2. Converts that using calibration information from a corresponding

    .xmlcon file

  3. Fixes the time array (filling time gaps)

  4. Determines cast start and end points

  5. Adds Location and Flag columns

  6. Writes conversion metadata to a structure that resembles .cnv

    file format

Parameters:
  • hex (HexFile | Path | str) – The .hex file to convert

  • xmlcon (XMLCONFile | Path | str) – The corresponding .xmlcon file, if blank, the HexFile will try to it itself

  • downcast_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:

CTDData