Skip to main content

wellcast

Oil and gas well performance analysis for Python.

PyPI version Python versions CI Coverage Docs License MPL-2.0 Downloads Code style: ruff Typed: mypy ORCID

Production engineers repeat the same analysis for every field: clean daily allocation data, fit decline curves, check inflow performance, look for water and injectivity problems, and increasingly train models on sensor data. That work usually lives in spreadsheets and one-off scripts. wellcast puts it in one tested, typed Python library with consistent oilfield units, documented correlations with their valid ranges, honest validation of machine learning models, and an interactive app for engineers who prefer not to write code.

Highlights

  • Field data in, one schema out. CSV, Excel and LAS readers map common database column names (such as BORE_OIL_VOL or AVG_WHP_P) and units to one canonical layout.
  • Quality control that flags, never deletes. Shut-ins, spikes, frozen gauges, gaps and physically impossible values, per well.
  • Decline curve analysis with uncertainty. Arps models chosen by AIC, robust log-space fitting, bootstrap P90/P50/P10 rates and EUR, batch fits for a whole field.
  • Textbook PVT and inflow performance. Standing, Vasquez-Beggs, Beggs-Robinson, Hall-Yarborough, Vogel, Fetkovich, composite IPR and choke equations, validated against published values.
  • Virtual flow metering. Leakage-safe features, LightGBM by default, time-ordered and leave-one-well-out validation, quantile intervals and SHAP explanations.
  • Well and reservoir diagnostics. Chan and Hall plots, Havlena-Odeh material balance, rule-based and Isolation Forest anomaly detection.
  • Reproducible by design. A synthetic field with ground-truth labels powers every example, test, tutorial and the app demo. No third-party data is bundled.
  • Typed and tested. mypy --strict, more than 350 tests with over 99 percent coverage, doctests on every public example.

Installation

pip install wellcast

The core needs only NumPy, pandas and SciPy. Optional features come as extras:

Extra Installs Enables
io lasio, openpyxl LAS logs, Excel files
ml scikit-learn, LightGBM, SHAP, joblib virtual flow metering, Isolation Forest
viz plotly interactive charts
app Streamlit, plotly wellcast app
all everything above all features
pip install "wellcast[all]"

60-second quickstart

import wellcast

field = wellcast.make_synthetic_field(n_wells=5, years=5, seed=42)
production = field.production

print(wellcast.qc_report(production).query("impossible > 0"))

rates = production.query("well == 'P-01'")["oil_rate"]
model = wellcast.DeclineModel().fit(rates).bootstrap(200)
print(model)
print(model.eur_quantiles(econ_limit=20.0))
print(wellcast.fit_many(production, econ_limit=20.0)[["model", "eur", "status"]])

Feature tour

Units and data input

from wellcast import convert, read_production

convert(250.0, "bar", "psi")  # 3625.9
df = read_production("export.xlsx", units={"oil_rate": "sm3/d", "whp": "bar"})

Cleaning and quality control

from wellcast.clean import detect_shut_ins, flag_outliers, qc_report

shut_in = detect_shut_ins(df)
spikes = flag_outliers(df, "oil_rate", method="hampel")
report = qc_report(df)

PVT

from wellcast import pvt

pvt.bubble_point_standing(
    rs=751.0, gas_gravity=0.851, api=47.1, temperature=250.0
)  # 2181.3 psia
pvt.z_factor(pressure=2000.0, temperature=180.0, gas_gravity=0.7)  # 0.844
table = pvt.black_oil_table([1000.0, 2000.0, 3000.0], 200.0, 35.0, 0.75, 500.0)

Inflow performance and chokes

from wellcast import ipr

qmax = ipr.vogel_qmax(rate=350.0, pwf=2000.0, reservoir_pressure=2500.0)  # 1067.1 STB/d
ipr.composite_ipr(
    pwf=1000.0, reservoir_pressure=4000.0, bubble_point=2000.0, productivity_index=1.4
)
ipr.gilbert_choke(rate=1000.0, glr=1000.0, choke_size=32.0)  # 621 psi

Decline curves

from wellcast.dca import DeclineModel

model = DeclineModel("auto").fit(rates).bootstrap(300)
model.forecast(365 * 5, econ_limit=20.0)
model.plot(rates, econ_limit=20.0).show()

