ctdam.conv.cast_borders module

ctdam.conv.cast_borders.smoothing(x)[source]

Basic filtering function for pressure values.

Parameters:

x (ndarray) – The pressure array

Return type:

ndarray

ctdam.conv.cast_borders.get_cast_borders(pressure, downcast_only=True, min_size_factor=0.01, min_soak_window=100, max_fd_quotient=6, prominence_divisor=7, win_size_divisor=500, min_velocity_quotient=15, min_velocity=0.045)[source]

Calculates start and end points of one CTD cast.

Uses first (fd) and second derivatives (sd) for that. Relies on carefully fine-tuned parameters that are set as default values. These can be fit to any kind of CTD data.

Parameters:
  • pressure (ndarray) – Pressure array

  • downcast_only (bool) – Whether to only work with downcast data (Default value = True)

  • min_size_factor (float) – Factor to check final dataset size against (Default value = 0.01)

  • min_soak_window (int) – Downcast_start: minimum size of soaking window (Default value = 100)

  • max_fd_quotient (int) – Downcast_start: Cut-off of fd height (Default value = 6)

  • prominence_divisor (int) – Downcast_start: Minimum size of sd peak prominence (Default value = 7)

  • win_size_divisor (int) – Downcast_start: Search window size to check fd means (Default value = 500)

  • min_velocity_quotient (int) – Downcast_start: Minimum velocity cut-off (Default value = 15)

  • min_velocity (float) – Downcast_start: Minimum velocity cut-off (Default value = 0.045)

Return type:

dict

ctdam.conv.cast_borders.get_downcast_end(smoothed_pressure, first_derivative, second_derivative)[source]

Gets the downcast end point of a given cast.

Either returns the first pressure index, that is 2 dbar below the global pressure maximum or the second derivative maximum between the first derivative minimum and the end point.

Parameters:
  • smoothed_pressure (ndarray) – Filtered pressure array

  • first_derivative (ndarray) – All first derivatives of pressure

  • second_derivative (ndarray) – All second derivatives of pressure

Return type:

int

ctdam.conv.cast_borders.get_downcast_start(first_derivative, second_derivative, base_data_size, min_soak_window=100, max_fd_quotient=6, prominence_divisor=7, win_size_divisor=500, min_velocity_quotient=15, min_velocity=0.045)[source]

Gets the downcast start of a given cast, removing soaking/waiting time.

Returns the index from where the CTD begins to continuously move downward.

Parameters:
  • first_derivative (ndarray) – All first derivatives of pressure

  • second_derivative (ndarray) – All second derivatives of pressure

  • base_data_size (int) – The size of the original pressure array

  • min_soak_window (int) – Minimum size of soaking window (Default value = 100)

  • max_fd_quotient (int) – Cut-off of fd height (Default value = 6)

  • prominence_divisor (int) – Minimum size of sd peak prominence (Default value = 7)

  • win_size_divisor (int) – Search window size to check fd means (Default value = 500)

  • min_velocity_quotient (int) – Minimum velocity cut-off (Default value = 15)

  • min_velocity (float) – Minimum velocity cut-off (Default value = 0.045)

Return type:

Tuple[int, list, list]

ctdam.conv.cast_borders.get_upcast_start(ind_dc_end, smooth_velo)[source]

The start point of the upcast.

Parameters:
  • ind_dc_end (int) – The index of the downcast end point

  • smooth_velo (ndarray) – The filtered pressure array

Return type:

int | None

ctdam.conv.cast_borders.get_upcast_end(ind_dc_end, smooth_velo)[source]

The end point of the upcast.

Parameters:
  • ind_dc_end (int) – The index of the downcast end point

  • smooth_velo (ndarray) – The filtered pressure array

Return type:

int | None