1r.random.cells(1) Grass User's Manual r.random.cells(1)
2
3
4
6 r.random.cells - Generates random cell values with spatial dependence.
7
9 raster, sampling, random, autocorrelation
10
12 r.random.cells
13 r.random.cells --help
14 r.random.cells output=name distance=float [ncells=integer]
15 [seed=integer] [--overwrite] [--help] [--verbose] [--quiet]
16 [--ui]
17
18 Flags:
19 --overwrite
20 Allow output files to overwrite existing files
21
22 --help
23 Print usage summary
24
25 --verbose
26 Verbose module output
27
28 --quiet
29 Quiet module output
30
31 --ui
32 Force launching GUI dialog
33
34 Parameters:
35 output=name [required]
36 Name for output raster map
37
38 distance=float [required]
39 Maximum distance of spatial correlation (value >= 0.0)
40
41 ncells=integer
42 Maximum number of cells to be created
43 Options: 1-
44
45 seed=integer
46 Random seed (SEED_MIN >= value >= SEED_MAX) (default [random])
47
49 r.random.cells generates a random sets of raster cells that are at
50 least distance apart. The cells are numbered from 1 to the numbers of
51 cells generated, all other cells are NULL (no data). Random cells will
52 not be generated in areas masked off.
53
54 Detailed parameter description
55 output
56 Random cells. Each random cell has a unique non-zero cell value
57 ranging from 1 to the number of cells generated. The heuristic for
58 this algorithm is to randomly pick cells until there are no cells
59 outside of the chosen cell’s buffer of radius distance.
60
61 distance
62 Determines the minimum distance the centers of the random cells
63 will be apart.
64
65 seed
66 Specifies the random seed that r.random.cells will use to generate
67 the cells. If the random seed is not given, r.random.cells will get
68 a seed from the process ID number.
69
71 The original purpose for this program was to generate independent ran‐
72 dom samples of cells in a study area. The distance value is the amount
73 of spatial autocorrelation for the map being studied.
74
76 Random cells in given distances
77 North Carolina sample dataset example:
78 g.region n=228500 s=215000 w=630000 e=645000 res=100 -p
79 r.random.cells output=random_500m distance=500
80
81 Limited number of random points
82 Here is another example where we will create given number of vector
83 points with the given minimal distances. Let’s star with setting the
84 region (we use large cells here):
85 g.region raster=elevation
86 g.region rows=20 cols=20 -p
87 Then we generate random cells and we limit their count to 20:
88 r.random.cells output=random_cells distance=1500 ncells=20 seed=200
89 Finally, we convert the raster cells to points using r.to.vect module:
90 r.to.vect input=random_cells output=random_points type=point
91 An example of the result is at the Figure below on the left in compari‐
92 son with the result without the cell limit on the right.
93
94 Additionally, we can use v.perturb module to add random spatial devia‐
95 tion to their position so that they are not perfectly aligned with the
96 grid. We cannot perturb the points too much, otherwise we might seri‐
97 ously break the minimal distance we set earlier.
98 v.perturb input=random_points output=random_points_moved parameters=50 seed=200
99 In the above examples, we were using fixed seed. This is advantageous
100 when we want to generate (pseudo) random data, but we want to get
101 reproducible results at the same time.
102
103 Figure: Generated cells with limited number of cells (upper left),
104 derived vector points (lower left), cells without a count limit (upper
105 right) and corresponding vector points (lower right)
106
108 Random Field Software for GRASS GIS by Chuck Ehlschlaeger
109
110 As part of my dissertation, I put together several programs that help
111 GRASS (4.1 and beyond) develop uncertainty models of spatial data. I
112 hope you find it useful and dependable. The following papers might
113 clarify their use:
114
115 · Ehlschlaeger, C.R., Shortridge, A.M., Goodchild, M.F., 1997.
116 Visualizing spatial data uncertainty using animation. Comput‐
117 ers & Geosciences 23, 387-395.
118 doi:10.1016/S0098-3004(97)00005-8
119
120 · Modeling Uncertainty in Elevation Data for Geographical Analy‐
121 sis, by Charles R. Ehlschlaeger, and Ashton M. Shortridge.
122 Proceedings of the 7th International Symposium on Spatial Data
123 Handling, Delft, Netherlands, August 1996.
124
125 · Dealing with Uncertainty in Categorical Coverage Maps: Defin‐
126 ing, Visualizing, and Managing Data Errors, by Charles
127 Ehlschlaeger and Michael Goodchild. Proceedings, Workshop on
128 Geographic Information Systems at the Conference on Information
129 and Knowledge Management, Gaithersburg MD, 1994.
130
131 · Uncertainty in Spatial Data: Defining, Visualizing, and Manag‐
132 ing Data Errors, by Charles Ehlschlaeger and Michael Goodchild.
133 Proceedings, GIS/LIS’94, pp. 246-253, Phoenix AZ, 1994.
134
136 r.random.surface, r.random, v.random, r.to.vect, v.perturb
137
139 Charles Ehlschlaeger; National Center for Geographic Information and
140 Analysis, University of California, Santa Barbara.
141
142 Last changed: $Date: 2015-10-10 22:01:15 +0200 (Sat, 10 Oct 2015) $
143
145 Available at: r.random.cells source code (history)
146
147 Main index | Raster index | Topics index | Keywords index | Graphical
148 index | Full index
149
150 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
151
152
153
154GRASS 7.4.4 r.random.cells(1)