ctdam.parser.ctddata module¶
- class ctdam.parser.ctddata.CTDData(parameters, metadata_source, processing_steps=[])[source]¶
Bases:
objectClass to store data and metadata representing one single CTD cast in.
Is meant to work as single exchange format for CTD data. At the moment, Sea-Birds .hex and .cnv file can be parsed in this format, but other CTD data formats are meant to follow. From this class, several output options are possible, at the moment, the .cnv format is the only one available.
- Parameters:
parameters (
Parameters) – A parameters instance holding all data valuesmetadata_source (
HexFile|CnvFile) – Source file informationprocessing_steps (
CnvProcessingSteps) – The processing history of the file upon creation (Default: empty)
- parameters[source]¶
All data inside individual Parameter instances. All attributes and methods can be accessed directly.
- Type:
- metadata_source[source]¶
The complete parent file the data is parsed from. All attributes and methods can be accessed directly.
- process(proc_settings={'modules': {'alignctd': {}, 'binavg': {}, 'celltm': {}, 'wfilter': {}, 'wildedit_geomar': {}}, 'output_type': 'internal', 'remove_flags': False})[source]¶
Applies a processing workflow to this CTD data.
- Parameters:
proc_settings (
dict) – A processing workflow that can be parsed by ctdam.proc.Procedure
- plot(*args, **kwargs)[source]¶
Plots this CTD Data.
- Parameters:
'ctdam.vis.visualize.basic_bokeh_plot' (Will be passed to)
print_plot (bool) – Whether to save the plot to disk (Default value = False)
output_name (str) – The name of the output file (Default value = “”)
output_directory (Path | str) – The directory to store the output file in (Default value = “”)
metadata (bool) – Whether to save metadata in the file (Default value = True)
show_plot (bool) – Whether to open the plot in a browser (Default value = True)
y_axis_params (list[str] :) – Possible parameters for the y axis
config_path (Path | str) – The path to the config file (Default value = “vis_config.toml”)
- get_cast_borders_dict()[source]¶
Parses the cast border information into a manageable format.
- Return type:
dict
- update_salinity()[source]¶
Re-calculate the salinity values.
During processing, the conductivity, pressure and temperature values may change. In order to use this upgraded information in depending parameters, they need to be re-calculated.
- array2cnv(parameters=None, bad_flag=-9.99e-29)[source]¶
Parse the numpy array data into .cnv data format.
- Parameters:
parameters (
Parameters|None) – A specific parameters instance or self.parametersbad_flag – The value to use to indicate bad values (Default value = -9.990e-29)
- Return type:
list
- parse_output_sensor_info()[source]¶
Recreate the sensor information of a .cnv file.
- Return type:
list
- get_processing_info()[source]¶
Return processing information.
Does add hex2py metadata if no conversion information present.
- Return type:
list
- create_header(parameters=None, reduced_header=False)[source]¶
Re-creates the .cnv header.
- Parameters:
parameters (
Parameters|None) – A specific parameters instance or self.parametersreduced_header (
bool) – Whether to build a streamlined non-cnv header (Default value = False)
- Return type:
list
- extra_data_table_desc(data_table_description, system_utc)[source]¶
A helper method for .cnv header generation.
- Parameters:
data_table_description (
list) – Data table information from parameterssystem_utc (
str) – The system time
- Return type:
list
- drop_flagged_rows(parameters=None)[source]¶
Remove data rows that are flagged bad and the flag column.
- Parameters:
parameters (
Parameters|None) – A specific parameters instance or self.parameters
- pick_output_columns(parameters, mode='all')[source]¶
Define the parameter columns to output.
- Parameters:
parameters (
Parameters) – A specific parameters instance or self.parametersmode (
list[str] |Literal['all','default']) – List of output parameters, or descriptors ‘all’ or ‘default’ (Default value = “all”)
- to_cnv(file_path='', remove_flags=True, output_parameters='all', reduced_header=False, bad_flag=-9.99e-29)[source]¶
Writes the data and metadata inside of this instance as new .cnv file to disk.
- Parameters:
file_path (
Path|str) – Path to the new .cnv file, will default to the input file nameremove_flags (
bool) – Whether to remove flagged rows (Default value = True)output_parameters (
list[str] |Literal['all','default']) – Which parameter columns to output (Default value = “all”)reduced_header (
bool) – Whether to output a reduced head (Default value = False)bad_flag (
float) – The value to use as bad value indicator (Default value = -9.990e-29)