Skip to content

Commit

Permalink
Skip neighboring cells that are nodata.
Browse files Browse the repository at this point in the history
  • Loading branch information
groutr committed Nov 8, 2023
1 parent 038fa49 commit 82b4537
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pysheds/_sgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def _d8_flowdir_numba(dem, dx, dy, dirmap, nodata_cells, nodata_out, flat=-1, pi
for k in range(8):
row_offset = row_offsets[k]
col_offset = col_offsets[k]
if nodata_cells[i + row_offset, j + col_offset]:
# this neighbor is nodata, skip
continue
distance = distances[k]
slope = (elev - dem[i + row_offset, j + col_offset]) / distance
if slope > max_slope:
Expand Down

0 comments on commit 82b4537

Please sign in to comment.