ctdam.proc.modules.seabird_functions module

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

Bases: ArrayModule

Flags pressure loops caused by ship heave.

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 (ndarray) – Array of vertical axis values

  • sample_interval (float) – The interval the data has been sampled with

  • precut_period (int) – Cutoff period for the pressure (Default value = 5)

  • cut_period (int) – Cutoff period for the main filter (Default value = 10)

  • mean_speed_percent (int) – Percentage of filtered velocity to use as a threshold (Default value = 20)

  • delay (int) – Delay (Default value = 2)

  • filter_order (int) – Order of the Butterworth filter (Default value = 4)

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 value = 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 estimate_sensor_delay and returns True, if the result is considered feasible.

Parameters:
  • value (float) – The value to check

  • correlation_value (float) – The correlation value

  • minimum_correlation (float) – The correlation to consider good (Default value = 0.1)

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]

Parse parameter input.

Parameters:

input_dict (dict) – The input arguments

Return type:

dict

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

Bases: ArrayModule

Apply a signal processing filter to certain data columns.

transformation()[source]

Calls window_filter method and handles argument display.

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. (Default value = 1.0)

  • offset (float) – Shifts the center point of the Gaussian. (Default value = 0.0)

  • exclude_flags (bool) – Exclude flagged values from the dataset. (Default value = False)

  • flag_value (float) – The flag value in flags. (Default value = -9.99e-29)

Return type:

ndarray

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

Bases: ArrayModule

Fix cell thermal mass errors of the conductivity sensors.

transformation()[source]

Call Sea-Birds cell-termal-mass function and convert unit.

Return type:

bool

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

Bases: ArrayModule

Bin data points in pressure or time bins.

transformation()[source]

Calls own_bin_average and reset sample rate.

Return type:

bool

own_bin_average(data, bin_variable, bin_size, min_scans=0, 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.

Parameters:
  • data (Dict[str, ndarray]) – The input data

  • bin_variable (str) – The parameter to bin

  • bin_size (float) – The size of the individual bins

  • min_scans (int) – The minimum number of scans per bin (Default value = 1)

  • max_scans (int) – The maximum number of scans per bin (Default value = 999999)

  • cast_type (str) – Downcast, upcast or both (Default value = “down”)

  • flag_value (float) – The value to use as bad flag (Default value = -9.99e-29)

  • include_scan_count (bool) – Whether to create column that holds scan count of each bin (Default value = True)

Return type:

Dict[str, ndarray]