ctdclient.model.psa module¶
- class ctdclient.model.psa.SeasavePsa(path_to_file)[source]¶
Bases:
PsaFile
Python-internal representation of the Seasave.psa that allows targeted modifications of individual xml parts inside the file.
Specifically, this class has methods to edit: - the custom metadata header, that SeaBird has given the ** prefix - the pre-set depths at which specific bottles are meant to be closed - the xmlcon and new hex paths
- Parameters:
path_to_file (Path | str :) – The path to the Seasave.psa file
- set_metadata_header(metadata_list, header_prompt=False)[source]¶
Creates metadata entries from a list of pre-formated metadata points.
The list is expected to look like this: [‘key0 = value0’, ‘key1 = value1’, …] and will produce header entries that SeaSave understands and will prefix with ‘** ‘.
Additionally, the ‘HeaderChoice’ can be configured by usage of the ‘header_prompt’ parameter. It supports two values, 1, which will prompt the user the currently set metadata header for confirmation. And 2, which is calles ‘autostart’ in this software, as it will start data aquisition upon opening SeaSave. The value 2 skips any confirmation concerning the metadata header and will just use it to produce .hex and .hdr files.
- Parameters:
metadata_list (str :) – A list of metadata points to include in the header.
header_prompt (bool = False:) – Whether to prompt for confirmation on the metadata header.
- map_umlauts_for_seasave(header_line)[source]¶
Basic mapping of all german umlauts to ascii compatible replacements. SeaSave can not handle non-ascii symbols inside of the .psa files.
- Parameters:
header_line (str :) – The metadata header line to ‘sanitize’.
- Return type:
A header line that SeaSave can work with.
- set_bottle_fire_info(bottle_info={}, number_of_bottles=13)[source]¶
Handles automatic bottle firing using pre-set depths.
Takes a dictionary that maps bottle numbers to their specific depth values and uses these to produce the format needed inside the .psa so that the individual bottle closes at the respective depth. All positive numbers are taken as they are, other values (including strings) are mapped to 0, which for SeaSave means no autofiring, but will save the bottle as ‘want to close’. In the bottle firing tab of SeaSave, this results in offering the lowest of these bottle numbers as next to close, when all autofiring bottles are already closed.
Sets all other parameters that are needed for this procedure to work to the needed values.
- Parameters:
bottle_info (dict = {}:) – Bottle number to water depth mapping.
number_of_bottles (int = 13 :) – The number of water bottles that are set up.