r.mapcalc.simple.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <h2>DESCRIPTION</h2>
  2. <em>r.mapcalc.simple</em> provides a wrapper to <em>r.mapcalc</em>.
  3. Up to 6 maps can be combined using simple expressions.
  4. <p>
  5. The general syntax for the <b>expression</b> follows
  6. <em><a href="r.mapcalc.html">r.mapcalc</a></em> expression format,
  7. for example, <tt>A + B</tt> or <tt>exp(A + B)</tt> are valid.
  8. The variables A, B, ..., F represent raster maps which are provided
  9. as options <b>a</b>, <b>b</b>, ..., <b>f</b>.
  10. <p>
  11. The result name, i.e. the output raster map, is provided using the
  12. option <b>output</b> and, unlike <em>r.mapcalc</em> it is not part
  13. of the expression.
  14. <p>
  15. This module is meant for convenience (for users and programmers) while
  16. the <em>r.mapcalc</em> module is a better choice for more complex
  17. expressions and advanced usage.
  18. <h2>NOTES</h2>
  19. Differences to <em>r.mapcalc</em> module:
  20. <ul>
  21. <li>The input raster map names and the output map raster name are
  22. separate from the expression (formula) which uses generic
  23. variable names (A, B, C, ...).
  24. <li>The output raster name is not included in the expression.
  25. <li>The expression is expected to be a single short one liner
  26. without the function <tt>eval()</tt>.
  27. </ul>
  28. Differences to <em>r.mapcalc.simple</em> module in GRASS GIS 5 and 6:
  29. <ul>
  30. <li>The primary purpose is not being a GUI front end to
  31. <em>r.mapcalc</em>, but a wrapper which allows easy building of
  32. interfaces to <em>r.mapcalc</em> (including GUIs).
  33. <li>Whitespace (most notably spaces) are allowed
  34. (in the same way as for <em>r.mapcalc</em>).
  35. <li>The variable names are case-insensitive to allow the original
  36. uppercase as well as lowercase as in option names
  37. (unless the <b>-c</b> flag is used).
  38. <li>Option names for each map are just one letter (not amap, etc.).
  39. <li>Output option name is <b>output</b> as for other modules
  40. (not outfile).
  41. <li>Raster map names can be optionally quoted (the <b>-q</b> flag).
  42. <li>There is no expert mode
  43. (which was just running <em>r.mapcalc</em>).
  44. <li>The <b>expression</b> option is first, so it is possible to
  45. omit its name in the command line
  46. (just like with <em>r.mapcalc</em>).
  47. <li>Overwriting of outputs is done in the same way as with other
  48. modules, so there is no flag to not overwrite outputs.
  49. </ul>
  50. <h2>EXAMPLES</h2>
  51. <h3>Basic examples</h3>
  52. <div class="code"><pre>
  53. r.mapcalc.simple expression="0" output=zeros
  54. r.mapcalc.simple expression="1" output=ones
  55. r.mapcalc.simple expression="2" output=twos
  56. </pre></div>
  57. <div class="code"><pre>
  58. r.mapcalc.simple expression="A + B + C" a=zeros b=ones c=twos output=result1
  59. </pre></div>
  60. <div class="code"><pre>
  61. r.mapcalc.simple expression="(A * B) / 2 + 3 * C" a=zeros b=ones c=twos output=result2
  62. </pre></div>
  63. <div align="center" style="margin: 10px">
  64. <img src="r_mapcalc_simple.png" width="594px" height="495px"><br>
  65. <i>Figure: r.mapcalc.simple graphical user interface</i>
  66. </div>
  67. <h3>Example expressions</h3>
  68. Addition:
  69. <div class="code"><pre>
  70. A + B
  71. </pre></div>
  72. No spaces around operators are not recommended for readability,
  73. but allowed in the expression:
  74. <div class="code"><pre>
  75. A+B
  76. </pre></div>
  77. More complex expression with a function:
  78. <p>
  79. <div class="code"><pre>
  80. exp(A+C)+(B-2)*7
  81. </pre></div>
  82. <h2>SEE ALSO</h2>
  83. <em>
  84. <a href="r.mapcalc.html">r.mapcalc</a>,
  85. <a href="r3.mapcalc.html">r3.mapcalc</a>,
  86. <a href="t.rast.mapcalc.html">t.rast.mapcalc</a>,
  87. <a href="g.region.html">g.region</a>
  88. </em>
  89. <h2>AUTHORS</h2>
  90. Vaclav Petras, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll Lab</a><br>
  91. Michael Barton, Arizona State University (updated to GRASS 5.7)<br>
  92. R. Brunzema (original 5.0 Bash version)
  93. <!--
  94. <p>
  95. <i>Last changed: $Date$</i>
  96. -->