[GRASS-SVN] r68562 - in grass/trunk/raster: . r.mapcalc

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 1 11:14:10 PDT 2016


Author: neteler
Date: 2016-06-01 11:14:10 -0700 (Wed, 01 Jun 2016)
New Revision: 68562

Modified:
   grass/trunk/raster/r.mapcalc/r.mapcalc.html
   grass/trunk/raster/rasterintro.html
Log:
r.mapcalc manual/rasterintro: explain precision differences

Modified: grass/trunk/raster/r.mapcalc/r.mapcalc.html
===================================================================
--- grass/trunk/raster/r.mapcalc/r.mapcalc.html	2016-06-01 17:51:41 UTC (rev 68561)
+++ grass/trunk/raster/r.mapcalc/r.mapcalc.html	2016-06-01 18:14:10 UTC (rev 68562)
@@ -625,32 +625,60 @@
 the <b>seed</b> option nor the <b>-s</b> flag are given.
 
 <h2>EXAMPLES</h2>
+
 To compute the average of two raster map layers
 <em>a</em> and <em>b</em>:
 <div class="code"><pre>
 ave = (a + b)/2
 </pre></div>
+
+<p>
 To form a weighted average:
 <div class="code"><pre>
 ave = (5*a + 3*b)/8.0
 </pre></div>
+
+<p>
 To produce a binary representation of the raster map layer
 <em>a</em> so that category 0 remains 0 and all other categories become 1:
 <div class="code"><pre>
-mask = a != 0
+mapmask = a != 0
 </pre></div>
 This could also be accomplished by:
 <div class="code"><pre>
-mask = if(a)
+mapmask = if(a)
 </pre></div>
+
+<p>
 To mask raster map layer <em>b</em> by raster map layer <em>a</em>:
 <div class="code"><pre>
 result = if(a,b)
 </pre></div>
+
+<p>
 To change all values below 5 to NULL:
 <div class="code"><pre>
 newmap = if(map<5, null(), 5)
 </pre></div>
+
+<p>
+To create a map with random values in a defined range (needs either the
+usage of <b>-s</b> flag or the <em>seed</em> parameter). The precision of
+the input values determines the output precision (the resulting
+<a href="rasterintro.html#raster-format">raster map type</a>):
+
+<div class="code"><pre>
+# write result as integer map (CELL)
+random_int   = rand(-100,100)
+
+# write result as double precision floating point map (DCELL)
+random_dcell = rand(-100.0,100.0)
+
+# write result as double precision floating point map (FCELL)
+random_fcell = float(rand(-100.0,100.0))
+</pre></div>
+
+<p>
 The graph() function allows users to specify a x-y conversion using 
 pairs of x,y coordinates.
 In some situations a transformation from one value to another is not

Modified: grass/trunk/raster/rasterintro.html
===================================================================
--- grass/trunk/raster/rasterintro.html	2016-06-01 17:51:41 UTC (rev 68561)
+++ grass/trunk/raster/rasterintro.html	2016-06-01 18:14:10 UTC (rev 68562)
@@ -242,25 +242,40 @@
 
 <h3>Raster format</h3>
 
-Raster data can be stored in GRASS as 2D or 3D grids. 2D rasters
-support 3 data types: 32bit signed integer, single- and double-precision
-floating-point. 3D rasters support only single- and double-precision
-floating-point. In most GRASS resources, 2D raster maps are usually
-called "raster", their integer data type "CELL", single-precision
-floating-point data type "FCELL" and double-precision floating-point
-"DCELL". The 3D raster map type is usually called "3D raster" but other
-names like "RASTER3D", "voxel", "volume", "GRID3D" or "3d cell" are common.
-3D raster's single-precision data type is most often called "float", and the
-double-precision one "double".
+In GRASS GIS, raster data can be stored as 2D or 3D grids.
 
+<h4>2D raster maps</h4>
+
+2D rasters support three data types (for technical details, please refer
+to the Wiki article
+<a href="https://grasswiki.osgeo.org/wiki/GRASS_raster_semantics">GRASS raster semantics</a>):
+
+<ul>
+<li>32bit signed integer (CELL),</li>
+<li>single-precision floating-point (FCELL), and</li>
+<li>double-precision floating-point (DCELL).
+</ul>
+
+In most GRASS GIS resources, 2D raster maps are usually called "raster" maps.
+
+<h4>3D raster maps</h4>
+
+The 3D raster map type is usually called "3D raster" but other names like
+"RASTER3D", "voxel", "volume", "GRID3D" or "3d cell" are yet common.
+
+3D rasters support only single- and double-precision floating-point.
+3D raster's single-precision data type is most often called "float",
+and the double-precision one "double".
+
+<h4>No-data management and data portability</h4>
+
+GRASS GIS distinguishes NULL and zero. When working with NULL data, it
+is important to know that operations on NULL cells lead to NULL cells.
+
 <p>
 The GRASS GIS raster format is architecture independent and portable between
 32bit and 64bit machines.
 
-<p>
-GRASS distinguishes NULL and zero. When working with NULL data, it is
-important to know that operations on NULL cells lead to NULL cells.
-
 <h3>Raster compression</h3>
 <!-- keep in sync with raster/r.compress/r.compress.html -->
 



More information about the grass-commit mailing list