|
@@ -1,33 +1,65 @@
|
|
|
<h2>DESCRIPTION</h2>
|
|
|
-<p>The program <em>r.random</em> allows the user to create a
|
|
|
-raster map layer and/or a vector points map containing
|
|
|
+
|
|
|
+<p>
|
|
|
+The module <em>r.random</em> creates a raster map with values in random places.
|
|
|
+Alternatively, it creates random vector points at these places.
|
|
|
+Number of random cells or points can be a fixed number or a percentage of cells
|
|
|
+from the input.
|
|
|
+By default, generated cells or points will be subset of non-NULL cells of the input.
|
|
|
+Resulting raster map consists of original cell values at the selected
|
|
|
+random locations and NULL (no data) values elsewhere.
|
|
|
+
|
|
|
+<h3>Placement of cells and points</h3>
|
|
|
+
|
|
|
+<p>
|
|
|
+The module allows the user to create a
|
|
|
+raster map and/or a vector points map containing
|
|
|
coordinates of points whose locations have been randomly
|
|
|
-determined. The program locates these randomly generated
|
|
|
-vector points (sites) within the current geographic region and mask (if
|
|
|
-any), on non-NULL category value data areas within a
|
|
|
-user-specified raster map layer. If the user sets the
|
|
|
-<b>-z</b> flag, points will be randomly generated across all
|
|
|
+determined. The module places these randomly generated
|
|
|
+vector points within the current computational region and raster mask (if
|
|
|
+any), on non-NULL raster cells in a
|
|
|
+user-specified raster map. If the user sets the
|
|
|
+<b>-n</b> flag, points will be randomly generated across all
|
|
|
cells (even those with NULL values).
|
|
|
+Cells in the resulting raster overlap with the cells of the input raster
|
|
|
+based on the current computational region.
|
|
|
+Points in the resulting vector map are placed in cell centers of these cells.
|
|
|
+
|
|
|
+<h3>Number of cells and points</h3>
|
|
|
|
|
|
-<p>The category values and
|
|
|
-corresponding category names already associated with the
|
|
|
-random point locations in the <em>input</em> map layer are
|
|
|
-assigned to these points in the <em>raster_output</em> map
|
|
|
-layer. If the <b>-z</b> is specified, then a unique entry
|
|
|
+<p>The user may specify the quantity of random locations to be
|
|
|
+generated either as a <em>positive integer</em> (e.g., 10),
|
|
|
+or as a <em>percentage of the raster map's cells</em>
|
|
|
+(e.g., 10%, or 3.05%). The number of cells considered for
|
|
|
+the percentage reflects whether or not the <b>-n</b> flag
|
|
|
+was given. Options are 0-100; fractions of percent may be
|
|
|
+stated as decimals (e.g., 66.67%, or 0.05%).
|
|
|
+
|
|
|
+<h3>Values</h3>
|
|
|
+
|
|
|
+<p>The cell values and
|
|
|
+corresponding category names (if present) associated with the
|
|
|
+random point locations in the <em>input</em> map are
|
|
|
+assigned to the newly generated cells in the <em>raster</em> map.
|
|
|
+If the <b>-n</b> is specified, then a unique entry
|
|
|
is made for the value used where the <em>input</em> was NULL.
|
|
|
This value is at least 1 less than the smallest value in the
|
|
|
<em>input</em> raster and is given a medium gray color.
|
|
|
|
|
|
-<h2>NOTES</h2>
|
|
|
-<p>If a <em>cover</em> raster map is specified and the <em>cover</em> map
|
|
|
+<p>
|
|
|
+If a <em>cover</em> raster map is specified, values are taken
|
|
|
+from the <em>cover</em> raster map instead of the <em>input</em> raster map.
|
|
|
+If a <em>cover</em> raster map is specified and the <em>cover</em> map
|
|
|
contains NULL (no data) values, these points are suppressed in the
|
|
|
-resulting <em>vector_output</em> or <em>raster_output</em> map.
|
|
|
+resulting <em>vector</em> or <em>raster</em> map.
|
|
|
+
|
|
|
+<h3>Vector output</h3>
|
|
|
|
|
|
-<p>The <em>vector_output</em> file created by <em>r.random</em>
|
|
|
+<p>The <em>vector</em> file created by <em>r.random</em>
|
|
|
contains vector points that represent the <em>center points</em> of the
|
|
|
randomly generated cells. A <em>value</em> attribute contains the cell value
|
|
|
of the <em>input</em> raster (or the assigned value
|
|
|
-when <b>-z</b> is used). <br>
|
|
|
+when <b>-n</b> is used).
|
|
|
If a <em>cover</em> map is additionally specified, a second
|
|
|
column <em>covervalue</em> is populated with raster values from
|
|
|
the <em>cover</em> map.
|
|
@@ -36,35 +68,41 @@ the <em>cover</em> map.
|
|
|
topology to minimize the required resources. This is suitable input
|
|
|
to <em>v.surf.rst</em> and other vector modules.
|
|
|
|
|
|
-<p>The user may specify the quantity of random locations to be
|
|
|
-generated either as a <em>positive integer</em> (e.g., 10),
|
|
|
-or as a <em>percentage of the raster map layer's cells</em>
|
|
|
-(e.g., 10%, or 3.05%). The number of cells considered for
|
|
|
-the percentage reflects whether or not the <b>-z</b> flag
|
|
|
-was given. Options are 0-100; percentages less than
|
|
|
-one percent may be stated as decimals.
|
|
|
-
|
|
|
-<p>Flag <b>-i</b> prints the raster map's name and location,
|
|
|
-the total number of cells under the current region settings, and
|
|
|
-the number of NULL valued cells under the current region settings.
|
|
|
-Then module exits without doing anything. Useful for deciding on the number
|
|
|
-of sites to have <em>r.random</em> create.
|
|
|
-<b>WARNING:</b> this feature may be removed in future. Use
|
|
|
-<a href="g.region.html">g.region</a> and
|
|
|
-<a href="r.report.html">r.report</a>
|
|
|
-instead.
|
|
|
+<h2>NOTES</h2>
|
|
|
+
|
|
|
+To decide on the number
|
|
|
+of points <em>r.random</em> will create,
|
|
|
+use <em><a href="r.univar.html">r.univar</a></em>,
|
|
|
+<em><a href="g.region.html">g.region</a></em>, or
|
|
|
+<em><a href="r.report.html">r.report</a></em>.
|
|
|
+<em>r.univar</em> is the fastest way to obtain number of
|
|
|
+non-NULL cells and NULL cells in a raster map
|
|
|
+given the current computational region and raster mask:
|
|
|
+
|
|
|
+<div class="code"><pre>
|
|
|
+r.univar map=inputmap
|
|
|
+</pre></div>
|
|
|
+
|
|
|
+The text output contains total number of null and non-null cells
|
|
|
+(called <code>cells</code> in the machine-readable shell script style output),
|
|
|
+total null cells (<code>null_cells</code>),
|
|
|
+and number of non-null cells (<code>n</code>).
|
|
|
+
|
|
|
+Alternatively, you can use the following to examine the computational
|
|
|
+region and the raster map:
|
|
|
+
|
|
|
<div class="code"><pre>
|
|
|
g.region -p
|
|
|
r.report map=inputmap units=c null="*" nsteps=1
|
|
|
</pre></div>
|
|
|
|
|
|
-<p>To create random vector point locations within some, but not all,
|
|
|
-non-zero categories of the input raster map layer,
|
|
|
-the user must first create a reclassified raster map layer
|
|
|
-of the original raster map layer (e.g., using the GRASS
|
|
|
-program <em><a href="r.reclass.html">r.reclass</a></em>)
|
|
|
-that contains only the desired categories,
|
|
|
-and then use the reclassed raster map layer as input to <em>r.random</em>.
|
|
|
+<p>To create random vector point locations within some, but not all,
|
|
|
+categories of a integer input raster map (aka CELL raster map),
|
|
|
+the user must first create a reclassified raster map
|
|
|
+of the original raster map (e.g., using the GRASS
|
|
|
+module <em><a href="r.reclass.html">r.reclass</a></em>)
|
|
|
+that contains only the desired categories,
|
|
|
+and then use the reclassed raster map as input to <em>r.random</em>.
|
|
|
|
|
|
<h2>EXAMPLES</h2>
|
|
|
|
|
@@ -88,7 +126,7 @@ landuse map, result stored in 3D vector map:
|
|
|
|
|
|
<div class="code"><pre>
|
|
|
g.region raster=elevation -p
|
|
|
-r.random -d elevation cover=landclass96 vector=luserand3d n=100
|
|
|
+r.random -z elevation cover=landclass96 vector=luserand3d n=100
|
|
|
|
|
|
# data output (value: elevation, covervalue: landuse class):
|
|
|
v.db.select luserand3d
|
|
@@ -100,26 +138,41 @@ cat|value|covervalue
|
|
|
...
|
|
|
</pre></div>
|
|
|
|
|
|
-<h2>KNOWN ISSUES</h2>
|
|
|
-
|
|
|
-It's not possible to use the <b>-i</b> flag without specifying the
|
|
|
-<b>npoints</b> parameter.
|
|
|
-
|
|
|
|
|
|
<h2>SEE ALSO</h2>
|
|
|
|
|
|
-<em>
|
|
|
-<a href="g.region.html">g.region</a>,
|
|
|
-<a href="r.reclass.html">r.reclass</a>,
|
|
|
-<a href="v.random.html">v.random</a>,
|
|
|
-<a href="v.surf.rst.html">v.surf.rst</a>
|
|
|
-</em>
|
|
|
+<ul>
|
|
|
+ <li>
|
|
|
+ <em><a href="g.region.html">g.region</a></em>
|
|
|
+ for setting the computational region and examining the total number of cells,
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <em><a href="r.reclass.html">r.reclass</a></em>
|
|
|
+ for working only with subset of values in the raster map,
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <em><a href="v.random.html">v.random</a></em>
|
|
|
+ for generating vector points without any involvement of raster data,
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <em><a href="r.random.cells.html">r.random.cells</a></em>
|
|
|
+ for generating random cells with with spatial dependence (minimal distance),
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <em><a href="r.surf.random.html">r.surf.random</a></em>
|
|
|
+ as an option for generating random cell values,
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <em><a href="v.surf.rst.html">v.surf.rst</a></em>
|
|
|
+ as an option for creating a surface from sampled points.
|
|
|
+ </li>
|
|
|
+</ul>
|
|
|
|
|
|
|
|
|
<h2>AUTHOR</h2>
|
|
|
|
|
|
Dr. James Hinthorne,
|
|
|
-GIS Laboratory,
|
|
|
+GIS Laboratory,
|
|
|
Central Washington University
|
|
|
<p>Modified for GRASS 5.0 by Eric G. Miller
|
|
|
<p>Cover map support by Markus Neteler, 2007
|