connectivity-core
Multi-resolution landscape connectivity on in-memory raster arrays: habitat and PARC
connectedness, the Bioclimatic Ecosystem Resilience Index (BERI), and fractional pixel
coverage of polygons. This crate is the numerical engine of the
eco-connectivity Python package; see
Valavi et al. (2026) for the method.
It has no Python, GDAL or file I/O dependencies. Callers read rasters, pass ndarray arrays
of one tile, and handle file formats, tiling and post-processing such as Connected Habitat.
[]
= "0.1"
It requires Rust 1.86 or later.
use Array2;
use ;
let condition = from_shape_fn;
let mask = condition.mapv;
let levels = ;
// rasterio/affine (a, b, c, d, e, f) order; projected grids in metres
let transforms = level_transforms;
let inputs = Inputs ;
let config = Config ;
let connectedness = connectivity?;
Public API
connectivity(&Inputs, &Config): connectedness, or BERI whenInputs::transgridsholds the current climate followed by future scenarios (each(rows, cols, bands)). Returns an array with the condition array's shape, NaN where the mask istrue.Inputs: borrowed condition, mask, optional traversal and transgrids, and level transforms.Config: levels, lambdas (km),is_geo,max_cost, window sizes, global tile offsets, window mode and PARCpa_to_pagating.Config::default()matches the Python defaults.pixel_coverage(&[Polygon], &Affine, nrows, ncols): fraction of each pixel covered by polygons with holes.Affineandlevel_transforms: (row, col) to world transforms and the per-level transforms of a tile, anchored to the full raster's grid.WindowMode: circular or square annuli.
The crate documentation covers array shapes, mask semantics, BERI scenario and band order, coordinate units, tile offsets, the preparation and post-processing left to callers, and the error and panic conditions. Work runs on the current Rayon thread pool; results are bit-identical for any number of threads on the same build and platform.
cargo run --release -p connectivity-core --example synthetic runs every indicator on
synthetic arrays.
Versioning and releases
The crate is versioned independently of the Python package (eco-connectivity 2.4.0 uses
connectivity-core 0.1.0). Core releases are tagged connectivity-core-vX.Y.Z; Python
releases keep vX.Y.Z tags, and only those publish to PyPI. Changes to the crate are listed
in CHANGELOG.md.
License
MIT