sec_interp.core.services.drillhole_service module

Drillhole Data Processing Service.

Service for processing and projecting drillhole data (collars, surveys, intervals).

class sec_interp.core.services.drillhole_service.DrillholeService

Bases: object

Service for processing drillhole data.

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

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)