Commit dcda2de
authored
* Fixes #733: add cost_distance() for weighted proximity via multi-source Dijkstra
New cost_distance() function computes minimum accumulated traversal cost
through a friction surface to reach the nearest target pixel, the raster
equivalent of GRASS r.cost / ArcGIS Cost Distance. Supports numpy and
dask+numpy backends, 4/8-connectivity, max_cost truncation for dask
scalability, and xr.Dataset input via @supports_dataset. Includes 19
tests and an example notebook comparing cost_distance with proximity.
* Add cost_distance to README feature matrix
* Add k-d tree dask path for unbounded proximity to avoid single-chunk rechunk
The existing dask proximity path rechunked the entire raster into one chunk
when max_distance was unbounded, defeating dask's out-of-core purpose. This
adds a two-phase scipy.spatial.cKDTree approach: Phase 1 streams chunks to
collect target coordinates, Phase 2 queries the tree per-chunk via map_blocks.
Exact results, memory proportional to targets not raster size. Supports
EUCLIDEAN and MANHATTAN metrics; GREAT_CIRCLE/ALLOCATION/DIRECTION fall back
to the existing single-chunk path. Gracefully degrades when scipy is absent.
1 parent 97e28c4 commit dcda2de
File tree
8 files changed
+1608
-10
lines changed- examples/user_guide
- xrspatial
- tests
8 files changed
+1608
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
0 commit comments