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.

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, line_crs: qgis.core.QgsCoordinateReferenceSystem | None = None) list[tuple[Any, float, float, float, float]]

Project collar points onto section line using spatial optimization.

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, interval: float | None = None) 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.