Anisotropic least-cost path, corridor (LCC), FETE and PDI primitives for movement modelling — pure numpy/scipy.
Project description
Itinera
Anisotropic least-cost path (LCP), corridor (LCC), From-Everywhere-To-Everywhere (FETE), stochastic / probabilistic paths and Path Deviation Index (PDI) primitives for movement modelling — a pure numpy / scipy library extracted from the Itinera QGIS plugin.
Cost is directional (uphill ≠ downhill): each DEM cell becomes a graph node,
edge weights come from a directional cost function of the signed slope, so the
conductance matrix is asymmetric — true anisotropy. Paths are solved with
scipy.sparse.csgraph.dijkstra.
pip install itinera
Only numpy and scipy are required.
Quick start
import numpy as np
from itinera import build_conductance, least_cost_path, tobler, rowcol_to_node
# A small DEM (elevations in metres) on a 10 m grid.
dem = np.random.default_rng(0).random((50, 50)) * 100.0
matrix, rows, cols = build_conductance(
dem, cellsize=10.0, cost_fn=tobler, neighbours=8)
origin = rowcol_to_node(0, 0, cols)
dest = rowcol_to_node(49, 49, cols)
path, total_cost = least_cost_path(matrix, origin, dest) # path = node indices
Turn node indices back into (row, col) with node_to_rowcol(node, cols).
What's included
- Cost functions:
tobler,tobler_offpath,herzog,naismith,llobera_sluckin— each(slope, distance) -> cost. - Conductance:
build_conductance(slope, optional barrier/multiplier),build_conductance_friction(friction raster, optional DEM). - Paths:
accumulated_cost,least_cost_path,corridor/corridor_band,fete. - Stochastic:
stochastic_lcp,add_dem_error,add_global_stochasticity. - Validation:
pdi. - Grid helpers:
xy_to_rowcol,check_/assert_regular_geotransform,check_/assert_grids_aligned. - Utilities:
estimate_conductance_bytes,format_bytes,block_reduce_mean.
Scope: bring your own raster I/O
This is a numerics library — it works on numpy arrays + a GDAL-style
geotransform tuple. It does not depend on GDAL and does not read or
write raster files. Load your DEM with whatever you already use
(rasterio, osgeo.gdal, xarray/rioxarray, …) and pass the array in.
Use a projected CRS in metres so slope and distance are metric.
Relation to the QGIS plugin
The same code ships inside the
Itinera QGIS plugin (where it is the
plugin's private core package, plus QGIS/GDAL wrappers). The PyPI package and
the QGIS plugin share the top-level import name itinera; they are meant for
separate environments. Don't pip install itinera into the Python
interpreter that runs QGIS — the plugin already bundles this code, and the two
would shadow each other on sys.path.
Licence
MIT — see LICENSE. References for the methods (Tobler, Naismith,
Herzog, Llobera & Sluckin, White & Barber, Lewis, Goodchild & Hunter) are in
docs/REFERENCES.md.
Project details
Release history Release notifications | RSS feed
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 itinera-0.6.0.tar.gz.
File metadata
- Download URL: itinera-0.6.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c44ccf5143f781468f324834dcabf4c17667f021df710c3ef11a841c6e2d1bf5
|
|
| MD5 |
36571112a5a1d837af789e78480f3be0
|
|
| BLAKE2b-256 |
ba19dff512c90d63b630d9815889843aa5527d520ef3f5d834ee0eeb19726210
|
Provenance
The following attestation bundles were made for itinera-0.6.0.tar.gz:
Publisher:
publish.yml on leiverkus/itinera
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
itinera-0.6.0.tar.gz -
Subject digest:
c44ccf5143f781468f324834dcabf4c17667f021df710c3ef11a841c6e2d1bf5 - Sigstore transparency entry: 1720259421
- Sigstore integration time:
-
Permalink:
leiverkus/itinera@43314fd190cbef3adfb4815f14f0ad7b0e691beb -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/leiverkus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43314fd190cbef3adfb4815f14f0ad7b0e691beb -
Trigger Event:
release
-
Statement type:
File details
Details for the file itinera-0.6.0-py3-none-any.whl.
File metadata
- Download URL: itinera-0.6.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6cd3d3e6fabe6e51d0541a81b02ceb92dc6b01b521dca685439401f7f660037
|
|
| MD5 |
a2cfc403962a57b3d33b1170dceb8081
|
|
| BLAKE2b-256 |
d5b9b2d16c0df9bacd551a144b205bd1549271eb635ac8afc2d9d7e663c17de5
|
Provenance
The following attestation bundles were made for itinera-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on leiverkus/itinera
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
itinera-0.6.0-py3-none-any.whl -
Subject digest:
f6cd3d3e6fabe6e51d0541a81b02ceb92dc6b01b521dca685439401f7f660037 - Sigstore transparency entry: 1720259481
- Sigstore integration time:
-
Permalink:
leiverkus/itinera@43314fd190cbef3adfb4815f14f0ad7b0e691beb -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/leiverkus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43314fd190cbef3adfb4815f14f0ad7b0e691beb -
Trigger Event:
release
-
Statement type: