Skip to content

Commit af993c4

Browse files
committed
add large catchment areas
1 parent aaacb02 commit af993c4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/WaterFlow.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ end
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
4344
Takes a GMG GeoData object of a topographic map and routes water through the grid. Optionally,
4445
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
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
9093
end

0 commit comments

Comments
 (0)