Skip to content

Commit 1fdfc89

Browse files
committed
Add stream link segmentation module with all four backends
Assigns unique position-based IDs to each stream segment between junctions, headwaters, and outlets. Supports numpy, cupy, dask+numpy, and dask+cupy backends.
1 parent 34a6cb3 commit 1fdfc89

File tree

5 files changed

+1136
-0
lines changed

5 files changed

+1136
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ In the GIS world, rasters are used for representing continuous phenomena (e.g. e
247247
| [Flow Accumulation (D8)](xrspatial/flow_accumulation.py) | Counts upstream cells draining through each cell in a D8 flow direction grid | ✅️ | ✅️ | ✅️ | ✅️ |
248248
| [Watershed](xrspatial/watershed.py) | Labels each cell with the pour point it drains to via D8 flow direction | ✅️ | ✅️ | ✅️ | ✅️ |
249249
| [Basins](xrspatial/watershed.py) | Delineates drainage basins by labeling each cell with its outlet ID | ✅️ | ✅️ | ✅️ | ✅️ |
250+
| [Stream Order](xrspatial/stream_order.py) | Assigns Strahler or Shreve stream order to cells in a drainage network | ✅️ | ✅️ | ✅️ | ✅️ |
251+
| [Stream Link](xrspatial/stream_link.py) | Assigns unique IDs to each stream segment between junctions | ✅️ | ✅️ | ✅️ | ✅️ |
250252

251253
-----------
252254

xrspatial/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from xrspatial.proximity import manhattan_distance # noqa
3636
from xrspatial.proximity import proximity # noqa
3737
from xrspatial.sink import sink # noqa
38+
from xrspatial.stream_link import stream_link # noqa
3839
from xrspatial.stream_order import stream_order # noqa
3940
from xrspatial.slope import slope # noqa
4041
from xrspatial.surface_distance import surface_allocation # noqa

xrspatial/accessor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def stream_order(self, flow_accum, **kwargs):
8787
from .stream_order import stream_order
8888
return stream_order(self._obj, flow_accum, **kwargs)
8989

90+
def stream_link(self, flow_accum, **kwargs):
91+
from .stream_link import stream_link
92+
return stream_link(self._obj, flow_accum, **kwargs)
93+
9094
def viewshed(self, x, y, **kwargs):
9195
from .viewshed import viewshed
9296
return viewshed(self._obj, x, y, **kwargs)
@@ -317,6 +321,10 @@ def stream_order(self, flow_accum, **kwargs):
317321
from .stream_order import stream_order
318322
return stream_order(self._obj, flow_accum, **kwargs)
319323

324+
def stream_link(self, flow_accum, **kwargs):
325+
from .stream_link import stream_link
326+
return stream_link(self._obj, flow_accum, **kwargs)
327+
320328
# ---- Classification ----
321329

322330
def natural_breaks(self, **kwargs):

0 commit comments

Comments
 (0)