mcpField
W
welly

welly

github.com/steadfastasartData & databases7366 installsUpdated 6w ago
Repository

About welly

welly is a Python toolkit for managing and analyzing well-log data, for users working with individual wells or multi-well projects. It organizes curves, formation tops, and metadata and supports curve processing and export.

Key features

  1. 01Load LAS files into well objects
  2. 02Manage curves, tops, and metadata
  3. 03Process and resample log curves
  4. 04Group wells in multi-well projects
  5. 05Export to LAS, DataFrame, or CSV

Use cases

  1. 01Quality-check curves across a well project
  2. 02Clean curves before interpretation
  3. 03Compare wells on a common depth basis
  4. 04Export processed well data

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/steadfastasart/geoscience-skills --skill welly

After installing, type/wellyin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
curve_processing.md
project_workflows.md
scripts/
project_stats.py
well_qc.py

Details

From the project README

welly - Well Data Analysis

The examples are checked with welly 0.5.2. This release imports pkg_resources, so its environment needs setuptools<81. The repository's scientific test requirements record the other tested dependency versions.

Quick Reference

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

ClassPurpose
WellSingle well with curves, location, tops
ProjectCollection of wells for multi-well workflows
CurveLog curve with depth basis, units, and processing methods

Essential Operations

Access Curve Data
gr = w.data['GR']
print(gr.mnemonic, gr.units)     # Metadata
print(gr.start, gr.stop, gr.step)  # Depth range
Process Curves
import numpy as np

gr = w.data['GR']

# Clean and filter
gr_clean = gr.despike(window_length=5, z=2)
gr_smooth = gr_clean.apply(window_length=11, func1d=np.nanmean)
w.data['GR'] = gr_clean  # Use the cleaned curve in subsequent well exports.

# Optional dimensionless display array; retain GR's physical API units in w.
values = gr_clean.as_numpy().ravel()
finite = np.isfinite(values)
gr_norm = np.full_like(values, np.nan, dtype=float)
if finite.any() and np.ptp(values[finite]) > 0:
    gr_norm[finite] = (values[finite] - values[finite].min()) / np.ptp(values[finite])
gr_resampled = gr_clean.to_basis(step=0.5)
gr_window = gr_clean.to_basis(start=1500, stop=1510)  # Outside support is NaN.

See the Curve API for despike, apply, and to_basis parameters. Review filtering against thin beds before treating the processed curve as interpretation input.

Work with Formation Tops
w.tops = {
    'TopFormationA': 1500.0,
    'TopFormationB': 1750.0,
}

for name, depth in w.tops.items():
    print(f"{name}: {depth} m")
Multi-Well Project
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
# To DataFrame
df = w.df()

# To LAS file
w.to_las('output.las')

# To CSV
df.to_csv('well_data.csv')

Common Curve Mnemonics

MnemonicDescriptionUnits
GRGamma RayGAPI
NPHINeutron Porosityv/v
RHOBBulk Densityg/cc
DTSonicus/ft
RT/ILDDeep Resistivityohm.m
CALICaliperin

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

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.

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

References

Scripts

Comments

Markdown supported