38
38
"""
39
39
Topo_water, sinks, pits, bnds = waterflows(Topo::GeoData;
40
40
flowdir_fn=WhereTheWaterFlows.d8dir_feature, feedback_fn=nothing, drain_pits=true, bnd_as_sink=true,
41
- rainfall = nothing)
41
+ rainfall = nothing,
42
+ minsize=300)
42
43
43
44
Takes a GMG GeoData object of a topographic map and routes water through the grid. Optionally,
44
45
you 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
64
65
```
65
66
66
67
"""
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 )
68
69
69
70
cellarea = cell_area (Topo)
70
71
cellarea_m2 = cellarea
@@ -85,6 +86,8 @@ function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature;
85
86
area[:,:,1 ], slen[:,:,1 ], dir[:,:,1 ], nout[:,:,1 ], nin[:,:,1 ], sinks, pits, c[:,:,1 ], bnds = waterflows (dem, cellarea, flowdir_fn;
86
87
feedback_fn= feedback_fn, drain_pits= drain_pits, bnd_as_sink= bnd_as_sink)
87
88
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))
89
92
return Topo_water, sinks, pits, bnds
90
93
end
0 commit comments