welly

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

welly - Well Data Analysis

welly - 油井数据分析

Quick Reference

快速参考

python
from welly import Well, Project
python
from welly import Well, Project

Load single well

加载单油井数据

w = Well.from_las('well.las')
w = Well.from_las('well.las')

Access data

访问数据

df = w.df() # DataFrame gr = w.data['GR'] # Curve object values = gr.values # numpy array depth = gr.basis # depth array
df = w.df() # DataFrame格式 gr = w.data['GR'] # 曲线对象 values = gr.values # numpy数组 depth = gr.basis # 深度数组

Well info

油井信息

print(w.name, w.uwi) print(w.data.keys()) # Available curves
print(w.name, w.uwi) print(w.data.keys()) # 可用曲线列表

Load multiple wells

加载多油井数据

p = Project.from_las('wells/*.las') for well in p: print(well.name)
undefined
p = Project.from_las('wells/*.las') for well in p: print(well.name)
undefined

Key Classes

核心类

ClassPurpose
Well
Single well with curves, location, tops
Project
Collection of wells for multi-well workflows
Curve
Log curve with depth basis, units, and processing methods
用途
Well
包含曲线、位置信息和地层顶界的单油井对象
Project
用于多油井工作流的油井集合
Curve
带有深度基准、单位和处理方法的测井曲线对象

Essential Operations

关键操作

Access Curve Data

访问曲线数据

python
gr = w.data['GR']
print(gr.mnemonic, gr.units)     # Metadata
print(gr.start, gr.stop, gr.step)  # Depth range
python
gr = w.data['GR']
print(gr.mnemonic, gr.units)     # 元数据
print(gr.start, gr.stop, gr.step)  # 深度范围

Process Curves

处理曲线

python
gr = w.data['GR']
python
gr = w.data['GR']

Clean and filter

清洗与过滤

gr_clean = gr.despike(window=5, z=2) gr_smooth = gr.smooth(window=11)
gr_clean = gr.despike(window=5, z=2) gr_smooth = gr.smooth(window=11)

Transform

转换

gr_norm = gr.normalize() # 0-1 range gr_resampled = gr.resample(step=0.5) gr_clipped = gr.clip(top=1500, bottom=2000)
undefined
gr_norm = gr.normalize() # 归一化至0-1范围 gr_resampled = gr.resample(step=0.5) gr_clipped = gr.clip(top=1500, bottom=2000)
undefined

Work with Formation Tops

管理地层顶界

python
w.tops = {
    'TopFormationA': 1500.0,
    'TopFormationB': 1750.0,
}

for name, depth in w.tops.items():
    print(f"{name}: {depth} m")
python
w.tops = {
    'TopFormationA': 1500.0,
    'TopFormationB': 1750.0,
}

for name, depth in w.tops.items():
    print(f"{name}: {depth} m")

Multi-Well Project

多油井项目

python
from welly import Project

p = Project.from_las('wells/*.las')
print(f"Loaded {len(p)} wells")
python
from welly import Project

p = Project.from_las('wells/*.las')
print(f"已加载 {len(p)} 口油井")

Filter and analyze

过滤与分析

for w in p: if 'GR' in w.data: print(f"{w.name}: GR mean={w.data['GR'].values.mean():.1f}")
undefined
for w in p: if 'GR' in w.data: print(f"{w.name}: GR均值={w.data['GR'].values.mean():.1f}")
undefined

Export Data

导出数据

python
undefined
python
undefined

To DataFrame

导出为DataFrame

df = w.df()
df = w.df()

To LAS file

导出为LAS文件

w.to_las('output.las')
w.to_las('output.las')

To CSV

导出为CSV文件

df.to_csv('well_data.csv')
undefined
df.to_csv('well_data.csv')
undefined

Common Curve Mnemonics

常见曲线代号