Features and machine learning

from wellcast.features import build_features
from wellcast.ml import Predictor

data = build_features(production)
vfm = Predictor("bhp").fit(data)
vfm.cross_validate(data, "lowo")  # leave one well out
vfm.predict_interval(data).head()  # 80 percent interval
vfm.explain(data).show()  # SHAP importance

Diagnostics

from wellcast import diagnostics

injector = production.query("well == 'I-01'")
hall = diagnostics.hall_plot_data(injector, reservoir_pressure=3200.0)
diagnostics.hall_slope_change(hall)  # injectivity loss date and slope ratio
diagnostics.classify_water_mechanism(diagnostics.chan_plot_data(production))
diagnostics.detect_anomalies(production)

Plotting

from wellcast import plotting

plotting.production_history(production, "P-01").show()

Interactive app

pip install "wellcast[all]"
wellcast app

Six pages (Data, Explore, Predict, Decline, Diagnose, Report) cover the whole workflow, and Load demo data works with zero setup.

Live demo on Streamlit Community Cloud: wellcast.streamlit.app

Tutorials

Notebook Open
Quickstart Open in Colab
Decline curve analysis Open in Colab
Virtual flow metering Open in Colab

Runnable scripts live in examples/.

Documentation

The full documentation, with the engineering background and equations of every module, tutorials and the API reference, is at olaflaitinen.github.io/wellcast.

Roadmap

  • 0.2.0: vertical lift performance and nodal analysis, more PVT correlations.
  • 0.3.0: rate transient analysis and type curves.
  • 1.0.0: stable public API.

See ROADMAP.md.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md and the Code of Conduct. Questions go to GitHub Discussions and bugs to GitHub Issues.

Author

Olaf Yunus Laitinen Imanov
Department of Mathematics and Statistics, University of Helsinki
ORCID iD: 0009-0006-5184-0810
Email: yunus.z.imanov@helsinki.fi

Citation

If wellcast contributes to your work, please cite it. The entry below is generated from CITATION.cff:

@misc{laitinenimanov2026wellcast,
  author = {Laitinen Imanov, Olaf Yunus},
  title = {wellcast: oil and gas well performance analysis for Python},
  version = {0.1.0},
  year = {2026},
  url = {https://olaflaitinen.github.io/wellcast},
  howpublished = {\url{https://github.com/olaflaitinen/wellcast}}
}

License

wellcast is released under the Mozilla Public License 2.0. The MPL is a file-level copyleft: you may use wellcast in projects under any license, including proprietary ones, but modifications to wellcast's own files must be shared under the MPL.

Acknowledgements

wellcast builds on NumPy, pandas, SciPy, scikit-learn, LightGBM, SHAP, plotly, Streamlit and lasio, and on the published work of the engineers whose correlations it implements, among them Arps, Standing, Vasquez and Beggs, Beggs and Robinson, Hall and Yarborough, Vogel, Fetkovich, Gilbert, Chan, Hall, and Havlena and Odeh.

Metadata

Release files for wellcast 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wellcast 0.1.0
File Size Uploaded Provenance Actions
wellcast-0.1.0.tar.gz 761.7 kB With provenance Details for wellcast-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wellcast 0.1.0
File Interpreter ABI Platform Actions
wellcast-0.1.0-py3-none-any.whl Python 3 none any Details for wellcast-0.1.0-py3-none-any.whl

Total release size: 931.4 kB

Release files / wellcast-0.1.0.tar.gz

Download URL wellcast-0.1.0.tar.gz
Size 761.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ecd7784c1c4a52066364da14f6a64f73718049959c714d0b857591aca9ac2151
BLAKE2b-256 checksum
How to use checksums
839875200962097ef19ae8992ddc23c5214030a1435954a44c5f3496f4ae150f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / wellcast-0.1.0-py3-none-any.whl

Download URL wellcast-0.1.0-py3-none-any.whl
Size 169.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaea097f47018260487863a75aba7e284ae0cf37b556faed3498fdcd6e49c08a
BLAKE2b-256 checksum
How to use checksums
ed2edc3a44dd054522e231bc5b2c7ef591a8e71f8a57decb72f88371396ad08b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for wellcast 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wellcast-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page