pelagos_py.steps.processing.mixed_layer_depth#

class pelagos_py.steps.processing.mixed_layer_depth.MixedLayerDepthStep(name, parameters=None, diagnostics=False, context=None)[source]#

Bases: pelagos_py.steps.base_step.BaseStep, pelagos_py.utils.qc_handling.QCHandlingMixin

Calculate the mixed layer depth (MLD) of each profile.

The MLD is found per profile by a threshold method: from a near-surface reference point, the first depth at which the chosen variable departs from its reference value by more than a threshold marks the base of the mixed layer. PROFILE_NUMBER and DEPTH must already be derived.

Two derived variables are written on the N_MEASUREMENTS dimension: MLD, the profile’s mixed layer depth (positive down, matching DEPTH; NaN where undefined), and MLD_BOOL, 0 above the MLD, 1 at/below it, NaN where undefined. Samples whose flags fall in calculation_flag_filter take no part in the search, so a bad value cannot place the MLD; both variables are still written for every measurement in the profile.

The density method uses potential density (sigma0, referenced to 0 dbar) derived here from ABS_SALINITY and CONS_TEMP, not the dataset’s in-situ DENSITY whose pressure term alone crosses a typical threshold within a few metres of the surface. The derived sigma0 is not written to the dataset.

Parameters:
  • method (str, optional) – "density", "temp", or "auto" (default; density if its inputs are present, else temp). An explicit choice whose inputs are missing halts the pipeline.

  • reference_depth (float, optional) – Near-surface reference depth (positive down). Default 10.

  • density_threshold (float, optional) – Density departure (kg/m3) marking the MLD. Default 0.03.

  • temp_threshold (float, optional) – Temperature departure (degC) marking the MLD. Default 0.2.

Examples

steps:
  - name: Mixed Layer Depth
    parameters:
      method: density
      reference_depth: 10
      density_threshold: 0.03
      temp_threshold: 0.2
    diagnostics: true