Sponsor:

Your company here — click to reach over 10,000 unique daily visitors

r.mapcalc.simple.1grass - Man Page

Calculates a new raster map from a simple r.mapcalc expression.

Keywords

raster, algebra, simple

Synopsis

r.mapcalc.simple
r.mapcalc.simple --help
r.mapcalc.simple [-sqc] expression=string  [a=name]   [b=name]   [c=name]   [d=name]   [e=name]   [f=name]  output=name  [seed=integer]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

Flags

-s

Generate random seed (result is non-deterministic)

-q

Quote the map names

-c

Case sensitive variable names

--overwrite

Allow output files to overwrite existing files

--help

Print usage summary

--verbose

Verbose module output

--quiet

Quiet module output

--ui

Force launching GUI dialog

Parameters

expression=string [required]

Formula (e.g. A-B or A*C+B)

a=name

Name of input A raster map

b=name

Name of input B raster map

c=name

Name of input C raster map

d=name

Name of input D raster map

e=name

Name of input E raster map

f=name

Name of input F raster map

output=name [required]

Name for output raster map

seed=integer

Seed for rand() function

Description

r.mapcalc.simple provides a wrapper to r.mapcalc. Up to 6 maps can be combined using simple expressions.

The general syntax for the expression follows r.mapcalc expression format, for example, A + B or exp(A + B) are valid. The variables A, B, ..., F represent raster maps which are provided as options a, b, ..., f.

The result name, i.e. the output raster map, is provided using the option output and, unlike r.mapcalc it is not part of the expression.

This module is meant for convenience (for users and programmers) while the r.mapcalc module is a better choice for more complex expressions and advanced usage.

Notes

Differences to r.mapcalc module:

Differences to r.mapcalc.simple module in GRASS GIS 5 and 6:

Examples

Basic examples

r.mapcalc.simple expression="0" output=zeros
r.mapcalc.simple expression="1" output=ones
r.mapcalc.simple expression="2" output=twos
r.mapcalc.simple expression="A + B + C" a=zeros b=ones c=twos output=result1
r.mapcalc.simple expression="(A * B) / 2 + 3 * C" a=zeros b=ones c=twos output=result2

Figure: r.mapcalc.simple graphical user interface

Example expressions

Addition:

A + B

No spaces around operators are not recommended for readability, but allowed in the expression:

A+B

More complex expression with a function:

exp(A+C)+(B-2)*7

See Also

r.mapcalc, r3.mapcalc, t.rast.mapcalc, g.region

Authors

Vaclav Petras, NCSU GeoForAll Lab
Michael Barton, Arizona State University (updated to GRASS 5.7)
R. Brunzema (original 5.0 Bash version)

Source Code

Available at: r.mapcalc.simple source code (history)

Accessed: Tuesday May 14 13:42:01 2024

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.2 Reference Manual

Info

GRASS 8.3.2 GRASS GIS User's Manual