ctdam.utils module

ctdam.utils.read_event_name(station_string, regex_string='(?P<c>[a-z]{1,3}\\\\d{1,3})(-|_|\\\\/)?(?P<cn>1|2)?(-|_)(?P<s>\\\\d{1,4})(-|_)(?P<e>\\\\d{1,2})')[source]

Parse event name information.

Parameters:
  • station_string (str) – The input string to parse

  • regex_string (str) – The regex to use for parsing

Return type:

Tuple[str, str]

ctdam.utils.create_event_string(cruise, station_event, leading_zeroes=True)[source]

Produce a output event string.

Parameters:
  • cruise (str) – The cruise it belongs to

  • station_event (str) – The event information from read_event_name

  • leading_zeroes (bool) – Whether to save the event info with leading zeroes (Default value = True)

Return type:

str

ctdam.utils.parse_xmlcon_sensor_data(sensor_info)[source]

Parse sensor data from .cnv files.

Parameters:

sensor_info (dict) – The xmltodict output of a .cnv file

Return type:

dict

ctdam.utils.extract_sensor_name(sensors)[source]

Parse sensor data from .xmlcon files.

Parameters:

sensors (dict) – xmltodict parsed .xmlcon data

Return type:

list

ctdam.utils.get_unique_sensor_data(sensor_data)[source]

Returns all the unique sensors and their configuration used in the given collection of sensor data. These will typically be parsed from xml inside .cnv or .xmlcon files. If for example, the first oxygen sensor has been replaced after the 8 cast, then we will see that in the output structure by a seconde tuple, with the number 8 and the individual sensor information for that new oxygen sensor.

Parameters:

sensor_data (list[list[dict]]) – The structure of xml-parsed dicts inside two organizing lists.

Return type:

list[tuple[list[dict]]]

ctdam.utils.sbe_to_decimal(data_str)[source]

Converts NMA Coordinates to Decimal

Return type:

float

exception ctdam.utils.UnexpectedFileFormat(file_type, error)[source]

Bases: Exception