钻孔柱状图开源库详解

<span data-lang="zh">钻孔柱状图开源库详解</span><span data-lang="en">Open-Source Libraries for Borehole Log Digitization</span>

钻孔柱状图开源库详解Open-Source Libraries for Borehole Log Digitization

Open-Source Libraries for Borehole Data
全面汇总钻孔数据提取、处理与可视化领域的开源Python库,详细说明其功能定位、核心方法与适用场景。Comprehensive guide to open-source Python libraries for borehole data extraction, processing, and visualization.
📖

概述Overview

钻孔柱状图数字化涉及数据提取、解析、处理、可视化等多个环节。开源生态在这些环节提供了丰富的工具支持,主要可分为三大类:Borehole log digitization involves extraction, parsing, processing, and visualization. The open-source ecosystem provides rich tools across these stages, mainly in three categories:

数据提取与解析Extraction & Parsing
从PDF报告、扫描图像、CAD图件中提取结构化钻孔数据,包括dh2loop、geotech-report-extraction、parseplot、GemGIS等。 Extract structured borehole data from PDF reports, scanned images, and CAD files. Includes dh2loop, geotech-report-extraction, parseplot, GemGIS, etc.
数据处理与质控Processing & QC
测井数据读取、质量控制、曲线合成、井斜计算等,包括lasio、welly、PyBorehole、borec_tool等。 Well log reading, quality control, curve synthesis, deviation calculation. Includes lasio, welly, PyBorehole, borec_tool, etc.
可视化与建模Visualization & Modeling
地层条带绘制、三维钻孔轨迹、地质建模接口,包括striplog、Baselode、stresslog等。 Stratigraphic strip plotting, 3D well trajectory, geological modeling interfaces. Includes striplog, Baselode, stresslog, etc.
📥

数据提取与解析类Data Extraction & Parsing Libraries

dh2loop Active

GitHub: Loop3D/dh2loop | 语言Language: Python

定位:地质钻孔日志自动化处理与分类开源库,发表于Geoscientific Model Development (2026)。 Positioning: Open-source library for automated geological drillhole log processing and classification, published in Geoscientific Model Development (2026).

核心功能与方法Core Functions & Methods

  • 数据源接入:从西澳地质调查局(WA Geological Survey)矿产勘探报告数据库中自动提取钻孔数据 Data Source Integration: Automatically extracts drillhole data from WA Geological Survey mineral exploration report databases
  • 标准化输出:将原始非结构化报告转换为标准间隔表,包括collar(孔口)、survey(测斜)、lithology(岩性)三类核心数据 Standardized Output: Converts raw unstructured reports into standard interval tables: collar, survey, and lithology
  • 模糊匹配算法:基于词库(lexicon)和模糊字符串匹配(fuzzy string matching)解决岩性描述命名不一致问题,86%的岩性数据可成功匹配到标准词库 Fuzzy Matching: Uses lexicon-based fuzzy string matching to resolve inconsistent lithology naming; 86% match rate to standard lexicon
  • 多级岩性分类:支持多尺度三维地质建模的数据缩放需求,可将详细岩性描述归并为不同粒度的类别 Multi-level Classification: Supports data scaling for multi-scale 3D geological modeling by aggregating detailed descriptions

技术实现细节Technical Implementation

提取率指标:Extraction Rates:
孔口数据(collar)提取率 93%,测斜数据(survey) 86%,岩性数据(lithology) 34% Collar extraction rate 93%, survey 86%, lithology 34%

关联库:与lasio(测井数据)、welly(测井处理)、striplog(地层可视化)形成生态互补。 Ecosystem: Complements lasio (log data), welly (log processing), and striplog (stratigraphic visualization).

geotech-report-extraction Active

PyPI: geotech-report-extraction (v0.5.6) | 语言Language: Python

定位:从PDF岩土工程报告中提取钻孔数据,输出DIGGS 2.6 XML标准格式。 Positioning: Extracts borehole data from PDF geotechnical reports, outputs DIGGS 2.6 XML standard format.

