Note: This document is for an older version of GRASS GIS that is outdated. You should upgrade, and read the current manual page.
The module fills a lake to a target water level from a given start point. The user can think of it as r.grow with additional checks for elevation. The resulting raster map contains cells with values representing lake depth and NULL for all other cells beyond the lake. Lake depth is reported relative to specified water level (specified level = 0 depth).
This module uses a 3x3 moving window approach to find all cells that match three criteria and to define the lake:
The water level must be in DEM units.
The module will create a new map (lake=foo) or can be set to replace the input (seed=bar) map if the -o flag is used. The user can use -o flag to create animations of rising water level without producing a separate map for each frame. An initial seed map must be created to start the sequence, and will be overwritten during subsequent runs with resulting water levels maps (i.e., a single file serves for both input and output).
Negative output (the -n flag) is useful for visualisations in NVIZ. It equals the mapcalc's expression "negative = 0 - positive".
${seedmap} = if( ${dem}, \ if( if( isnull(${seedmap}),0,${seedmap}>0), ${wlevel}-${dem}, \ if( \ if(isnull(${seedmap}[-1,0]),0, ${seedmap}[-1,0]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[-1,1]),0, ${seedmap}[-1,1]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[0,1]), 0, ${seedmap}[0,1]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[1,1]), 0, ${seedmap}[1,1]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[1,0]), 0, ${seedmap}[1,0]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[1,-1]),0, ${seedmap}[1,-1]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[0,-1]),0, ${seedmap}[0,-1]>0 && ${wlevel}>${dem}) ||\ if(isnull(${seedmap}[-1,-1]),0, ${seedmap}[-1,-1]>0 && ${wlevel}>${dem}),\ ${wlevel}-${dem}, null() )))
The ${seedmap} variable is replaced by seed map names, ${dem} with DEM map name, and ${wlevel} with target water level. To get single water level, this code block is called with same level numerous times (in a loop) as the lake grows by single cells during single run.
g.region raster=elev_lid792_1m -p # water accumulation next to street dam r.lake elev_lid792_1m coordinates=638759.3,220264.1 water_level=113.4 lake=flooding # draw resulting lake map over shaded terrain map r.relief input=elev_lid792_1m output=elev_lid792_1m_shade d.rast elev_lid792_1m_shade d.rast flooding d.vect streets_wake
Available at: r.lake source code (history)
Latest change: Thu Feb 3 11:10:06 2022 in commit: 73413160a81ed43e7a5ca0dc16f0b56e450e9fef
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2022 GRASS Development Team, GRASS GIS 8.0.3dev Reference Manual