src.toolbox.steps.custom.profile_direction#
Step for determining glider profile direction.
Classes#
Determine whether water profiles are ascending or descending. |
Module Contents#
- class src.toolbox.steps.custom.profile_direction.ProfileDirection[source]#
Bases:
toolbox.steps.base_step.BaseStep,toolbox.utils.qc_handling.QCHandlingMixinDetermine whether water profiles are ascending or descending.
This step calculates the direction of movement through the water column by analysing the rate of change of pressure with respect to time. The median direction is computed for each profile and stored in a new PROFILE_DIRECTION variable.
- data#
The dataset being processed, updated with PROFILE_DIRECTION and PROFILE_DIRECTION_QC variables.
- Type:
xarray.Dataset
Notes
The profile direction is determined by computing the sign of the pressure gradient (dPRES/dTIME). Negative gradients indicate ascending profiles (pressure decreasing), while positive gradients indicate descending profiles (pressure increasing).
The direction is calculated as:
direction = -1 * sign(dPRES/dTIME)
direction = 1: Ascending profile (pressure decreasing)
direction = -1: Descending profile (pressure increasing)
Examples
In a processing configuration file, use this step as follows:
steps: - name: "Find Profile Direction" parameters: diagnostics: false
- run()[source]#
Execute the profile direction detection algorithm.
Processes the input data to determine whether each measurement point belongs to an ascending or descending profile, then propagates the direction classification to all measurements in each profile.
- Returns:
The updated context dictionary with the processed data containing new PROFILE_DIRECTION and PROFILE_DIRECTION_QC variables.
- Return type:
- Raises:
ValueError – If required variables (PROFILE_NUMBER, PRES, TIME) are missing from the input dataset.
Notes
This method:
Optionally filters QC flags from the data
Subsets data to remove NaN values in key variables
Computes pressure gradient with respect to time
Calculates median direction per profile
Propagates direction to all measurements
Updates QC flags
Generates diagnostics if enabled
- generate_diagnostics()[source]#
Create diagnostic plots of ascending and descending profiles.
Generates a scatter plot showing all measurements coloured by profile direction. Ascending profiles are shown in blue, descending profiles in red. Pressure is plotted against time.
Notes
This method uses Tkinter as the matplotlib backend and requires a display environment. It blocks continued pipeline execution until the plot window is closed.