3838"""
3939 Topo_water, sinks, pits, bnds = waterflows(Topo::GeoData;
4040 flowdir_fn=WhereTheWaterFlows.d8dir_feature, feedback_fn=nothing, drain_pits=true, bnd_as_sink=true,
41- rainfall = nothing)
41+ rainfall = nothing,
42+ minsize=300)
4243
4344Takes a GMG GeoData object of a topographic map and routes water through the grid. Optionally,
4445you can specify `rainfall` in which case we accumulate the rain as specified in this 2D array instead of the cellarea.
@@ -64,7 +65,7 @@ GeoData
6465```
6566
6667"""
67- function waterflows (Topo:: GeoData , flowdir_fn= WhereTheWaterFlows. d8dir_feature; feedback_fn= nothing , drain_pits= true , bnd_as_sink= true , rainfall= nothing )
68+ function waterflows (Topo:: GeoData , flowdir_fn= WhereTheWaterFlows. d8dir_feature; feedback_fn= nothing , drain_pits= true , bnd_as_sink= true , rainfall= nothing , minsize = 300 )
6869
6970 cellarea = cell_area (Topo)
7071 cellarea_m2 = cellarea
@@ -85,6 +86,8 @@ function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature;
8586 area[:,:,1 ], slen[:,:,1 ], dir[:,:,1 ], nout[:,:,1 ], nin[:,:,1 ], sinks, pits, c[:,:,1 ], bnds = waterflows (dem, cellarea, flowdir_fn;
8687 feedback_fn= feedback_fn, drain_pits= drain_pits, bnd_as_sink= bnd_as_sink)
8788
88- Topo_water = addfield (Topo,(;area, slen, dir, nout, nin, c, cellarea_m2 ))
89+ catchment_large = prune_catchments (c, minsize; val= 0 )
90+
91+ Topo_water = addfield (Topo,(;area, slen, dir, nout, nin, c, cellarea_m2, catchment_large))
8992 return Topo_water, sinks, pits, bnds
9093end
0 commit comments