OOS Tools#
OOS Despiker Class#
- class pysubsea.oos_tools.OOSDespiker(*, development=None, survey_type=None, pipeline_group=None, group_section_type=None, x, y, window=11)[source]#
Bases:
objectThis class identifies and removes outlier values from survey data using a rolling window Hampel filter algorithm. Outliers are replaced with the median or NaN, preserving the original data alignment and group structure.
- Parameters:
development (array-like, optional) – Development identifier for each survey point. If not provided, a default value is used.
survey_type (array-like, optional) – Survey type for each survey point. If not provided, a default value is used.
pipeline_group (array-like, optional) – Pipeline group for each survey point. If not provided, a default value is used.
group_section_type (array-like, optional) – Group section type for each survey point. If not provided, a default value is used.
x (array-like) – Coordinates associated with the signal for each survey point. These can be either easting values or arc lengths, depending on context.
y (array-like) – Signal values for each survey point. These can be either northing values or curvatures, depending on context.
window (int, optional) – Size of the rolling window for sigma-clipping (default: 11).
Input Parameters#
- OOSDespiker.development#
Development identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSDespiker.survey_type#
Survey types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSDespiker.pipeline_group#
Pipeline group identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSDespiker.group_section_type#
Group section types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSDespiker.x#
Coordinates associated with the signal, supplied as an array-like value and stored as a NumPy array. Required.
- OOSDespiker.y#
Signal values for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSDespiker.window#
Rolling window size for the Hampel filter, supplied as an integer. Optional. Default value is 11.
Despiked Coordinate Outputs#
- OOSDespiker.get_x_y_despike_median_aligned()[source]#
Get the despiked y values (i.e., northings or curvatures) for each survey point. Within the rolling window, the starting point is translated to the origin, and the line joining the starting and ending points is rotated to be horizontal. Returns the median of the x and y values within the window.
- Returns:
np.ndarray – Despiked x values for each survey point.
np.ndarray – Despiked y values for each survey point.
OOS Curvature Class#
- class pysubsea.oos_tools.OOSCurvature(*, development=None, survey_type=None, pipeline_group=None, group_section_type=None, x, y)[source]#
Bases:
objectComputes geometric curvature, arc length, and tangent angle for grouped pipeline survey data.
This class calculates the arc length, tangent angle, and curvature of the pipeline defined by easting and northing coordinates, for each group section. The results are aligned with the original data and are useful for geometric analysis and further signal processing.
- Parameters:
development (array-like, optional) – Development identifier for each survey point. If not provided, a default value is used.
survey_type (array-like, optional) – Survey type for each survey point. If not provided, a default value is used.
pipeline_group (array-like, optional) – Pipeline group for each survey point. If not provided, a default value is used.
group_section_type (array-like, optional) – Group section type for each survey point. If not provided, a default value is used.
x (array-like) – These can be either eastings or anonymised eastings, depending on context.
y (array-like) – These can be either northings or anonymised northings, depending on context.
Input Parameters#
- OOSCurvature.development#
Development identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSCurvature.survey_type#
Survey types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSCurvature.pipeline_group#
Pipeline group identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSCurvature.group_section_type#
Group section types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- OOSCurvature.x#
Easting or anonymised easting coordinates, supplied as an array-like value and stored as a NumPy array. Required.
- OOSCurvature.y#
Northing or anonymised northing coordinates, supplied as an array-like value and stored as a NumPy array. Required.
Geometry Outputs#
- OOSCurvature.get_arc_length()[source]#
Get the arc length of the pipeline.
- Returns:
Arc length for each survey point.
- Return type:
np.ndarray
FFT Smoother Class#
- class pysubsea.oos_tools.FFTSmoother(*, development=None, survey_type=None, pipeline_group=None, group_section_type=None, x, y, cutoff)[source]#
Bases:
objectClass to perform FFT smoothing and spectral analysis on the pipeline survey data, grouped by (development, survey type, pipeline group, group section type).
- Parameters:
development (array-like, optional) – Development identifier for each survey point. If not provided, a default value is used.
survey_type (array-like, optional) – Survey type for each survey point. If not provided, a default value is used.
pipeline_group (array-like, optional) – Pipeline group for each survey point. If not provided, a default value is used.
group_section_type (array-like, optional) – Group section type for each survey point. If not provided, a default value is used.
x (array_like, mandatory) – Coordinates associated with the signal for each survey point. These can be either anonymised easting values or arc lengths, depending on context.
y (array_like, mandatory) – Signal values for each survey point. These can be either anonymised northing values or curvatures, depending on context.
cutoff (float or None, mandatory) – Wavelength or curvature cutoff for FFT filtering. If None, no filtering is applied.
Input Parameters#
- FFTSmoother.development#
Development identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- FFTSmoother.survey_type#
Survey types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- FFTSmoother.pipeline_group#
Pipeline group identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- FFTSmoother.group_section_type#
Group section types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- FFTSmoother.x#
Coordinates associated with the signal, supplied as an array-like value and stored as a NumPy array. Required.
- FFTSmoother.y#
Signal values for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- FFTSmoother.cutoff#
Cutoff used for FFT filtering, supplied as a numeric value or None. Required. A value of None disables filtering.
Smoothed Signal Outputs#
Frequency Spectrum Outputs#
- FFTSmoother.get_freqs()[source]#
Get the filtered frequency values.
- Returns:
Filtered frequency values for each survey point.
- Return type:
np.ndarray
- FFTSmoother.get_fft()[source]#
Get the filtered FFT values.
- Returns:
Filtered FFT values for each survey point.
- Return type:
np.ndarray
Power Spectral Density Outputs#
- FFTSmoother.get_psd_development()[source]#
Get the PSD development arrays.
- Returns:
PSD development arrays for each group.
- Return type:
list
- FFTSmoother.get_psd_survey_type()[source]#
Get the PSD survey type arrays.
- Returns:
PSD survey type arrays for each group.
- Return type:
list
- FFTSmoother.get_psd_pipeline_group()[source]#
Get the PSD pipeline group arrays.
- Returns:
PSD pipeline group arrays for each group.
- Return type:
list
- FFTSmoother.get_psd_group_section_type()[source]#
Get the PSD group section type arrays.
- Returns:
PSD group section type arrays for each group.
- Return type:
list
Reconstructed Coordinate Outputs#
Gaussian Smoother Class#
- class pysubsea.oos_tools.GaussianSmoother(*, development=None, survey_type=None, pipeline_group=None, group_section_type=None, x, y, bandwidth)[source]#
Bases:
objectClass to perform Gaussian kernel smoothing on the pipeline survey, grouped by (development, survey type, pipeline group, group section type).
- Parameters:
development (array-like, optional) – Development identifier for each survey point. If not provided, a default value is used.
survey_type (array-like, optional) – Survey type for each survey point. If not provided, a default value is used.
pipeline_group (array-like, optional) – Pipeline group for each survey point. If not provided, a default value is used.
group_section_type (array-like, optional) – Group section type for each survey point. If not provided, a default value is used.
x (array-like) – Anonymised eastings for each survey point.
y (array-like) – Anonymised northings for each survey point.
bandwidth (float) – Bandwidth for the Gaussian kernel.
Input Parameters#
- GaussianSmoother.development#
Development identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- GaussianSmoother.survey_type#
Survey types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- GaussianSmoother.pipeline_group#
Pipeline group identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- GaussianSmoother.group_section_type#
Group section types for each survey point, supplied as an array-like value and stored as a NumPy array. Optional. Defaults to
Predefinedfor every point when omitted.
- GaussianSmoother.x#
Anonymised easting coordinates, supplied as an array-like value and stored as a NumPy array. Required.
- GaussianSmoother.y#
Anonymised northing coordinates, supplied as an array-like value and stored as a NumPy array. Required.
- GaussianSmoother.bandwidth#
Bandwidth input for the Gaussian kernel, supplied as a numeric value. Required.
Smoothed Signal Outputs#
OOS Anonymisation Class#
- class pysubsea.oos_tools.OOSAnonymisation(*, route_development, route_pipeline_group, route_pipeline, route_kp_from, route_kp_to, route_pipeline_section_type, route_curve_radius, survey_development, survey_type, survey_pipeline_group, survey_pipeline, survey_kp, survey_easting, survey_northing)[source]#
Bases:
objectProcessor for Out-Of-Straightness (OOS) pipeline survey and route data. Provides methods for cleaning, sectioning, and coordinate normalization. All input arrays (parameters) are converted to NumPy arrays and stored as attributes. Additional attributes are initialized as NumPy arrays and will be populated by processing methods.
- Parameters:
route_development (np.ndarray) – Development identifiers for each route section.
route_pipeline_group (np.ndarray) – Pipeline group identifiers for each route section.
route_pipeline (np.ndarray) – Pipeline identifiers for each route section.
route_kp_from (np.ndarray) – Start KP (kilometer point) for each route section.
route_kp_to (np.ndarray) – End KP (kilometer point) for each route section.
route_pipeline_section_type (np.ndarray) – Section type (e.g., ‘Straight’, ‘Curve’, etc.) for each route section.
route_curve_radius (np.ndarray) – Design curve radius for each route section.
survey_development (np.ndarray) – Development identifiers for each survey point.
survey_type (np.ndarray) – Survey type for each survey point.
survey_pipeline_group (np.ndarray) – Pipeline group identifiers for each survey point.
survey_pipeline (np.ndarray) – Pipeline identifiers for each survey point.
survey_kp (np.ndarray) – KP (kilometer point) for each survey point.
survey_easting (np.ndarray) – Easting coordinate for each survey point.
survey_northing (np.ndarray) – Northing coordinate for each survey point.
Input Parameters#
- OOSAnonymisation.route_development#
Development identifiers for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_pipeline_group#
Pipeline group identifiers for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_pipeline#
Pipeline identifiers for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_kp_from#
Start chainage for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_kp_to#
End chainage for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_pipeline_section_type#
Section type for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.route_curve_radius#
Design curve radius for each route section, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_development#
Development identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_type#
Survey type for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_pipeline_group#
Pipeline group identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_pipeline#
Pipeline identifiers for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_kp#
Chainage for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_easting#
Easting coordinates for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
- OOSAnonymisation.survey_northing#
Northing coordinates for each survey point, supplied as an array-like value and stored as a NumPy array. Required.
Processing#
Call process before retrieving processed survey outputs. Its anonymise
argument controls whether the additional cleaning and grouping steps run.
Route Data Outputs#
- OOSAnonymisation.get_route_development()[source]#
Get development identifiers for each route section.
- Returns:
Development identifiers for each route section.
- Return type:
np.ndarray
- OOSAnonymisation.get_route_pipeline_group()[source]#
Get pipeline group identifiers for each route section.
- Returns:
Pipeline group identifiers for each route section.
- Return type:
np.ndarray
- OOSAnonymisation.get_route_pipeline()[source]#
Get pipeline identifiers for each route section.
- Returns:
Pipeline identifiers for each route section.
- Return type:
np.ndarray
- OOSAnonymisation.get_route_kp_from()[source]#
Get start KP (kilometer point) for each route section.
- Returns:
Start KP (kilometer point) for each route section.
- Return type:
np.ndarray
- OOSAnonymisation.get_route_kp_to()[source]#
Get end KP (kilometer point) for each route section.
- Returns:
End KP (kilometer point) for each route section.
- Return type:
np.ndarray
Survey Data Outputs#
- OOSAnonymisation.get_survey_development()[source]#
Get development identifiers for each survey point.
- Returns:
Development identifiers for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_type()[source]#
Get survey type for each survey point.
- Returns:
Survey type for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_pipeline_group()[source]#
Get pipeline group identifiers for each survey point.
- Returns:
Pipeline group identifiers for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_pipeline()[source]#
Get pipeline identifiers for each survey point.
- Returns:
Pipeline identifiers for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_kp()[source]#
Get KP (kilometer point) for each survey point.
- Returns:
KP (kilometer point) for each survey point.
- Return type:
np.ndarray
Survey Section Outputs#
- OOSAnonymisation.get_survey_section_type()[source]#
Get section type (‘Straight’, ‘Curve’, etc.) for each survey point.
- Returns:
Section type for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_section_no()[source]#
Get section number for each survey point.
- Returns:
Section number for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_section_kp_mod()[source]#
Get section-modified KP for each survey point.
- Returns:
Section-modified KP for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_section_easting_mod()[source]#
Get section-modified easting coordinates for each survey point.
- Returns:
Section-modified easting coordinates for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_section_northing_mod()[source]#
Get section-modified northing coordinates for each survey point.
- Returns:
Section-modified northing coordinates for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_feature()[source]#
Get feature label (e.g., ‘PWMD’, ‘LBMD’, ‘ILT’) for each survey point.
- Returns:
Feature label for each survey point.
- Return type:
np.ndarray
Survey Group Outputs#
These outputs are populated by process(anonymise=True).
- OOSAnonymisation.get_survey_group_section_no()[source]#
Get group section number for each survey point.
- Returns:
Group section number for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_group_section_type()[source]#
Get group section type for each survey point.
- Returns:
Group section type for each survey point.
- Return type:
np.ndarray
- OOSAnonymisation.get_survey_group_section_kp_mod()[source]#
Get group section-modified KP for each survey point.
- Returns:
Group section-modified KP for each survey point.
- Return type:
np.ndarray