ctdam.parser.xmlfiles module

class ctdam.parser.xmlfiles.XMLFile(path_to_file)[source]

Bases: UserDict

Parent class for XML and psa representation that loads XML as a python-internal tree and as a dict.

to_xml(file_name=None, file_path=None)[source]

Writes the dictionary to xml.

Parameters:
  • file_name (str) – the original files name (Default value = self.file_name)

  • file_path (pathlib.Path) – the directory of the file (Default value = self.file_dir)

to_json(file_name=None, file_path=None)[source]

Writes the dictionary representation of the XML input to a json file.

Parameters:
  • file_name (str) – the original files name (Default value = self.file_name)

  • file_path (pathlib.Path) – the directory of the file (Default value = self.file_dir)

class ctdam.parser.xmlfiles.XMLCONFile(path_to_file)[source]

Bases: XMLFile

A representation of a Sea-Bird .XMLCON file.

read_xml_config()[source]

Parse the companion .xmlcon calibration file into self.cfgp.

Locates the xmlcon file alongside the hex file, parses the SensorArray block, and converts coefficient strings to floats. Sensors not in the supported set are skipped.

xml_coeffs_to_float(cfgp)[source]

Returns float-parsed xml coefficients.

get_sensor_info()[source]

Creates a multilevel dictionary, dropping the first four dictionaries, to retrieve pure sensor information.

Return type:

list[dict]

class ctdam.parser.xmlfiles.PsaFile(path_to_file)[source]

Bases: XMLFile

A representation of a .psa file.