diff --git a/src/topotoolbox/flow_object.py b/src/topotoolbox/flow_object.py index 4ff453e..579540d 100644 --- a/src/topotoolbox/flow_object.py +++ b/src/topotoolbox/flow_object.py @@ -16,7 +16,8 @@ class FlowObject(): """ def __init__(self, grid: GridObject, - bc: np.ndarray | GridObject | None = None): + bc: np.ndarray | GridObject | None = None, + hybrid : bool = True): """The constructor for the FlowObject. Takes a GridObject as input, computes flow direction information and saves them as an FlowObject. @@ -58,7 +59,11 @@ def __init__(self, grid: GridObject, if isinstance(bc, GridObject): bc = bc.z - _grid.fillsinks(filled_dem, dem, bc, dims) + queue = np.zeros_like(dem, dtype=np.int64, order='F') + if hybrid: + _grid.fillsinks_hybrid(filled_dem, queue, dem, bc, dims) + else: + _grid.fillsinks(filled_dem, dem, bc, dims) if restore_nans: dem[nans] = np.nan @@ -73,7 +78,7 @@ def __init__(self, grid: GridObject, dist = np.zeros_like(flats, dtype=np.float32, order='F') prev = conncomps # prev: dtype=np.int64 - heap = np.zeros_like(flats, dtype=np.int64, order='F') + heap = queue # heap: dtype=np.int64 back = np.zeros_like(flats, dtype=np.int64, order='F') _grid.gwdt(dist, prev, costs, flats, heap, back, dims)