ctdam.parser.hexfile module

class ctdam.parser.hexfile.HexFile(path_to_file, path_to_xmlcon='', *args, **kwargs)[source]

Bases: DataFile

A representation of a .hex file as used by SeaBird.

When no corresponding .xmlcon file given, a search algorithm is used to determine the matching .xmlcon automatically.

Parameters:
  • path_to_file (Path | str) – The path to the file

  • path_to_xmlcon (Path | str) – An optional path to the corresponding .xmlcon file

get_corresponding_xmlcon(path_to_xmlcon='')[source]

Finds the best matching .xmlcon file inside the same directory.

The logics works as follows:

  • if an .xmlcon of the same name exists, take that

  • else, find all .xmlcons of the same cruise inside the given directory and use the one used by the previous .hex file, sorted by file name.

Parameters:

path_to_xmlcon (Path | str) – A path to an .xmlcon file, if not existent, use the search algorithm

Return type:

XMLCONFile | None