dlisio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

dlisio - DLIS/LIS File Reader

dlisio - DLIS/LIS 文件读取器

Quick Reference

快速参考

python
import dlisio
python
import dlisio

Open DLIS file (returns generator of logical files)

打开DLIS文件(返回逻辑文件生成器)

with dlisio.dlis.load('well.dlis') as (f, *rest): frame = f.frames[0] curves = frame.curves()
# Access by channel name
depth = curves['DEPTH']
gr = curves['GR']

# File metadata
for origin in f.origins:
    print(origin.well_name, origin.field_name)
undefined
with dlisio.dlis.load('well.dlis') as (f, *rest): frame = f.frames[0] curves = frame.curves()
# 通过通道名称访问
depth = curves['DEPTH']
gr = curves['GR']

# 文件元数据
for origin in f.origins:
    print(origin.well_name, origin.field_name)
undefined

Key Classes

核心类

ClassPurpose
PhysicalFile
Container returned by
dlis.load()
LogicalFile
Independent dataset within physical file
Frame
Group of channels with common sampling
Channel
Individual log curve with metadata
Origin
Well and file metadata
用途
PhysicalFile
dlis.load()
返回的容器
LogicalFile
物理文件中的独立数据集
Frame
具有共同采样规则的通道组
Channel
带元数据的单个测井曲线
Origin
油井和文件元数据

Essential Operations

核心操作

Read Curves to DataFrame

将曲线读取为DataFrame

python
import pandas as pd

with dlisio.dlis.load('well.dlis') as (f, *_):
    frame = f.frames[0]
    curves = frame.curves()
    df = pd.DataFrame(curves)
    df.set_index('DEPTH', inplace=True)
python
import pandas as pd

with dlisio.dlis.load('well.dlis') as (f, *_):
    frame = f.frames[0]
    curves = frame.curves()
    df = pd.DataFrame(curves)
    df.set_index('DEPTH', inplace=True)

Access Channel and Origin Metadata

访问通道和来源元数据

python
with dlisio.dlis.load('well.dlis') as (f, *_):
    # Origin metadata
    for origin in f.origins:
        print(f"Well: {origin.well_name}, Field: {origin.field_name}")

    # Channel properties
    for ch in f.frames[0].channels:
        print(f"{ch.name}: {ch.units}, dim={ch.dimension}")
python
with dlisio.dlis.load('well.dlis') as (f, *_):
    # 来源元数据
    for origin in f.origins:
        print(f"油井: {origin.well_name}, 油田: {origin.field_name}")

    # 通道属性
    for ch in f.frames[0].channels:
        print(f"{ch.name}: {ch.units}, 维度={ch.dimension}")

Find Channels Across Frames

在多帧中查找通道

python
with dlisio.dlis.load('well.dlis') as (f, *_):
    # By exact name or regex
    channels = f.find('CHANNEL', '.*GR.*', regex=True)

    # Find frame containing specific channel
    for frame in f.frames:
        if 'GR' in [ch.name for ch in frame.channels]:
            curves = frame.curves()
            break
python
with dlisio.dlis.load('well.dlis') as (f, *_):
    # 通过精确名称或正则表达式
    channels = f.find('CHANNEL', '.*GR.*', regex=True)

    # 查找包含特定通道的帧
    for frame in f.frames:
        if 'GR' in [ch.name for ch in frame.channels]:
            curves = frame.curves()
            break

Handle Array Channels

处理数组通道

python
with dlisio.dlis.load('well.dlis') as (f, *_):
    curves = f.frames[0].curves()
    for name, data in curves.items():
        if data.ndim > 1:
            print(f"{name}: shape = {data.shape}")  # Image/waveform
python
with dlisio.dlis.load('well.dlis') as (f, *_):
    curves = f.frames[0].curves()
    for name, data in curves.items():
        if data.ndim > 1:
            print(f"{name}: 形状 = {data.shape}")  # 图像/波形

Common Object Types

常见对象类型

Object TypeDescription
ORIGINFile/well metadata
FRAMEChannel grouping with index
CHANNELLog curve definition
TOOLLogging tool info
PARAMETERConstants and settings
对象类型描述
ORIGIN文件/油井元数据
FRAME带索引的通道组
CHANNEL测井曲线定义
TOOL测井工具信息
PARAMETER常量与设置

