Skip to content

Commit

Permalink
add missing minlength to np.bincount
Browse files Browse the repository at this point in the history
  • Loading branch information
JonKing93 authored Nov 15, 2024
1 parent 4030e60 commit 7e7c1b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pysheds/sgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ def stream_order(self, fdir, mask, dirmap=(64, 128, 1, 2, 4, 8, 16, 32),
masked_fdir = np.where(mask, fdir, 0).astype(np.int64)
startnodes = np.arange(fdir.size, dtype=np.int64)
endnodes = _self._flatten_fdir_numba(masked_fdir, dirmap).reshape(fdir.shape)
indegree = np.bincount(endnodes.ravel()).astype(np.uint8)
indegree = np.bincount(endnodes.ravel(), minlength=fdir.size).astype(np.uint8)
orig_indegree = np.copy(indegree)
startnodes = startnodes[(indegree == 0)]
min_order = np.full(fdir.shape, np.iinfo(np.int64).max, dtype=np.int64)
Expand Down Expand Up @@ -1672,7 +1672,7 @@ def _d8_distance_to_ridge(self, fdir, weights, dirmap=(64, 128, 1, 2, 4, 8, 16,
weights = (~nodata_cells).reshape(fdir.shape).astype(np.float64)
startnodes = np.arange(fdir.size, dtype=np.int64)
endnodes = _self._flatten_fdir_numba(fdir, dirmap).reshape(fdir.shape)
indegree = np.bincount(endnodes.ravel()).astype(np.uint8)
indegree = np.bincount(endnodes.ravel(), minlength=fdir.size).astype(np.uint8)
startnodes = startnodes[(indegree == 0)]
rdist = np.zeros(fdir.shape, dtype=np.float64)
if algorithm.lower() == 'iterative':
Expand Down

0 comments on commit 7e7c1b9

Please sign in to comment.