Skip to main content

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 route validation (Path Deviation Index + buffer overlap) 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 (eight): tobler, tobler_offpath, herzog, naismith, llobera_sluckin, irmischer_clarke, minetti, pandolf — each (slope, distance, **params) -> cost. pandolf reads optional mass / load / terrain keyword parameters.
  • Conductance: build_conductance (slope, optional barrier/multiplier, cost_params), 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, buffer_overlap (Goodchild & Hunter buffer method), mean_pairwise_overlap (route-stability indicator across a set of paths).
  • 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, Irmischer & Clarke, Minetti, Pandolf/Santee, White & Barber, Lewis, Goodchild & Hunter) are in docs/REFERENCES.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itinera-0.7.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itinera-0.7.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file itinera-0.7.1.tar.gz.

File metadata

  • Download URL: itinera-0.7.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for itinera-0.7.1.tar.gz
Algorithm Hash digest
SHA256 8426771d64cb8973743a00929b6b5ba7144c9b1c9f2e1f55aa3045cbcada02db
MD5 bf9c4c3bc37f6bac4c8ef11fc819ec90
BLAKE2b-256 f4488c708fe92dda61f856d9926ff14f229ef2317a1d10ba4257d520c1705217

See more details on using hashes here.

Provenance

The following attestation bundles were made for itinera-0.7.1.tar.gz:

Publisher: publish.yml on leiverkus/itinera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file itinera-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: itinera-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for itinera-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d38a9eb4dcec333fda77cccb0768551b6c543ba28edd7bce4b2c1da8de3ed6
MD5 e112df00678d443f30dc21f85a250015
BLAKE2b-256 b1911f214caac2710fd221f72ff9250c4448bca694c083d5dce03c075b5aa9ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for itinera-0.7.1-py3-none-any.whl:

Publisher: publish.yml on leiverkus/itinera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page