welly
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewelly - Well Data Analysis
welly - 油井数据分析
Quick Reference
快速参考
python
from welly import Well, Projectpython
from welly import Well, ProjectLoad 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)
undefinedp = Project.from_las('wells/*.las')
for well in p:
print(well.name)
undefinedKey Classes
核心类
| Class | Purpose |
|---|---|
| Single well with curves, location, tops |
| Collection of wells for multi-well workflows |
| Log curve with depth basis, units, and processing methods |
| 类 | 用途 |
|---|---|
| 包含曲线、位置信息和地层顶界的单油井对象 |
| 用于多油井工作流的油井集合 |
| 带有深度基准、单位和处理方法的测井曲线对象 |
Essential Operations
关键操作
Access Curve Data
访问曲线数据
python
gr = w.data['GR']
print(gr.mnemonic, gr.units) # Metadata
print(gr.start, gr.stop, gr.step) # Depth rangepython
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)
undefinedgr_norm = gr.normalize() # 归一化至0-1范围
gr_resampled = gr.resample(step=0.5)
gr_clipped = gr.clip(top=1500, bottom=2000)
undefinedWork 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}")
undefinedfor w in p:
if 'GR' in w.data:
print(f"{w.name}: GR均值={w.data['GR'].values.mean():.1f}")
undefinedExport Data
导出数据
python
undefinedpython
undefinedTo 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')
undefineddf.to_csv('well_data.csv')
undefinedCommon Curve Mnemonics
常见曲线代号
| Mnemonic | Description | Units |
|---|---|---|
| GR | Gamma Ray | GAPI |
| NPHI | Neutron Porosity | v/v |
| RHOB | Bulk Density | g/cc |
| DT | Sonic | us/ft |
| RT/ILD | Deep Resistivity | ohm.m |
| CALI | Caliper | in |
| 代号 | 描述 | 单位 |
|---|---|---|
| GR | 伽马射线 | GAPI |
| NPHI | 中子孔隙度 | v/v |
| RHOB | 体积密度 | g/cc |
| DT | 声波时差 | us/ft |
| RT/ILD | 深电阻率 | ohm.m |
| CALI | 井径 | in |
Tips
使用技巧
- Use Project for multi-well workflows - easier than managing individual files
- Check units - welly tracks units, ensure consistency
- Despike before analysis - remove outliers with
curve.despike() - Resample to common basis - use for cross-well comparison
curve.resample() - welly extends lasio - all lasio functionality available
- 使用Project处理多油井工作流——比管理单个文件更简便
- 检查单位——welly会跟踪单位,确保数据一致性
- 分析前去尖峰——使用移除异常值
curve.despike() - 重采样至统一基准——使用进行跨油井对比
curve.resample() - welly扩展了lasio——所有lasio功能均可直接使用
When to Use vs Alternatives
适用场景与替代工具对比
| Tool | Best For |
|---|---|
| welly | Multi-well projects, curve processing, formation tops management |
| lasio | Low-level LAS file I/O, header manipulation, malformed files |
| petropy | Petrophysical 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 - 计算项目级统计数据