welly - Well Data Analysis
Quick Reference
python
from welly import Well, Project
# Load single well
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
# Well info
print(w.name, w.uwi)
print(w.data.keys()) # Available curves
# Load multiple wells
p = Project.from_las('wells/*.las')
for well in p:
print(well.name)
Key Classes
| Class | Purpose |
|---|---|
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 |
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
Process Curves
python
gr = w.data['GR'] # Clean and filter 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)
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")
Multi-Well Project
python
from welly import Project
p = Project.from_las('wells/*.las')
print(f"Loaded {len(p)} wells")
# Filter and analyze
for w in p:
if 'GR' in w.data:
print(f"{w.name}: GR mean={w.data['GR'].values.mean():.1f}")
Export Data
python
# To DataFrame
df = w.df()
# To LAS file
w.to_las('output.las')
# To CSV
df.to_csv('well_data.csv')
Common 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 |
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
curve.resample()for cross-well comparison - •welly extends lasio - all lasio functionality available
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