src.toolbox.steps.custom.find_profiles#
Class definition for exporting data steps.
Classes#
Functions#
|
Identifies vertical profiles in oceanographic or similar data by analyzing depth gradients over time. |
Module Contents#
- src.toolbox.steps.custom.find_profiles.find_profiles(df, gradient_thresholds: list, filter_win_sizes=['20s', '10s'], time_col='TIME', depth_col='DEPTH')[source]#
Identifies vertical profiles in oceanographic or similar data by analyzing depth gradients over time.
This function processes depth-time data to identify periods where an instrument is performing vertical profiling based on gradient thresholds. It handles data interpolation, calculates vertical velocities, applies median filtering, and assigns unique profile numbers to identified profiles.
- Parameters:
df (polars.DataFrame) – Input dataframe containing time and depth measurements
gradient_thresholds (list) – Two-element list [positive_threshold, negative_threshold] defining the vertical velocity range (in meters/second) that is NOT considered part of a profile. typical values are around [0.02, -0.02]
filter_win_sizes (list, default= ['20s', '10s']) – Window sizes for the compound filter applied to gradient calculations, in Polars duration format. index 0 controls the rolling median window size and index 1 controls the rolling mean window size.
time_col (str, default='TIME') – Name of the column containing timestamp data
depth_col (str, default='DEPTH') – Name of the column containing depth measurements
- Returns:
Dataframe with additional columns: - ‘dt’: Time difference between consecutive points (seconds) - ‘dz’: Depth difference between consecutive points (meters) - ‘grad’: Vertical velocity (dz/dt, meters/second) - ‘smooth_grad’: Median-filtered vertical velocity - ‘is_profile’: Boolean indicating if a point belongs to a profile - ‘profile_num’: Unique identifier for each identified profile (0 for non-profile points)
- Return type:
polars.DataFrame
Notes
The function considers a point part of a profile when its smoothed vertical velocity falls outside the range specified by gradient_thresholds.
‘depth_col’ does not strictly have to be a depth measurement, any variable which follows the profile shape (such as pressure) could also be used, though this would change the units and interpretation of grad.