Metadata-Version: 2.4
Name: subsurfix
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering
Requires-Dist: numpy>=1.26.4
Requires-Dist: pyarrow>=25.0.0
Requires-Dist: pyproj>=3.6
Requires-Dist: tomli>=2.0 ; python_full_version < '3.11'
Requires-Dist: pyproj>=3.8.0 ; extra == 'gis'
Requires-Dist: shapely>=2.1.2 ; extra == 'gis'
Requires-Dist: pyshp>=3.1.6 ; extra == 'gis'
Requires-Dist: openpyxl>=3.1.5 ; extra == 'gis'
Requires-Dist: pytest>=9.1.1 ; extra == 'test'
Requires-Dist: python-calamine>=0.4.0 ; extra == 'xls'
Provides-Extra: gis
Provides-Extra: test
Provides-Extra: xls
License-File: LICENSE
License-File: NOTICE
Summary: A tool for automation in subsurface geological/petrophysical analysis and geomodeling workflows
Keywords: well logs,petrophysics,stratigraphic correlation,geostatistics,reservoir simulation,geomodeling
Author: Larry Syu-Heng Lai
License-Expression: AGPL-3.0-or-later
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/GeoLarryLai/SubsurfiX
Project-URL: Issues, https://github.com/GeoLarryLai/SubsurfiX/issues
Project-URL: Repository, https://github.com/GeoLarryLai/SubsurfiX

<p align="center"><img src="image/logo.png" alt="SubsurfiX" width="160"></p>

# SubsurfiX

[![PyPI version](https://img.shields.io/pypi/v/subsurfix.svg)](https://pypi.org/project/subsurfix/) [![pepy downloads](https://static.pepy.tech/badge/subsurfix)](https://pepy.tech/project/subsurfix)

![3D porosity model built from 60 Kansas wells](image/hero_3d_porosity_model.png)

From a folder of well logs to a checked, correlated log set and a 3D property model you can run flow and heat
simulations on. Rust engine, driven from Python or the command line.

Status: 0.1.0, early-stage research software (source only, no prebuilt wheels). APIs may change; check results
before use.

## What it does

- **QC and gap fill:** reads LAS files and surveys, masks bad intervals, and fills gaps (rules + LightGBM) with a
  provenance code on every value.
- **Well correlation:** DTW between neighbouring wells, solved as one network for all wells
  ([Wheeler and Hale, 2014](https://doi.org/10.1190/segam2014-0227.1);
  [Sylvester, 2023](https://doi.org/10.1111/bre.12787); [Samant et al., 2025](https://doi.org/10.1029/2024PA005082)).
- **Grids and properties:** regular or corner-point (GRDECL) grids, upscaling, kriging, SGS, SIS and ML P10/P50/P90.
- **Flow and heat:** pressure, tracer, two-phase water/oil and heat transport; export to OpenGeoSys (`.vtu`).

## Results

![Raw, QC'd and gap-filled logs](image/ex_qc_gap_fill.png)
*One Kansas well: raw log (grey), what QC kept (black) and filled samples (red).*

![Well correlation section](image/ex_well_correlation.png)
*West–east section: GR on elevation (left) and on correlated layer time (right), where beds line up.*

![Porosity maps of one layer](image/ex_property_maps.png)
*Porosity in one layer by kriging, SGS, SIS and ML propagation.*

![Geothermal doublet](image/ex_heat_doublet.png)
*Heat transport check against Ogata–Banks, and the cold front of an injector–producer doublet through time.*

One executed notebook per step on open data (Kansas Geological Survey, FORCE 2020): see
[`examples/README.md`](examples/README.md). `scripts/` fetches the data.

## Install

Needs Rust (stable), Python 3.10+, a C/C++ compiler and libclang (for the LightGBM build).

```bash
git clone https://github.com/GeoLarryLai/SubsurfiX subsurfix && cd subsurfix
python -m venv .venv && . .venv/bin/activate
pip install maturin numpy pyarrow pandas pyproj
maturin develop -r                                    # builds subsurfix._native
pip install matplotlib lasio jupyter python-calamine  # optional: notebooks, .xls PTS files
```

Tests: `cargo test --workspace`, then `maturin develop -r --features testing` and `python -m pytest tests/python -q`.

## Quick start

```python
import subsurfix as sx

toml = sx.write_demo_project("sx_demo")   # small synthetic project, no data needed
sx.prepare_edges(toml)                    # headers, tops, surveys -> tables
p = sx.Project(toml)
p.run()                                   # ingest -> QC -> align -> normalize -> fill -> correlate -> export
print(p.status().to_pandas())
logs, tops = p.logs(well=1), p.tops()
```

Your own data: `sx.init_project("my_project", crs="EPSG:32614", las_dirs=["las"])` writes a commented
`project.toml`; `sx.template_toml()` lists every setting. Command line: `python -m subsurfix.edges project.toml`,
then `subsurfix run --config project.toml`.

## Acknowledgements

Log workflow: [Gonzalez et al. (2023)](https://www.tgs.com/technical-library/machinelearningworkflowforlogdata).
`ml_propagation`: [Meinshausen (2006)](https://jmlr.org/papers/v7/meinshausen06a.html).
Flow and heat: [open-DARTS](https://gitlab.com/open-darts/open-darts), [OpenGeoSys](https://www.opengeosys.org),
[OPM](https://opm-project.org). Data credits are in `NOTICE`.

## How to cite

> Lai, L. S.-H. (2026). SubsurfiX (version 0.1.0) [Computer software]. https://github.com/GeoLarryLai/SubsurfiX

Full metadata is in [`CITATION.cff`](CITATION.cff) (GitHub's "Cite this repository" button).

## Licence

Copyright (C) 2026 Larry Syu-Heng Lai. AGPL-3.0-or-later; see `LICENSE`.

