ctdam.parser.casts module¶
- class ctdam.parser.casts.Casts(path_to_data='', ctd_data=[], processing_info={}, pattern='', plot=False, show_plot=True, plot_dir='htmls')[source]¶
Bases:
UserListA structure to ease working with multiple ctd casts.
Can work with ascii files, converted (.cnv) or non-converted (.hex), as well as data within python objects (CTDData). Automates the very basic actions ussually performs on these data: converting, processing, plotting and exporting. The cpu-heavy actions (convertion and processing) are calculated in parallel, using multithreading.
- Parameters:
path_to_data (
Path|str) – Path to target filesctd_data (
list[CTDData]) – A list of target CTDData objectsprocessing_info (
dict) – Processing configurationpattern (
str) – A file pattern to filter the target files withplot (
bool) – Whether to create .html plots of the target filesshow_plot (
bool) – Whether to display the plots in a browserplot_dir (
Path|str) – The directory to store the plots in
- convert(file)[source]¶
Converts .hex files.
Can work with hex2py processing settings and hides all warnings.
- Parameters:
file (
Path) – Path to target file
- check_converted_data()[source]¶
Basic output data size check.
Catches very obvious test or wrong CTD data. These are saved in an anomalies attribute to allow human intervention.
- Return type:
list[CTDData]
- read_sensor_info()[source]¶
Parses all sensor metadata in one structure.
Usually, the sensor layout does not change during one cruise. But if it does, this function should detect that change and document it with a new list that displays the cast number and the differing sensor metadata.
- process(processing_info, target_files=[])[source]¶
Applies the given processing workflow to all CTD data.
Uses multiprocessing for parallel processing and tqdm to display the progress.
- Parameters:
processing_info (
dict) – The processing workflow informationtarget_files (
list[CTDData]) – The target files to process, if none, uses self.data (Default value = [])