Convenience wrapper that calls fl_flood_surface() and fl_flood_depth()
in sequence, returning a multi-layer SpatRaster with the flood surface
elevation, flood depth, and a binary flooded mask.
Arguments
- dem
A
SpatRasterof elevation.- streams
A
SpatRasterof rasterized streams (output offl_stream_rasterize()). Cell values are upstream contributing area in hectares (or another proxy for channel size).- flood_factor
Numeric. Multiplier on bankfull depth to estimate flood depth. Default
6(VCA convention).- precip
A
SpatRasterof mean annual precipitation (mm), or a single numeric value applied uniformly. Default1(omits precipitation term).- max_width
Numeric. Maximum corridor width in map units (metres) within which to interpolate. Default
2000(1000m each side).
Value
A SpatRaster with three layers:
- flood_surface
Water surface elevation at stream cells (
NAelsewhere).- flood_depth
Depth above terrain (metres).
0at streams,NAwhere not flooded.- flooded
Binary mask:
1whereflood_depth > 0,0at streams,NAelsewhere.
Examples
dem <- terra::rast(system.file("testdata/dem.tif", package = "flooded"))
streams <- sf::st_read(
system.file("testdata/streams.gpkg", package = "flooded"),
quiet = TRUE
)
stream_r <- fl_stream_rasterize(streams, dem, field = "upstream_area_ha")
precip_r <- fl_stream_rasterize(streams, dem, field = "map_upstream")
flood <- fl_flood_model(dem, stream_r, flood_factor = 6, precip = precip_r)
# Three layers: flood_surface, flood_depth, flooded
names(flood)
#> [1] "flood_surface" "flood_depth" "flooded"
terra::plot(flood[["flood_depth"]], main = "Flood depth (m)")
