sec_interp.core.services.drillhole_service module
Drillhole Data Processing Service.
This module provides services for processing and projecting drillhole data, including collar projection, trajectory calculation, and interval interpolation.
- class sec_interp.core.services.drillhole_service.DrillholeService(collar_processor: CollarProcessor | None = None, survey_processor: SurveyProcessor | None = None, interval_processor: IntervalProcessor | None = None, data_fetcher: DataFetcher | None = None, trajectory_engine: TrajectoryEngine | None = None)
Bases:
IDrillholeServiceService for processing and orchestrating drillhole data.
This service handles the projection of collars onto a 2D section line, the calculation of 3D trajectories from survey data, and the interpolation of geological intervals along those trajectories. It leverages specialized processors to maintain a clean separation of concerns.
- __init__(collar_processor: CollarProcessor | None = None, survey_processor: SurveyProcessor | None = None, interval_processor: IntervalProcessor | None = None, data_fetcher: DataFetcher | None = None, trajectory_engine: TrajectoryEngine | None = None) None
Initialize the service with specialized processors.
- Parameters:
collar_processor – Optional collar processor.
survey_processor – Optional survey processor.
interval_processor – Optional interval processor.
data_fetcher – Optional data fetcher.
trajectory_engine – Optional trajectory engine.
- process_intervals(collar_points: list[tuple], collar_data: list[dict[str, Any]], survey_data: dict[Any, list[tuple]], interval_data: dict[Any, list[tuple]], 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]]
Process drillhole interval data using detached structures.
- Parameters:
collar_points – Projected collar results.
collar_data – Original detached collar data.
survey_data – Map of hole IDs to survey tuples.
interval_data – Map of hole IDs to interval tuples.
collar_id_field – ID field name.
use_geometry – Whether geometry was used.
collar_x_field – X field name.
collar_y_field – Y field name.
line_geom – Section geometry.
line_start – Section start point.
distance_area – Distance measurer.
buffer_width – Buffer width.
section_azimuth – Section orientation.
survey_fields – Survey field mapping.
interval_fields – Interval field mapping.
- Returns:
Tuple of (geology_segments, drillhole_results).
- project_collars(collar_data: list[dict[str, Any]], line_data: Any, 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, pre_sampled_z: dict[Any, float] | None = None) list[tuple]
Project collar points onto section line using detached domain data.
- Parameters:
collar_data – List of detached collar dictionaries.
line_data – Section line geometry or feature.
distance_area – QgsDistanceArea for measurements.
buffer_width – Maximum distance from section for projection.
collar_id_field – Name of the ID field.
use_geometry – Whether to use geometric data for projection.
collar_x_field – Field name for X coordinate (if not using geometry).
collar_y_field – Field name for Y coordinate (if not using geometry).
collar_z_field – Field name for Z coordinate.
collar_depth_field – Field name for total depth.
pre_sampled_z – Optional dict of pre-sampled elevations.
- Returns:
(hole_id, dist_along, z, offset, total_depth).
- Return type:
List of projection tuples
- Raises:
ValidationError – If parameters are invalid.