Skip to content

Add D-infinity flow length computation#1013

Merged
brendancol merged 1 commit into
masterfrom
issue-1012
Mar 16, 2026
Merged

Add D-infinity flow length computation#1013
brendancol merged 1 commit into
masterfrom
issue-1012

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • New flow_length_dinf() function: proportion-weighted flow path lengths from D-inf angle grids
  • Uses Tarboton's two-neighbor angle decomposition to split flow between adjacent cells
  • Downstream mode: weighted-average distance to outlet
  • Upstream mode: longest flow path from any divide
  • NumPy, CuPy, Dask+NumPy, Dask+CuPy backends
  • 25 tests for correctness, edge cases, and cross-backend consistency
  • Also fixes the missing flow_accumulation_dinf entry in the README feature matrix

All three routing schemes (D8, D-inf, MFD) now have matching flow length functions.

Closes #1012

Test plan

  • 11 correctness tests (cardinal, diagonal, proportional split, pit, NaN, rectangular cells, integration with flow_direction_dinf)
  • 8 Dask cross-backend tests (4 chunk sizes x 2 directions)
  • 2 Dask cross-tile boundary tests
  • 2 CuPy cross-backend tests
  • 2 Dask+CuPy cross-backend tests

@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Mar 16, 2026
New flow_length_dinf() computes flow path lengths from D-inf angle
grids using Tarboton's two-neighbor angle decomposition. Downstream
mode gives the proportion-weighted distance to outlet; upstream mode
gives the longest path from any divide.

All four backends: NumPy, CuPy, Dask+NumPy, Dask+CuPy.
25 tests covering correctness, edge cases, and cross-backend consistency.

Also adds the missing flow_accumulation_dinf entry to the README
feature matrix.
@brendancol brendancol merged commit 7215a6f into master Mar 16, 2026
11 checks passed
@brendancol brendancol deleted the issue-1012 branch May 4, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add D-infinity flow length computation

1 participant