lildrip
Stochastic rainfall disaggregation with the Bartlett-Lewis process
lildrip takes coarse-resolution rainfall data (e.g. hourly) and generates finer-resolution series (e.g. 10-minute intervals) using the Bartlett-Lewis stochastic process — a well-established model in hydrology.
Quick start
pip install lildrip
from lildrip import BartlettLewisModel
model = BartlettLewisModel()
events = model.identify_events(fine_series, inter_event_gap_minutes=30)
params = model.calibrate(events)
disagg = model.disaggregate(coarse_series, fine_interval_minutes=10)
Web API
pip install "lildrip[api]"
uvicorn api.main:app --host 0.0.0.0 --port 8000
Then POST /calibrar with a high-resolution CSV or POST /desagregar
with coarse data + pre-calibrated parameters. Both endpoints accept
configurable column names (time_column, rainfall_column).
See the full API docs below.
Demo
Run the examples from the repository root:
# No data? Generate sample CSV files first:
python examples/generate_demo_rain.py
# Full pipeline (calibrate → disaggregate → plot):
python examples/bartlett_lewis_demo.py
Model parameters
The Bartlett-Lewis model describes rainfall through five parameters calibrated via the Method of Moments.
| Parameter | Description |
|---|---|
| λ (lambda) | Storm frequency (events/day) |
| β (beta) | Pulses per storm |
| γ (gamma) | Storm termination rate |
| η (eta) | Pulse termination rate |
| μ (mu) | Pulse intensity (mm) |
Project structure
lildrip/
├── src/lildrip/
│ ├── __init__.py
│ ├── bartlett_lewis_model.py # Core model
│ └── plotting.py # Visualisation helpers
├── api/
│ ├── app.py # FastAPI application
│ └── main.py # Uvicorn entry point
├── examples/
│ ├── generate_demo_rain.py # Generate synthetic data
│ └── bartlett_lewis_demo.py # Calibrate + disaggregate demo
├── tests/
│ └── test_model.py
├── Dockerfile
├── pyproject.toml
└── README.md
License
Metadata
Release files for lildrip 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lildrip-0.1.0.tar.gz | 19.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lildrip-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.3 kB
Release files / lildrip-0.1.0.tar.gz
| Download URL | lildrip-0.1.0.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dc2897e15aa3f727e67da785e1d0e08e3ba4776735ac75aae85deba44084049
|
|
BLAKE2b-256 checksum How to use checksums |
acd290fa63c8da4a56f54715e80e4f65a8a7cf4160af79fcdeed4e8f2992d010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Release files / lildrip-0.1.0-py3-none-any.whl
| Download URL | lildrip-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76cab86da8035fa544e7d8a71b8cfc379a2987158046be360e26e83561def830
|
|
BLAKE2b-256 checksum How to use checksums |
f0ae576732488722a8f865ca0a8cd24ea98336956182c5b664caf79afa4f046c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|