sec_interp.core.services package

Submodules

Module contents

Services package for geological data processing.

This package contains service classes that handle specific data processing tasks: - ProfileService: Topographic profile generation - GeologyService: Geological profile generation - StructureService: Structural data projection

class sec_interp.core.services.DrillholeService

Bases: object

Service for processing drillhole data.

process_intervals(collar_points: List[Tuple], collar_layer: qgis.core.QgsVectorLayer, survey_layer: qgis.core.QgsVectorLayer, interval_layer: qgis.core.QgsVectorLayer, collar_id_field: str, use_geometry: bool, collar_x_field: str, collar_y_field: str, line_geom: qgis.core.QgsGeometry, line_start: qgis.core.QgsPointXY, distance_area: qgis.core.QgsDistanceArea, buffer_width: float, section_azimuth: float, survey_fields: Dict[str, str], interval_fields: Dict[str, str]) Tuple[List[GeologySegment], List[Tuple[Any, List[Tuple[float, float]], List[GeologySegment]]]]

Process drillhole interval data and project onto the section.

Calculates trajectories for all collars within the buffer and interpolates geological intervals along those trajectories.

Parameters:
  • collar_points – List of projected collars from project_collars.

  • collar_layer – Original collar vector layer.

  • survey_layer – Survey data vector layer (depth, azimuth, inclination).

  • interval_layer – Geological interval data vector layer.

  • collar_id_field – Attribute field name for drillhole ID.

  • use_geometry – If True, use layer geometry for coordinates.

  • collar_x_field – Attribute field name for X coordinates.

  • collar_y_field – Attribute field name for Y coordinates.

  • line_geom – Geometry of the cross-section line.

  • line_start – Starting point of the cross-section line.

  • distance_area – QGS distance calculation object.

  • buffer_width – Maximum perpendicular distance to include intervals.

  • section_azimuth – The azimuth of the cross-section line.

  • survey_fields – Dictionary mapping standard survey fields to layer fields. Required keys: ‘id’, ‘depth’, ‘azim’, ‘incl’.

  • interval_fields – Dictionary mapping standard interval fields to layer fields. Required keys: ‘id’, ‘from’, ‘to’, ‘lith’.

Returns:

  • geology_segments (List[GeologySegment]): Flat list of all projected intervals.

  • drillhole_traces (List): List of trajectories (hole_id, trace_points, hole_segments).

Return type:

A tuple containing (geology_segments, drillhole_traces)

project_collars(collar_layer: qgis.core.QgsVectorLayer, line_geom: qgis.core.QgsGeometry, line_start: qgis.core.QgsPointXY, distance_area: qgis.core.QgsDistanceArea, buffer_width: float, collar_id_field: str, use_geometry: bool, collar_x_field: str, collar_y_field: str, collar_z_field: str, collar_depth_field: str, dem_layer: qgis.core.QgsRasterLayer | None) List[Tuple[Any, float, float, float, float]]

Project collar points onto section line.

Projects drillhole collars within a specified buffer from the section line onto that line, calculating their distance along the section and elevation.

Parameters:
  • collar_layer – The QGIS vector layer containing drillhole collars.

  • line_geom – The geometry of the cross-section line.

  • line_start – The starting point of the cross-section line.

  • distance_area – The QGS distance calculation object.

  • buffer_width – Maximum perpendicular distance from the line to include collars.

  • collar_id_field – The attribute field name for the drillhole ID.

  • use_geometry – If True, use layer geometry; otherwise use coordinate fields.

  • collar_x_field – The attribute field name for X coordinates.

  • collar_y_field – The attribute field name for Y coordinates.

  • collar_z_field – The attribute field name for elevation (Z).

  • collar_depth_field – The attribute field name for total depth.

  • dem_layer – Digital Elevation Model layer for elevation fallback if Z is missing.

Returns:

(hole_id, dist_along, elevation, offset, depth)
  • hole_id (Any): The unique identifier for the drillhole.

  • dist_along (float): Distance from the start of the section line.

  • elevation (float): Elevation (Z) of the collar.

  • offset (float): Perpendicular distance from the section line.

  • depth (float): Total depth of the drillhole.

Return type:

A list of tuples

class sec_interp.core.services.GeologyService

Bases: object

Service for generating geological profiles.

This service handles the extraction of geological unit intersections along a cross-section line.

generate_geological_profile(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, outcrop_lyr: qgis.core.QgsVectorLayer, outcrop_name_field: str, band_number: int = 1) list[GeologySegment]

Generate geological profile data by intersecting the section line with outcrop polygons.

Extracts geological unit intersections along the cross-section line, calculates elevations from the DEM, and returns a list of segments.

Parameters:
  • line_lyr – The QGIS vector layer representing the cross-section line.

  • raster_lyr – The Digital Elevation Model (DEM) raster layer.

  • outcrop_lyr – The QGIS vector layer containing geological outcrop polygons.

  • outcrop_name_field – The attribute field name for geological unit names.

  • band_number – The raster band to use for elevation sampling (default 1).

Returns:

A list of GeologySegment objects, sorted by distance along the section.

Return type:

GeologyData

Raises:
  • ValueError – If the line layer has no features or invalid geometry.

  • RuntimeError – If the intersection processing fails.

class sec_interp.core.services.ProfileService

Bases: object

Service for generating topographic profiles.

This service handles the extraction of elevation data along a cross-section line by sampling a raster DEM.

generate_topographic_profile(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, band_number: int = 1) list[tuple[float, float]]

Generate topographic profile data by sampling elevation along the section line.

This function returns the profile data as a list of tuples.

Parameters:
  • line_lyr – The cross-section line layer.

  • raster_lyr – The DEM/raster layer for elevation.

  • band_number – Raster band to sample (default: 1).

Returns:

List of (distance, elevation) tuples.

Raises:

ValueError – If line layer has no features or invalid geometry.

class sec_interp.core.services.StructureService

Bases: object

Service for projecting structural measurements onto cross-sections.

This service handles the filtering and projection of structural measurements (dip/strike) onto a cross-section plane to calculate apparent dip.

project_structures(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, struct_lyr: qgis.core.QgsVectorLayer, buffer_m: int, line_az: float, dip_field: str, strike_field: str, band_number: int = 1) list[StructureMeasurement]

Project structural measurements onto the cross-section plane.

This function returns the profile data as a list of StructureMeasurement objects.

Filters structures within a buffer distance of the section line and calculates their apparent dip in the direction of the section.

Parameters:
  • line_lyr – The cross-section line layer.

  • raster_lyr – The DEM raster layer for elevation sampling.

  • struct_lyr – The structural measurements layer (points).

  • buffer_m – Buffer distance in meters to include structures.

  • line_az – Azimuth of the section line in degrees.

  • dip_field – Field name for dip angle.

  • strike_field – Field name for strike angle.

  • band_number – Raster band to sample (default: 1).

Returns:

List of StructureMeasurement objects.

Raises:

ValueError – If line layer has no features or invalid geometry.