MnemonicDescriptionUnits
GRGamma RayGAPI
NPHINeutron Porosityv/v
RHOBBulk Densityg/cc
DTSonicus/ft
RT/ILDDeep Resistivityohm.m
CALICaliperin
代号描述单位
GR伽马射线GAPI
NPHI中子孔隙度v/v
RHOB体积密度g/cc
DT声波时差us/ft
RT/ILD深电阻率ohm.m
CALI井径in

Tips

使用技巧

  1. Use Project for multi-well workflows - easier than managing individual files
  2. Check units - welly tracks units, ensure consistency
  3. Despike before analysis - remove outliers with
    curve.despike()
  4. Resample to common basis - use
    curve.resample()
    for cross-well comparison
  5. welly extends lasio - all lasio functionality available
  1. 使用Project处理多油井工作流——比管理单个文件更简便
  2. 检查单位——welly会跟踪单位,确保数据一致性
  3. 分析前去尖峰——使用
    curve.despike()
    移除异常值
  4. 重采样至统一基准——使用
    curve.resample()
    进行跨油井对比
  5. welly扩展了lasio——所有lasio功能均可直接使用

When to Use vs Alternatives

适用场景与替代工具对比

ToolBest For
wellyMulti-well projects, curve processing, formation tops management
lasioLow-level LAS file I/O, header manipulation, malformed files
petropyPetrophysical calculations (Vsh, porosity, Sw, permeability)
Use welly when you need to manage wells as objects with curves, tops, and metadata -- especially for multi-well QC and cross-well analysis via Project.
Use lasio instead when you only need to read/write LAS files, handle malformed headers, or need fine control over LAS formatting.
Use petropy instead when your focus is formation evaluation calculations (shale volume, porosity, water saturation) rather than data management.
工具最佳适用场景
welly多油井项目管理、曲线处理、地层顶界管理
lasio底层LAS文件输入输出、头信息处理、损坏文件修复
petropy岩石物理计算(泥质含量、孔隙度、含水饱和度、渗透率)
当你需要将油井作为包含曲线、顶界和元数据的对象进行管理时,使用welly——尤其适用于多油井质量控制(QC)和通过Project进行的跨油井分析。
当你仅需读写LAS文件、处理损坏的头信息或需要精细控制LAS格式时,使用lasio
当你的核心需求是地层评价计算(泥质含量、孔隙度、含水饱和度)而非数据管理时,使用petropy

Common Workflows

常见工作流

Load and QC a multi-well project

加载并质量控制多油井项目

- [ ] Load wells with `Project.from_las('wells/*.las')`
- [ ] Check well count and names: `len(p)`, iterate wells
- [ ] Verify required curves exist in each well (`'GR' in w.data`)
- [ ] Despike and clean noisy curves: `curve.despike()`
- [ ] Resample to common depth basis for cross-well comparison
- [ ] Compute summary statistics per well (mean, min, max)
- [ ] Export cleaned data to LAS or DataFrame
- [ ] 使用`Project.from_las('wells/*.las')`加载油井数据
- [ ] 检查油井数量和名称:`len(p)`,遍历油井
- [ ] 验证每口油井是否包含所需曲线(如`'GR' in w.data`)
- [ ] 对噪声曲线进行去尖峰和清洗:`curve.despike()`
- [ ] 重采样至统一深度基准以进行跨油井对比
- [ ] 计算每口油井的统计汇总(均值、最小值、最大值)
- [ ] 将清洗后的数据导出为LAS或DataFrame格式

References

参考资料

  • Curve Processing - Despike, smooth, normalize, resample methods
  • Project Workflows - Multi-well analysis patterns
  • 曲线处理 - 去尖峰、平滑、归一化、重采样方法说明
  • 项目工作流 - 多油井分析模式指南

Scripts

脚本

  • scripts/well_qc.py - QC well data for gaps and issues
  • scripts/project_stats.py - Compute project-level statistics
  • scripts/well_qc.py - 检查油井数据的缺失和问题
  • scripts/project_stats.py - 计算项目级统计数据