Python bindings
lsdtt3 is the Python interface to LSDTopoTools3. It keeps raster data and
analysis results in memory, so a script can compose terrain, flow, channel,
basin, chi, cosmogenic, and hydraulic operations without temporary parameter
files.
Installation
Install it from PyPI into a virtual, conda or pixi environment, not your system Python:
python -m pip install lsdtt3
python -c "import lsdtt3; print(lsdtt3.__version__)"
It needs Python 3.12 or later, on Linux (x86_64), macOS (Apple Silicon and
Intel) or Windows (x64). In Google Colab, run !pip install lsdtt3 in a cell.
The same wheels, and those of older versions that are not on PyPI, are
attached to each GitHub release;
the installation guide
shows how to install one of those.
The bindings cover part of lsdtt3; the complete software is its
command-line tools, and some analyses exist only as tools. The wheel installs
all of them as commands too (lsdtt-*, the same set as the Linux release
package), so with this package you have everything and do not need a backend
package. It is self-contained: it bundles GDAL and PROJ. If you also have a
release package on PATH, see
Having both installed. The
python_binding_examples notebook in the lsdtt3_notebooks repository
installs the package and runs a complete basin, slope-area and chi workflow.
For development from a clone, see
Building the Python wheels.
Start here
- Load, inspect, and save a DEM.
- Fetch a DEM when you do not already have one.
- Build a flow, channel, and basin workflow.
- Continue with chi and ksn, channel-head extraction, floodplains, terraces and valleys, ridgeline profiles, slope-area and low-concavity reaches, slope stability, hillslope-channel tagging, or the cosmogenic and GraphFlood tools as needed.
Core ideas
Rasterstores values, nodata mask, georeferencing, and CRS together.FlowInfois the D8 foundation for channels, basins, and chi.FlowGraphprovides distributed D-infinity or MFD routing products.- Result objects retain related rasters and tables rather than writing files implicitly.
- The wheels carry their own GDAL and PROJ, with their data files, and
lsdtt3points itself at them internally. It does not setGDAL_DATA,PROJ_DATAorPROJ_LIB, so other geospatial libraries in the same Python session (pyproj, rasterio, GMT) keep using their own data. (The 0.7.1 wheels did set them; if pyproj then fails to open its database, remove the three variables afterimport lsdtt3.)
The API reference is generated from the installed Python API. Guides explain a workflow; API pages specify the exact callable.