核心功能与方法Core Functions & Methods

  • 模板化解析:针对Langan、Schnabel等常见岩土报告格式内置解析模板,支持土层描述、SPT击数、地下水位、实验室试验结果提取 Template Parsing: Built-in parsers for common formats (Langan, Schnabel), extracts soil descriptions, SPT N-values, groundwater levels, lab test results
  • 页面分类器:基于XGBoost的机器学习页面分类器,自动识别PDF中的钻孔日志页面与非相关页面 Page Classifier: XGBoost-based ML classifier automatically identifies borehole log pages vs. irrelevant pages in PDFs
  • OCR流水线:支持Azure Document Intelligence JSON输入,可接入云端OCR服务处理扫描版PDF OCR Pipeline: Supports Azure Document Intelligence JSON input for cloud OCR processing of scanned PDFs
  • 视觉大模型(可选):支持Claude/GPT-4o等视觉大模型作为备用提取引擎,处理复杂布局页面 Vision LLM (Optional): Supports Claude/GPT-4o as fallback extraction engine for complex layouts

安装与依赖Installation & Dependencies

pip install geotech-report-extraction[all]

可选依赖分组:Optional dependency groups:

  • pdf — PyMuPDF PDF文本提取PDF text extraction
  • ocr — Tesseract 本地OCRLocal OCR
  • vision — LLM 视觉大模型Vision LLM
  • geo地理空间处理Geospatial processing

parseplot Active

PyPI: parseplot (v0.2.1) | 语言Language: Python

定位:从PDF岩土工程报告中提取岩土数据的专用工具包,尤其针对dotPLOT和hotPLOT格式优化。 Positioning: Specialized toolkit for extracting geotechnical data from PDF reports, optimized for dotPLOT and hotPLOT formats.

核心功能与方法Core Functions & Methods

  • Borehole Parser:专门处理dotPLOT和hotPLOT格式的钻孔日志(每页一个钻孔),输出两类长格式CSV: Borehole Parser: Handles dotPLOT/hotPLOT format logs (one borehole per page), outputs two types of long-format CSV:
    • 岩性间隔表:物质描述、深度边界、水位信息Lithology intervals: material description, depth boundaries, water levels
    • 钻进回次表:钻进方法、RQD、岩芯采取率、SPT-N值Drilling runs: method, RQD, core recovery, SPT-N values
  • Test Pit Parser:处理表格化岩土勘察报告中的探坑数据 Test Pit Parser: Processes test pit data from tabulated geotechnical investigation reports
生态系统:Ecosystem: parseplot集成于MaplyticX地理空间可视化生态系统,提取的数据可直接进入下游GIS分析流程。 parseplot is integrated into the MaplyticX geospatial visualization ecosystem; extracted data flows directly into downstream GIS analysis.

GemGIS Active

语言Language: Python | 教程Tutorial: Jupyter Notebook #26 (Working with Well Data)

定位:地理空间地质数据处理Python库,提供从地质调查局发布的钻孔日志PDF/文档中提取位置和地层数据的功能。 Positioning: Geospatial geological data processing library, provides functions to extract borehole locations and stratigraphic data from GSQ-published log PDFs/documents.

