From 7e7c1b97c6f216416a88f729dc6549f507e94305 Mon Sep 17 00:00:00 2001 From: Jonathan King Date: Fri, 15 Nov 2024 13:29:07 -0700 Subject: [PATCH] add missing minlength to np.bincount --- pysheds/sgrid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pysheds/sgrid.py b/pysheds/sgrid.py index 8a1cb65..9fb69ce 100644 --- a/pysheds/sgrid.py +++ b/pysheds/sgrid.py @@ -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) @@ -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':