TerraPIN
Terrapin (or TerraPIN) stands for "Terraces Put Into Numerics". It generates the terraces — both strath and fill — that a river leaves as it incises, aggrades, and planes laterally across its valley.
STARTED 09 SEPTEMBER 2013 (written by ADW)
What it is
TerraPIN models a river-valley cross-section as material polygons (Shapely/GEOS) and expresses the physics as polygon algebra: incision and lateral planation remove material, aggradation and talus add it, and eroded and deposited volumes are polygon areas — so mass is conserved by construction rather than by bookkeeping.
It is a driver-agnostic geometry and mass-balance engine. You tell it what
happened — "incise to z", "plane to channel width w", "aggrade to level" —
and it reports back the updated geometry, the mass balance (eroded and deposited
volumes, sediment out), and the emergent valley width. It does not decide
rates, erosion laws, or channel migration; those live in whatever drives it (for
example GRLP for vertical change, a separate
lateral-migration model, or a test).
Terraces and provenance
Each material body is a deposit that carries the age of its formation;
each stranded surface carries the age of its abandonment. A terrace is an
abandoned surface, so its age is the age of abandonment — and the deposit it is
cut on keeps its own, separate deposition age. Terrapin.terraces() reads the
benches straight from the live geometry and returns both, so a cut–fill–recut
history is legible as strath and fill terraces annotated with when they formed
and when the river left them behind.
A minimal run
from shapely.geometry import box
from terrapin import Terrapin
tp = Terrapin()
tp.set_bodies({"bedrock": box(-140.0, -80.0, 0.0, -6.0),
"alluvium": box(-140.0, -6.0, 0.0, 0.0)})
tp.set_repose_angles({"bedrock": 75.0, "alluvium": 32.0, "colluvium": 20.0})
tp.set_channel_elevation(0.0)
tp.incise(-8.0, age=5.0) # cut down; strand the land surface
tp.plane_laterally(95.0) # plane a strath (its age is set when abandoned)
tp.set_channel_width(0.0)
tp.aggrade(-3.0, age=22.0) # a valley fill
tp.incise(-20.0, age=33.0) # re-incise; strand the fill top
for t in tp.terraces():
print(t["kind"], "at z =", t["z"],
"| terrace age (abandoned) =", t["age"],
"| deposit age =", t["deposit_age"])
Install and dependencies
TerraPIN is a small pure-Python package; install it from source (pip install -e . or by putting the repository on your PYTHONPATH). The geometry engine
requires Python 3, NumPy 2, Shapely (GEOS), and SciPy;
Matplotlib is used for plotting. A dedicated environment keeps these
consistent — for example:
conda create -n terrapin numpy shapely scipy matplotlib pytest
conda run -n terrapin python -m pytest
Learn more
docs/architecture.md— the model: polygon algebra, the driver-agnostic engine, the one-wall unit, symmetric vs. the standard model, and terrace/provenance tracking.examples/— worked cross-sections, includingterrace_tracking.py(terraces read back and labelled by age) andsymmetric_valley_terraces.py(strath, talus, and fill-terrace formation).
Citing
If you use TerraPIN, please cite it: GitHub builds a ready-made citation from
CITATION.cff (the "Cite this repository" button), and every
release is archived on Zenodo with a DOI.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file terrapin_valley-0.1.0.tar.gz.
File metadata
- Download URL: terrapin_valley-0.1.0.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb0cece670b442685151c2bb21de2efbcf10572bda4dbc180d2a02e5ce3a9b92
|
|
| MD5 |
f3acad5f86d5e67eceeb8e1a34d5901a
|
|
| BLAKE2b-256 |
ea49d2277280e097570794f08377e904790fa51809c2b92328485de689274cf4
|
Provenance
The following attestation bundles were made for terrapin_valley-0.1.0.tar.gz:
Publisher:
publish.yml on MNiMORPH/TerraPIN
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
terrapin_valley-0.1.0.tar.gz -
Subject digest:
eb0cece670b442685151c2bb21de2efbcf10572bda4dbc180d2a02e5ce3a9b92 - Sigstore transparency entry: 2223767276
- Sigstore integration time:
-
Permalink:
MNiMORPH/TerraPIN@302c0b83491ef3aa94c19ebd4b73623e0e483553 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MNiMORPH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@302c0b83491ef3aa94c19ebd4b73623e0e483553 -
Trigger Event:
release
-
Statement type:
File details
Details for the file terrapin_valley-0.1.0-py3-none-any.whl.
File metadata
- Download URL: terrapin_valley-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd660589c11d40b788d6ee4ecd47a36cefa4669fce2ed4cdc1c52f055fef2ae
|
|
| MD5 |
20c63ff37ff328969dd215bc774cce03
|
|
| BLAKE2b-256 |
abeeef4e65e13a78987c76d426c34e469caa6f8efea0b00642ca13d18f60ce4b
|
Provenance
The following attestation bundles were made for terrapin_valley-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on MNiMORPH/TerraPIN
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
terrapin_valley-0.1.0-py3-none-any.whl -
Subject digest:
6bd660589c11d40b788d6ee4ecd47a36cefa4669fce2ed4cdc1c52f055fef2ae - Sigstore transparency entry: 2223767379
- Sigstore integration time:
-
Permalink:
MNiMORPH/TerraPIN@302c0b83491ef3aa94c19ebd4b73623e0e483553 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MNiMORPH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@302c0b83491ef3aa94c19ebd4b73623e0e483553 -
Trigger Event:
release
-
Statement type: