ctdam.proc.modules package

Submodules

ctdam.proc.modules.air_pressure_correction module

class ctdam.proc.modules.air_pressure_correction.AirPressureCorrection[source]

Bases: ArrayModule

Corrects water pressure by the given air pressure.

transformation()[source]

Base logic to correct pressure.

Return type:

bool

ctdam.proc.modules.available_modules module

ctdam.proc.modules.available_modules.map_proc_name_to_class(module)[source]

Sets and maps the known processing modules to their respective module classes.

Parameters:

module (str) – Name of the module, that is being used inside the config.

Return type:

Module

ctdam.proc.modules.available_modules.get_list_of_custom_exes(path_to_custom_exe_dir=None)[source]
Return type:

list[str]

ctdam.proc.modules.available_modules.get_list_of_installed_seabird_modules()[source]
Return type:

list[str]

ctdam.proc.modules.available_modules.get_dict_of_available_processing_modules(path_to_custom_exe_dir=None)[source]
Return type:

dict

ctdam.proc.modules.create_bottlefile module

exception ctdam.proc.modules.create_bottlefile.InvalidArgumentCombination[source]

Bases: Exception

Exception raised when an invalid combination of arguments is provided.

class ctdam.proc.modules.create_bottlefile.OwnBtlFile(ctd_data=None, blf=None, path_to_file='')[source]

Bases: DataFile

create_btl()[source]
Return type:

str

ctdam.proc.modules.create_bottlefile.create_bottle_file(input='', arguments={}, output_name='', original_input_path='', **kwargs)[source]

Creates a custom bottle file, given a .cnv and .bl file.

The resulting file strongly adheres to the format of a regular .btl file. Specifically, the header is the same, only the data table features a different format. Its a 11-character wide tsv, as a cnv data table. In contrast to a .btl, only average values are used.

In general, this custom bottle file (.obtl) can be generated at any time during the CTD processing. This improves over the standard Sea-Bird variant that allows this only during .cnv creation using Datcnv. With the .obtl file one can ensure the very same data quality from a .cnv file inside a bottle file.

Return type:

OwnBtlFile | CTDData

ctdam.proc.modules.create_bottlefile.add_whitespace(data, space=11)[source]

ctdam.proc.modules.external_functions module

class ctdam.proc.modules.external_functions.ExternalFunctions(modules)[source]

Bases: UserDict

available_modules()[source]
Return type:

list

functions_of_certain_module(module)[source]
Return type:

dict

get_all_functions()[source]
Return type:

dict

list_of_function_names(module='')[source]
Return type:

list

get_module_functions(module)[source]
Return type:

dict

class ctdam.proc.modules.external_functions.ExternalFunctionInfo(external_function)[source]

Bases: object

run(ctd_data, parameters={})[source]
Return type:

bool

execute_funtion(args, ctd_data, second_sensor=False)[source]
Return type:

bool

create_cnv_metadata(return_value, second_sensor=False)[source]
Return type:

dict

map_parameter(parameter, ctd_data=None)[source]
Return type:

list

parse_docstring(raw_docstring)[source]
class ctdam.proc.modules.external_functions.ExternalFunctionCaller(module, processing_functions)[source]

Bases: ArrayModule

transformation()[source]
Return type:

bool

ctdam.proc.modules.geomar_wildedit module

class ctdam.proc.modules.geomar_wildedit.WildeditGEOMAR[source]

Bases: ArrayModule

Flags outliers in a dataset via standard deviation.

Iterates over blocks of data, calculates mean and standard deviation and flags data outside a pre-set standard deviation window. In contrast to the standard SeaBird processing module, wild_edit, this module uses a sliding window around each data point instead of fixed blocks of data. Additionally, while the SeaBird variant terminates after two fixed cycles of flagging, here we iterate as long as there are bad values found.

transformation()[source]

Selects the appropiate data columns and applies the flagging to each one individually.

Return type:

bool

ctdam.proc.modules.geomar_wildedit.wildedit_geomar(data, flag=array([], shape=(0, 0), dtype=float64), std1=3.0, std2=10.0, window_size=50, minstd=0, **kwargs)[source]

Wild editing filter, addapted from Gerd Krahmann.

Uses a sliding window and repeated flagging loops until no bad values are found.

Parameters:
  • data (ndarray) – The input data array.

  • flag (ndarray) – The data flag array.

  • std1 (float) –

    The standard deviation cutoff for the first flagging loop.

    (Default value = 3.0)

  • std2 (float) –

    The standard deviation cutoff for the all the following loops.

    (Default value = 10.0)

  • window_size (int) –

    The size of the sliding window.

    (Default value = 50)

  • minstd (float) –

    The minimum standard deviation threshold to flag data.

    (Default value = 0)

