1r.mapcalc.simple(1) GRASS GIS User's Manual r.mapcalc.simple(1)
2
3
4
6 r.mapcalc.simple - Calculates a new raster map from a simple r.mapcalc
7 expression.
8
10 raster, algebra, simple
11
13 r.mapcalc.simple
14 r.mapcalc.simple --help
15 r.mapcalc.simple [-sqc] expression=string [a=name] [b=name]
16 [c=name] [d=name] [e=name] [f=name] output=name [seed=integer]
17 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
18
19 Flags:
20 -s
21 Generate random seed (result is non-deterministic)
22
23 -q
24 Quote the map names
25
26 -c
27 Case sensitive variable names
28
29 --overwrite
30 Allow output files to overwrite existing files
31
32 --help
33 Print usage summary
34
35 --verbose
36 Verbose module output
37
38 --quiet
39 Quiet module output
40
41 --ui
42 Force launching GUI dialog
43
44 Parameters:
45 expression=string [required]
46 Formula (e.g. A-B or A*C+B)
47
48 a=name
49 Name of input A raster map
50
51 b=name
52 Name of input B raster map
53
54 c=name
55 Name of input C raster map
56
57 d=name
58 Name of input D raster map
59
60 e=name
61 Name of input E raster map
62
63 f=name
64 Name of input F raster map
65
66 output=name [required]
67 Name for output raster map
68
69 seed=integer
70 Seed for rand() function
71
73 r.mapcalc.simple provides a wrapper to r.mapcalc. Up to 6 maps can be
74 combined using simple expressions.
75
76 The general syntax for the expression follows r.mapcalc expression for‐
77 mat, for example, A + B or exp(A + B) are valid. The variables A, B,
78 ..., F represent raster maps which are provided as options a, b, ...,
79 f.
80
81 The result name, i.e. the output raster map, is provided using the
82 option output and, unlike r.mapcalc it is not part of the expression.
83
84 This module is meant for convenience (for users and programmers) while
85 the r.mapcalc module is a better choice for more complex expressions
86 and advanced usage.
87
89 Differences to r.mapcalc module:
90
91 · The input raster map names and the output map raster name are
92 separate from the expression (formula) which uses generic vari‐
93 able names (A, B, C, ...).
94
95 · The output raster name is not included in the expression.
96
97 · The expression is expected to be a single short one liner with‐
98 out the function eval().
99 Differences to r.mapcalc.simple module in GRASS GIS 5 and 6:
100
101 · The primary purpose is not being a GUI front end to r.mapcalc,
102 but a wrapper which allows easy building of interfaces to
103 r.mapcalc (including GUIs).
104
105 · Whitespace (most notably spaces) are allowed (in the same way
106 as for r.mapcalc).
107
108 · The variable names are case-insensitive to allow the original
109 uppercase as well as lowercase as in option names (unless the
110 -c flag is used).
111
112 · Option names for each map are just one letter (not amap, etc.).
113
114 · Output option name is output as for other modules (not out‐
115 file).
116
117 · Raster map names can be optionally quoted (the -q flag).
118
119 · There is no expert mode (which was just running r.mapcalc).
120
121 · The expression option is first, so it is possible to omit its
122 name in the command line (just like with r.mapcalc).
123
124 · Overwriting of outputs is done in the same way as with other
125 modules, so there is no flag to not overwrite outputs.
126
128 Basic examples
129 r.mapcalc.simple expression="0" output=zeros
130 r.mapcalc.simple expression="1" output=ones
131 r.mapcalc.simple expression="2" output=twos
132 r.mapcalc.simple expression="A + B + C" a=zeros b=ones c=twos output=result1
133 r.mapcalc.simple expression="(A * B) / 2 + 3 * C" a=zeros b=ones c=twos output=result2
134 Figure: r.mapcalc.simple graphical user interface
135
136 Example expressions
137 Addition:
138 A + B
139 No spaces around operators are not recommended for readability, but
140 allowed in the expression:
141 A+B
142 More complex expression with a function:
143
144 exp(A+C)+(B-2)*7
145
147 r.mapcalc, r3.mapcalc, t.rast.mapcalc, g.region
148
150 Vaclav Petras, NCSU GeoForAll Lab
151 Michael Barton, Arizona State University (updated to GRASS 5.7)
152 R. Brunzema (original 5.0 Bash version)
153
155 Available at: r.mapcalc.simple source code (history)
156
157 Main index | Raster index | Topics index | Keywords index | Graphical
158 index | Full index
159
160 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
161
162
163
164GRASS 7.8.5 r.mapcalc.simple(1)