1r.lake(1)                     Grass User's Manual                    r.lake(1)
2
3
4

NAME

6       r.lake  - Fills lake from seed at given level
7

KEYWORDS

9       raster
10

SYNOPSIS

12       r.lake
13       r.lake help
14       r.lake   [-no]   dem=name   wl=float    [lake=name]     [xy=east,north]
15       [seed=name]   [--overwrite]  [--verbose]  [--quiet]
16
17   Flags:
18       -n
19           Use negative depth values for lake raster map
20
21       -o
22           Overwrite seed map with result (lake) map
23
24       --overwrite
25           Allow output files to overwrite existing files
26
27       --verbose
28           Verbose module output
29
30       --quiet
31           Quiet module output
32
33   Parameters:
34       dem=name
35           Terrain raster map (DEM)
36
37       wl=float
38           Water level
39
40       lake=name
41           Output raster map with lake
42
43       xy=east,north
44           Seed point coordinates
45
46       seed=name
47           Raster map with seed (at least 1 cell > 0)
48

DESCRIPTION

50       The module fills a lake to a target water  level  from  a  given  start
51       point.  The  user  can think of it as r.grow with additional checks for
52       elevation.  The resulting raster map contains cells with values  repre‐
53       senting lake depth and NULL for all other cells beyond the lake.
54
55       This  module  uses  a 3x3 moving window approach to find all cells that
56       match three criteria and to define the lake:
57
58                     cells are below  the  specified  elevation  (i.e.,  water
59                     level);
60
61                     cells  are  connected  with  an initial cell (seed or E,N
62                     value);
63
64                     cells are not NULL or masked.
65
66       The water level must be in DEM units.
67
68       The seed (starting) point can be a raster map with at  least  one  cell
69       value  greater  than  zero, or a seed point can be specified as an E, N
70       coordinate pair. If the seed is specified  as  a  coordinate  pair,  an
71       additional  check  is  done to make sure that the target water level is
72       above the level of the DEM. When a raster map is used as a  seed,  how‐
73       ever,  no  such checks are done.  Specifying a target water level below
74       surface represented by DEM will result in an empty map. Note: a  raster
75       lake map created in a previous run can also be used as a seed map for a
76       new run to simulate rising water levels.
77
78       The module will create a new map (lake=foo) or can be  set  to  replace
79       the  input  (seed=bar) map if the -o flag is used.  The user can use -o
80       flag to create animations of rising water  level  without  producing  a
81       separate  map  for  each frame.  An initial seed map must be created to
82       start the sequence, and will be overwritten during subsequent runs with
83       resulting  water levels maps (i.e., a single file serves for both input
84       and output).
85
86       Negative output (the -n flag) is useful for visualisations in NVIZ.  It
87       equals the mapcalc's expression "negative = 0 - positive".
88

KNOWN BUGS AND LIMITATIONS

90                     The entire map is loaded into RAM.
91
92                     The  module  is NOT large file safe. (due to the previous
93                     point)
94
95                     A completely negative seed map will not  work!  At  least
96                     one  cell must have a value >0. Output from r.lake -n can
97                     NOT be used as input in the next run.
98

MAPCALC EQUIVALENT - FOR GRASS HACKERS

100       This module was initially created as a script using r.mapcalc. This had
101       some  limitations  -  it  was slow and no checks where done to find out
102       required iteration count. The shell script code (using r.mapcalc)  used
103       in the original script is shown below:
104       ${seedmap} = if( ${dem}, \
105       if( if( isnull(${seedmap}),0,${seedmap}>0), ${wlevel}-${dem}, \
106        if( \
107         if(isnull(${seedmap}[-1,0]),0,          ${seedmap}[-1,0]>0         &&
108       ${wlevel}>${dem}) ||\
109         if(isnull(${seedmap}[-1,1]),0,         ${seedmap}[-1,1]>0          &&
110       ${wlevel}>${dem}) ||\
111         if(isnull(${seedmap}[0,1]),       0,       ${seedmap}[0,1]>0       &&
112       ${wlevel}>${dem}) ||\
113         if(isnull(${seedmap}[1,1]),      0,       ${seedmap}[1,1]>0        &&
114       ${wlevel}>${dem}) ||\
115         if(isnull(${seedmap}[1,0]),       0,       ${seedmap}[1,0]>0       &&
116       ${wlevel}>${dem}) ||\
117         if(isnull(${seedmap}[1,-1]),0,         ${seedmap}[1,-1]>0          &&
118       ${wlevel}>${dem}) ||\
119         if(isnull(${seedmap}[0,-1]),0,          ${seedmap}[0,-1]>0         &&
120       ${wlevel}>${dem}) ||\
121         if(isnull(${seedmap}[-1,-1]),0,        ${seedmap}[-1,-1]>0         &&
122       ${wlevel}>${dem}),\
123        ${wlevel}-${dem}, null() )))
124        The ${seedmap} variable is replaced by seed map names, ${dem} with DEM
125       map name, and ${wlevel} with target water level.  To get  single  water
126       level,  this  code block is called with same level numerous times (in a
127       loop) as the lake grows by single cells during single run.
128

SEE ALSO

130       r.mapcalc, r.grow, r.plane
131

AUTHOR

133       Maris Nartiss (maris.nartiss gmail.com)
134
135       Last changed: $Date: 2006-05-23 18:50:05 +0200 (Tue, 23 May 2006) $
136
137       Full index
138
139       © 2003-2008 GRASS Development Team
140
141
142
143GRASS 6.3.0                                                          r.lake(1)
Impressum