Common Curve Names

常见曲线名称

CurveDescription
DEPT, DEPTH, TDEPDepth curves
GRGamma ray
NPHINeutron porosity
RHOBBulk density
DT, DTCCompressional slowness
RT, ILDResistivity
曲线描述
DEPT, DEPTH, TDEP深度曲线
GR伽马射线
NPHI中子孔隙度
RHOB体积密度
DT, DTC纵波时差
RT, ILD电阻率

Error Handling

错误处理

python
dlisio.dlis.set_encodings(['utf-8', 'latin-1'])

try:
    with dlisio.dlis.load('file.dlis') as files:
        for f in files:
            curves = f.frames[0].curves()
except Exception as e:
    print(f"Error: {e}")
python
dlisio.dlis.set_encodings(['utf-8', 'latin-1'])

try:
    with dlisio.dlis.load('file.dlis') as files:
        for f in files:
            curves = f.frames[0].curves()
except Exception as e:
    print(f"错误: {e}")

DLIS vs LAS Comparison

DLIS 与 LAS 对比

FeatureDLISLAS
FormatBinaryASCII
Multi-frameYesNo
Array dataYesLimited
MetadataRichBasic
特性DLISLAS
格式二进制纯文本
多帧支持
数组数据有限支持
元数据丰富基础

When to Use vs Alternatives

适用场景与替代工具对比

ToolBest For
dlisioReading DLIS/RP66 binary files, multi-frame data, image logs
lasioLAS (ASCII) well log files, simpler format, widely supported
wellyHigher-level well data management, curve processing, projects
Use dlisio when your data is in DLIS (RP66) format. DLIS files are common from modern logging tools and contain multi-frame, array, and image data that LAS cannot represent.
Use lasio instead when your data is in LAS format. LAS is ASCII-based, simpler, and more widely supported. Convert DLIS to LAS when downstream tools require it.
Use welly instead when you need well-level data management with curve processing, formation tops, and multi-well projects after initial file loading.
工具最佳适用场景
dlisio读取DLIS/RP66二进制文件、多帧数据、图像测井
lasioLAS(纯文本)测井文件、更简单的格式、广泛支持
welly更高层级的油井数据管理、曲线处理、项目级操作
当数据为DLIS(RP66)格式时使用dlisio。DLIS文件常见于现代测井工具,包含LAS无法表示的多帧、数组和图像数据。
当数据为LAS格式时使用lasio。LAS基于纯文本,更简单且支持更广泛。当下游工具需要LAS格式时,可将DLIS转换为LAS。
当初始文件加载后需要油井级数据管理、曲线处理、层位顶界和多油井项目操作时使用welly

Common Workflows

常见工作流

Read and convert DLIS to DataFrame

读取并将DLIS转换为DataFrame

- [ ] Load file with `dlisio.dlis.load()`, handle encoding if needed
- [ ] List logical files and frames to understand file structure
- [ ] Inspect channels: names, units, dimensions per frame
- [ ] Extract curves from target frame with `frame.curves()`
- [ ] Handle array/image channels separately (ndim > 1)
- [ ] Convert scalar curves to DataFrame with `pd.DataFrame(curves)`
- [ ] Export to CSV or convert to LAS format
- [ ] 使用`dlisio.dlis.load()`加载文件,必要时处理编码
- [ ] 列出逻辑文件和帧以了解文件结构
- [ ] 检查通道:各帧的通道名称、单位、维度
- [ ] 使用`frame.curves()`从目标帧提取曲线
- [ ] 单独处理数组/图像通道(ndim > 1)
- [ ] 使用`pd.DataFrame(curves)`将标量曲线转换为DataFrame
- [ ] 导出为CSV或转换为LAS格式

References

参考资料

  • DLIS File Structure - RP66 format specification
  • Frames and Channels - Working with frames and channels
  • DLIS文件结构 - RP66格式规范
  • 帧与通道 - 帧与通道的使用指南

Scripts

脚本

  • scripts/dlis_to_las.py - Convert DLIS to LAS format
  • scripts/dlis_to_las.py - 将DLIS转换为LAS格式