核心功能与方法Core Functions & Methods

  • PDF数据提取:解析地质调查局发布的钻孔日志文档,自动提取钻孔位置坐标和分层地层数据 PDF Data Extraction: Parses GSQ-published borehole log documents, auto-extracts coordinates and stratigraphic intervals
  • GeoDataFrame集成:提取结果直接输出为GeoPandas GeoDataFrame,便于与GIS工作流集成 GeoDataFrame Integration: Outputs GeoPandas GeoDataFrames for seamless GIS workflow integration
  • 可视化教程:提供完整的Jupyter Notebook教程(26号教程),演示从数据提取到可视化的完整流程 Visualization Tutorials: Complete Jupyter Notebook tutorial (#26) demonstrating full extraction-to-visualization workflow
pip install gemgis
⚙️

数据处理与可视化类Data Processing & Visualization Libraries

striplog Active

语言Language: Python

定位:地层条带记录处理与可视化工具,专注于岩性柱的创建、编辑和美观渲染。 Positioning: Stratigraphic strip record processing and visualization tool, focused on lithology column creation, editing, and aesthetic rendering.

核心功能与方法Core Functions & Methods

  • 条带对象模型:每个岩石单位(rock unit)可包含详细描述、颜色、符号、厚度等属性,支持任意复杂度的地层序列 Strip Object Model: Each rock unit can contain detailed description, color, pattern, thickness; supports arbitrarily complex stratigraphic sequences
  • CSV导入导出:支持从标准CSV格式加载和保存地层数据,便于与其他工具交换 CSV I/O: Supports loading and saving stratigraphic data from standard CSV format
  • 内置渲染引擎:基于Matplotlib绘制专业地质柱状图,支持岩性花纹填充、颜色映射、比例尺控制 Built-in Rendering: Matplotlib-based professional geological column plotting with lithology pattern fills, color mapping, scale control
  • 科学计算集成:与NumPy、Matplotlib无缝集成,支持数值分析和自定义绘图 Scientific Computing: Seamless integration with NumPy and Matplotlib for numerical analysis and custom plotting
pip install striplog

welly Active

开发商Developer: Agile Scientific | 语言Language: Python

定位:测井数据处理与质量控制工具库,面向石油地质和矿产勘探领域的测井分析。 Positioning: Well log data processing and quality control toolkit for petroleum geology and mineral exploration log analysis.

核心功能与方法Core Functions & Methods

  • LAS文件加载:从LAS文件加载单井或多井项目,与lasio深度集成 LAS Loading: Load single or multi-well projects from LAS files, deeply integrated with lasio
  • 曲线质量控制:提供测井曲线的质量评估方法,包括异常值检测、数据完整性检查 Curve QC: Quality assessment methods including outlier detection and data completeness checks
  • 曲线别名管理:智能识别和处理同一物理量在不同测井中的不同命名(如GR/GAMMA/RHOB等别名统一) Curve Alias Management: Intelligently recognizes and unifies different mnemonics for the same physical measurement
  • 曲线合成与交会图:支持曲线数学运算、合成新曲线,以及交会图(crossplot)分析 Curve Synthesis & Crossplots: Mathematical operations on curves, new curve generation, and crossplot analysis

文档: code.agilescientific.com/welly

lasio Active

PyPI: lasio (v0.32) | 语言Language: Python

定位:LAS(Log ASCII Standard)文件读写的基础库,是测井数据处理的基石。 Positioning: Foundation library for LAS (Log ASCII Standard) file reading/writing, the cornerstone of well log data processing.

核心功能与方法Core Functions & Methods

  • 版本支持:完整支持LAS 1.2和2.0版本,LAS 3.0版本开发中 Version Support: Full support for LAS 1.2 and 2.0, LAS 3.0 in development
  • 鲁棒解析:兼容常见错误和非标准格式,如缺失头部、不一致的空值标记、格式偏差等 Robust Parsing: Tolerates common errors and non-standard formats: missing headers, inconsistent null markers, format deviations
  • pandas集成:可直接转换为pandas DataFrame,便于进行数据分析和机器学习 pandas Integration: Direct conversion to pandas DataFrame for data analysis and machine learning
  • 空值处理:自动识别LAS标准空值(如-999.25)并正确处理 Null Handling: Automatically recognizes LAS standard null values (e.g., -999.25) and handles them correctly
  • 批量处理:支持多口井的批量读取和处理 Batch Processing: Supports batch reading and processing of multiple wells
pip install lasio

PyBorehole Active

GitHub: AlexanderJuestel/pyborehole | Language语言: Python

定位:钻孔数据处理与可视化库,功能定位类似welly但更聚焦钻孔工程数据。 Positioning: Borehole data processing and visualization library, similar to welly but more focused on drilling engineering data.

核心功能与方法Core Functions & Methods

  • 测井曲线可视化:基于lasio读取LAS文件,提供测井曲线的专业可视化 Log Visualization: Reads LAS files via lasio, provides professional log curve visualization
  • 井斜轨迹处理:基于wellpathpy处理井斜数据,计算真实垂直深度(TVD)和三维空间轨迹 Deviation Survey: Uses wellpathpy to process deviation data, calculate TVD and 3D spatial trajectory
  • 脱靶计算:支持井眼轨迹与目标靶区的偏离计算 Target Miss Distance: Calculates deviation between wellbore trajectory and target zone
  • BoreholeML解析:解析BoreholeML格式的XML文件,支持德国标准的钻孔数据交换格式 BoreholeML Parsing: Parses BoreholeML XML files, supports German standard borehole data exchange format

borec_tool Beta

语言Language: Python

定位:面向地球科学的钻孔分析专用工具库,强调地质学术语到数据结构的直接映射。 Positioning: Dedicated drilling analysis toolkit for geosciences, emphasizes direct mapping of geological terminology to data structures.

核心功能与方法Core Functions & Methods

  • 野外记录解析:将野外纸质/电子原始记录解析为结构化数据模型 Field Record Parsing: Parses paper/electronic field records into structured data models
  • 自动成图:地层柱状图自动绘制算法,根据岩性编码自动选择花纹和颜色 Auto Plotting: Automated stratigraphic column plotting, auto-selects patterns and colors from lithology codes
  • 结构化建模:岩性、含水层、取样信息的地质数据模型 Structured Modeling: Geological data models for lithology, aquifers, and sampling information
  • 标准化报告:按行业标准自动生成钻孔报告文档 Standardized Reporting: Auto-generates borehole report documents per industry standards
  • 多孔空间分析:多钻孔联合空间分析,支持剖面图和平面图生成 Multi-borehole Spatial Analysis: Joint spatial analysis of multiple boreholes, supports section and plan view generation
  • 三维建模接口:提供与三维地质建模软件的数据交换接口 3D Modeling Interface: Data exchange interfaces with 3D geological modeling software
设计理念:Design Philosophy: 将地质学术语(层顶深、层底深、RQD、SPT击数等)直接映射为可编程数据结构,降低地质人员编程门槛。 Maps geological terms (top depth, bottom depth, RQD, SPT N-values, etc.) directly to programmable data structures, lowering the programming barrier for geologists.

Baselode Active

语言Languages: Python, JavaScript | 文档Docs: docs.baselode.net

定位:开源矿产勘探工具包,提供Python和JavaScript双语言版本,覆盖从数据加载到三维可视化的全流程。 Positioning: Open-source mineral exploration toolkit with Python and JavaScript versions, covering full workflow from data loading to 3D visualization.

核心功能与方法Core Functions & Methods

  • 数据加载与标准化:从CSV/Parquet/SQL导入并标准化钻孔孔口(collar)、测斜(survey)、化验(assay)、岩土间隔数据 Data Loading & Standardization: Imports and standardizes collar, survey, assay, and geotechnical interval data from CSV/Parquet/SQL
  • 脱靶计算方法:支持最小曲率法(minimum curvature)、切线法(tangential)、平衡切线法(balanced tangential)三种行业标准算法 Deviation Calculation: Supports minimum curvature, tangential, and balanced tangential methods — three industry-standard algorithms
  • 2D条带日志:基于Plotly的多轨道(multi-track)条带图,支持交互式缩放和曲线叠加 2D Strip Logs: Plotly-based multi-track strip charts with interactive zooming and curve overlay
  • 3D场景:Three.js驱动的3D查看器,支持钻孔轨迹、岩性柱、化验结果的三维交互展示 3D Scene: Three.js-powered 3D viewer supporting interactive display of well trajectories, lithology columns, and assay results

stresslog Active

PyPI: stresslog | 语言Language: Python

定位:基于测井曲线的地应力计算库,面向钻井工程和井壁稳定性分析。 Positioning: Geomechanical stress calculation library based on well logs, for drilling engineering and wellbore stability analysis.

核心功能与方法Core Functions & Methods

  • 数据导入:从LAS/DLIS文件导入测井数据 Data Import: Imports log data from LAS/DLIS files
  • 孔隙压力计算:基于测井响应(如声波、电阻率)计算地层孔隙压力剖面 Pore Pressure: Calculates formation pore pressure profiles from log responses (sonic, resistivity)
  • 地应力分量计算:计算垂直应力、最小/最大水平主应力 Stress Components: Calculates vertical stress and minimum/maximum horizontal principal stresses
  • 井壁稳定性分析:基于应力状态预测井壁坍塌和破裂风险 Wellbore Stability: Predicts wellbore collapse and fracturing risks based on stress state
  • 结果导出:支持CSV和LAS格式结果输出 Result Export: Supports CSV and LAS format output
🔧

其他相关开源项目Other Related Open-Source Projects

项目名Project 语言Language 功能定位Function 适用场景Use Case
dliswriter Python 写入DLIS格式测井文件(RP66V1标准)Write DLIS format log files (RP66V1 standard) 测井数据归档与交换Log data archiving and exchange
logASCII_viewer Python 基于Streamlit的LAS文件交互式查看器Streamlit-based interactive LAS file viewer 快速浏览测井数据Quick log data browsing
Wellbore_Stability MATLAB 井壁稳定性计算(Mohr-Coulomb准则)Wellbore stability (Mohr-Coulomb criterion) 钻井工程安全分析Drilling engineering safety analysis
Interactive-Well-Trajectory-Plot Python 基于Plotly的交互式井轨迹可视化Plotly-based interactive well trajectory visualization 定向井轨迹分析Directional well trajectory analysis
⚖️

库对比与选型建议Library Comparison & Selection Guide

按应用场景选型Selection by Application Scenario

应用场景Scenario 推荐库Recommended Libraries 说明Notes
从PDF岩土报告提取数据Extract from PDF geotech reports geotech-report-extraction, parseplot 前者支持DIGGS输出,后者专注dotPLOT/hotPLOTFormer outputs DIGGS; latter focuses on dotPLOT/hotPLOT
从政府地质数据库提取Extract from government geological DBs dh2loop, GemGIS dh2loop针对西澳数据库,GemGIS针对昆士兰dh2loop for WA; GemGIS for Queensland
测井数据读取与质控Log reading & QC lasio + welly 黄金组合:lasio读取,welly做质控和分析Golden combo: lasio reads, welly does QC and analysis
地层柱状图绘制Stratigraphic column plotting striplog, borec_tool striplog更通用,borec_tool更贴合国内规范striplog more general; borec_tool closer to Chinese standards
井斜计算与三维轨迹Deviation & 3D trajectory PyBorehole, Baselode Baselode提供JS/Python双版本和3D可视化Baselode provides JS/Python dual versions and 3D visualization
地应力与井壁稳定Geomechanics & stability stresslog, Wellbore_Stability stresslog为Python,Wellbore_Stability为MATLABstresslog in Python; Wellbore_Stability in MATLAB

技术栈组合建议Recommended Tech Stack Combinations

标准测井分析栈Standard Log Analysis Stack:
lasiowellystriplog
读取 → 质控分析 → 可视化 Read → QC/Analysis → Visualize
PDF数字化栈PDF Digitization Stack:
geotech-report-extraction / parseplotpandasstriplog
提取 → 数据处理 → 成图 Extract → Process → Plot
三维勘探栈3D Exploration Stack:
dh2loop / BaselodewellpathpyThree.js/Baselode 3D
数据提取 → 轨迹计算 → 三维展示 Extract → Trajectory → 3D Display

钻孔柱状图开源库汇总 | 基于公开文档与社区资源整理Borehole Log Open-Source Libraries Guide | Compiled from public documentation and community resources