Return type:

Tuple[ndarray, ndarray]

ctdam.proc.modules.seabird_functions module

class ctdam.proc.modules.seabird_functions.LoopRemoval[source]

Bases: ArrayModule

transformation()[source]

Calls the loop removal function and handles the resulting flag values for array truncation.

Return type:

bool

jens_loop_removal(pressure, sample_interval, precut_period=5, cut_period=10, mean_speed_percent=20, delay=2, filter_order=4)[source]

Flag loops in CTD data caused by ship heave. Credit: Dr. Jens Faber, IOW.

Parameters: - pressure: Array of vertical axis values (e.g., pressure). - time: Array of time values. - precut_period: Cutoff period for the pre-filter (seconds). - cut_period: Cutoff period for the main filter (seconds). - mean_speed_percent: Percentage of filtered velocity to use as a threshold. - delay: Delay (in seconds) to shift the flag array. - filter_order: Order of the Butterworth filter.

Returns: - flag_bool: Boolean array where True indicates a flagged (bad) data point.

class ctdam.proc.modules.seabird_functions.AlignCTD[source]

Bases: ArrayModule

Align the given parameter columns.

Given a measurement parameter in parameters, the column will be shifted by either, a float amount that is given as value, or, by a calculated amount, using cross-correlation between the high-frequency components of the temperature and the target parameters. The returned numpy array will thus feature the complete CnvFile data, with the columns shifted to their correct positions.

transformation()[source]

Performs the base logic of distinguishing whether to use given values or compute a delay.

Return type:

bool

estimate_sensor_delay(delayed_parameter, margin=240, shift_seconds=10)[source]

Estimate delay between a delayed parameter and temperature signals via cross-correlation of high-frequency components.

Parameters:
  • delayed_parameter (Parameter) – The parameter whose delay shall be computed.

  • margin (int) –

    A number of data points that are cutoff from both ends.

    (Default value = 240)

  • shift_seconds (int) – Maximum time window to search for lag (default: 10 seconds).

Return type:

Tuple[float, float]

check_correlation_result(value, correlation_value, minimum_correlation=0.1)[source]

Performs several checks on the delay outputed by self.estimate_sensor_delay and returns True, if the result is considered feasible.

Return type:

bool

find_corresponding_temperature(parameter)[source]

Find the temperature values of the sensor that shared the same water mass as the input parameter.

Parameters:

parameter (Parameter) – The parameter of interest.

Return type:

Parameter

get_correlation(parameter)[source]

Gives a number indicating the cross correlation type regarding the input parameter and the temperature.

Basically distinguishes between positive correlation, 1, and anti- correlation, -1. This value is then used to alter the temperature values accordingly.

Parameters:

parameter (Parameter) – The parameter to cross correlate with temperature.

Return type:

float

handle_parameter_input(input_dict)[source]
Return type:

dict

class ctdam.proc.modules.seabird_functions.WFilter[source]

Bases: ArrayModule

transformation()[source]

Performs the base logic of distinguishing whether to use given values or compute a delay.

Return type:

bool

window_filter(data_in, flags, window_type, window_width, sample_interval, half_width=1.0, offset=0.0, exclude_flags=False, flag_value=-9.99e-29)[source]

Filters a dataset by convolving it with an array of weights.

The available window filter types are boxcar, cosine, triangle, gaussian, and median. Refer to the SeaSoft data processing manual version 7.26.8, page 108.

Parameters:
  • data_in (ndarray) – Data to be filtered.

  • flags (ndarray) – Flagged data defined by loop edit.

  • window_type (str) – The filter type (boxcar, cosine, triangle, gaussian, or median).

  • window_width (int) – Width of the window filter (must be odd).

  • sample_interval (float) – Sample interval of the dataset.

  • half_width (float) – Width of the Gaussian curve.

  • offset (float) – Shifts the center point of the Gaussian.

  • exclude_flags (bool) – Exclude flagged values from the dataset.

  • flag_value (float) – The flag value in flags.

Return type:

ndarray

Returns:

The convolution of data_in and the window filter.

class ctdam.proc.modules.seabird_functions.CellTM[source]

Bases: ArrayModule

transformation()[source]
Return type:

bool

class ctdam.proc.modules.seabird_functions.BinAvg[source]

Bases: ArrayModule

transformation()[source]

Calls the loop removal function and handles the resulting flag values for array truncation.

Return type:

bool

own_bin_average(data, bin_variable, bin_size, min_scans=1, max_scans=999999, cast_type='down', flag_value=-9.99e-29, include_scan_count=True)[source]

Optimized bin average using a vectorized approach on numpy arrays.

Return type:

Dict[str, ndarray]

Module contents