Skip to content

Commit

Permalink
add a few more fields to simplify plotting the largest catchment
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Jul 3, 2024
1 parent 004c293 commit af53201
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/WaterFlow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature;
feedback_fn=feedback_fn, drain_pits=drain_pits, bnd_as_sink=bnd_as_sink)

catchment_large = prune_catchments(c, minsize; val=0)

Topo_water = addfield(Topo,(;area, slen, dir, nout, nin, c, cellarea_m2, catchment_large))
largest_catchment = catchment_large .== maximum(catchment_large)
largest_area = copy(area)
largest_area[.!largest_catchment] .= NaN

log10_area = log10.(area)
log10_largest_area = log10.(largest_area)

Topo_water = addfield(Topo,(;area, slen, dir, nout, nin, c, cellarea_m2, catchment_large, log10_area, largest_catchment, largest_area, log10_largest_area))
return Topo_water, sinks, pits, bnds
end

0 comments on commit af53201

Please sign in to comment.