Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
600 changes: 600 additions & 0 deletions benchmarks/RASTERIZER_BENCHMARKS.md

Large diffs are not rendered by default.

720 changes: 720 additions & 0 deletions benchmarks/rasterizer_benchmarks.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/source/reference/hydrology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ Flow Accumulation

xrspatial.flow_accumulation.flow_accumulation

Flow Accumulation (D-infinity)
===============================
.. autosummary::
:toctree: _autosummary

xrspatial.flow_accumulation_dinf.flow_accumulation_dinf

Flow Accumulation (MFD)
=======================
.. autosummary::
Expand Down
1 change: 1 addition & 0 deletions xrspatial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from xrspatial.flood import inundation # noqa
from xrspatial.flood import travel_time # noqa
from xrspatial.flow_accumulation import flow_accumulation # noqa
from xrspatial.flow_accumulation_dinf import flow_accumulation_dinf # noqa
from xrspatial.flow_accumulation_mfd import flow_accumulation_mfd # noqa
from xrspatial.flow_direction import flow_direction # noqa
from xrspatial.flow_direction_dinf import flow_direction_dinf # noqa
Expand Down
5 changes: 4 additions & 1 deletion xrspatial/basin.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ def basin(flow_dir: xr.DataArray,
fd = data.astype(np.float64)
h, w = fd.shape
labels = _basins_init_labels(fd, h, w, h, w, 0, 0)
out = _watershed_cpu(fd, labels, h, w)
# Build state array: 0=nodata(NaN), 1=unresolved(-1), 3=resolved
state = np.where(np.isnan(labels), 0,
np.where(labels == -1.0, 1, 3)).astype(np.int8)
out = _watershed_cpu(fd, labels, state, h, w)

elif has_cuda_and_cupy() and is_cupy_array(data):
out = _basins_cupy(data)
Expand Down
Loading
Loading