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