1r.series(1) GRASS GIS User's Manual r.series(1)
2
3
4
6 r.series - Makes each output cell value a function of the values
7 assigned to the corresponding cells in the input raster map layers.
8
10 raster, aggregation, series
11
13 r.series
14 r.series --help
15 r.series [-nz] [input=name[,name,...]] [file=name] out‐
16 put=name[,name,...] method=string[,string,...] [quan‐
17 tile=float[,float,...]] [weights=float[,float,...]] [range=lo,hi]
18 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
19
20 Flags:
21 -n
22 Propagate NULLs
23
24 -z
25 Do not keep files open
26
27 --overwrite
28 Allow output files to overwrite existing files
29
30 --help
31 Print usage summary
32
33 --verbose
34 Verbose module output
35
36 --quiet
37 Quiet module output
38
39 --ui
40 Force launching GUI dialog
41
42 Parameters:
43 input=name[,name,...]
44 Name of input raster map(s)
45
46 file=name
47 Input file with one raster map name and optional one weight per
48 line, field separator between name and weight is |
49
50 output=name[,name,...]Â [required]
51 Name for output raster map
52
53 method=string[,string,...]Â [required]
54 Aggregate operation
55 Options: average, count, median, mode, minimum, min_raster, maxi‐
56 mum, max_raster, stddev, range, sum, variance, diversity, slope,
57 offset, detcoeff, tvalue, quart1, quart3, perc90, quantile, skew‐
58 ness, kurtosis
59
60 quantile=float[,float,...]
61 Quantile to calculate for method=quantile
62 Options: 0.0-1.0
63
64 weights=float[,float,...]
65 Weighting factor for each input map, default value is 1.0 for each
66 input map
67
68 range=lo,hi
69 Ignore values outside this range
70
72 r.series makes each output cell value a function of the values assigned
73 to the corresponding cells in the input raster map layers.
74
75 Following methods are available:
76
77 · average: average value
78
79 · count: count of non-NULL cells
80
81 · median: median value
82
83 · mode: most frequently occurring value
84
85 · minimum: lowest value
86
87 · min_raster: raster map number with the minimum time-series
88 value
89
90 · maximum: highest value
91
92 · max_raster: raster map number with the maximum time-series
93 value
94
95 · stddev: standard deviation
96
97 · range: range of values (max - min)
98
99 · sum: sum of values
100
101 · variance: statistical variance
102
103 · diversity: number of different values
104
105 · slope: linear regression slope
106
107 · offset: linear regression offset
108
109 · detcoeff: linear regression coefficient of determination
110
111 · tvalue: linear regression t-value
112
113 · quart1: first quartile
114
115 · quart3: third quartile
116
117 · perc90: ninetieth percentile
118
119 · quantile: arbitrary quantile
120
121 · skewness: skewness
122
123 · kurtosis: kurtosis
124 Note that most parameters accept multiple answers, allowing multiple
125 aggregates to be computed in a single run, e.g.:
126
127 r.series input=map1,...,mapN \
128 output=map.mean,map.stddev \
129 method=average,stddev
130 or:
131
132 r.series input=map1,...,mapN \
133 output=map.p10,map.p50,map.p90 \
134 method=quantile,quantile,quantile \
135 quantile=0.1,0.5,0.9
136 The same number of values must be provided for all options.
137
139 No-data (NULL) handling
140 With -n flag, any cell for which any of the corresponding input cells
141 are NULL is automatically set to NULL (NULL propagation). The aggre‐
142 gate function is not called, so all methods behave this way with
143 respect to the -n flag.
144
145 Without -n flag, the complete list of inputs for each cell (including
146 NULLs) is passed to the aggregate function. Individual aggregates can
147 handle data as they choose. Mostly, they just compute the aggregate
148 over the non-NULL values, producing a NULL result only if all inputs
149 are NULL.
150
151 Minimum and maximum analysis
152 The min_raster and max_raster methods generate a map with the number of
153 the raster map that holds the minimum/maximum value of the time-series.
154 The numbering starts at 0 up to n for the first and the last raster
155 listed in input=, respectively.
156
157 Range analysis
158 If the range= option is given, any values which fall outside that range
159 will be treated as if they were NULL. The range parameter can be set to
160 low,high thresholds: values outside of this range are treated as NULL
161 (i.e., they will be ignored by most aggregates, or will cause the
162 result to be NULL if -n is given). The low,high thresholds are floating
163 point, so use -inf or inf for a single threshold (e.g., range=0,inf to
164 ignore negative values, or range=-inf,-200.4 to ignore values above
165 -200.4).
166
167 Linear regression
168 Linear regression (slope, offset, coefficient of determination,
169 t-value) assumes equal time intervals. If the data have irregular time
170 intervals, NULL raster maps can be inserted into time series to make
171 time intervals equal (see example).
172
173 Quantiles
174 r.series can calculate arbitrary quantiles.
175
176 Memory consumption
177 Memory usage is not an issue, as r.series only needs to hold one row
178 from each map at a time.
179
180 Management of open file limits
181 The maximum number of raster maps that can be processed is given by the
182 user-specific limit of the operating system. For example, the soft lim‐
183 its for users are typically 1024 files. The soft limit can be changed
184 with e.g. ulimit -n 4096 (UNIX-based operating systems) but it cannot
185 be higher than the hard limit. If the latter is too low, you can as
186 superuser add an entry in:
187 /etc/security/limits.conf
188 # <domain> <type> <item> <value>
189 your_username hard nofile 4096
190 This will raise the hard limit to 4096 files. Also have a look at the
191 overall limit of the operating system
192 cat /proc/sys/fs/file-max
193 which on modern Linux systems is several 100,000 files.
194
195 For each map a weighting factor can be specified using the weights
196 option. Using weights can be meaningful when computing the sum or aver‐
197 age of maps with different temporal extent. The default weight is 1.0.
198 The number of weights must be identical to the number of input maps and
199 must have the same order. Weights can also be specified in the input
200 file.
201
202 Use the -z flag to analyze large amounts of raster maps without hitting
203 open files limit and the file option to avoid hitting the size limit of
204 command line arguments. Note that the computation using the file
205 option is slower than with the input option. For every single row in
206 the output map(s) all input maps are opened and closed. The amount of
207 RAM will rise linearly with the number of specified input maps. The
208 input and file options are mutually exclusive: the former is a comma
209 separated list of raster map names and the latter is a text file with a
210 new line separated list of raster map names and optional weights. As
211 separator between the map name and the weight the character "|" must be
212 used.
213
215 Using r.series with wildcards:
216 r.series input="`g.list pattern=’insitu_data.*’ sep=,`" \
217 output=insitu_data.stddev method=stddev
218
219 Note the g.list script also supports regular expressions for selecting
220 map names.
221
222 Using r.series with NULL raster maps (in order to consider a "complete"
223 time series):
224 r.mapcalc "dummy = null()"
225 r.series in=map2001,map2002,dummy,dummy,map2005,map2006,dummy,map2008 \
226 out=res_slope,res_offset,res_coeff meth=slope,offset,detcoeff
227
228 Example for multiple aggregates to be computed in one run (3 resulting
229 aggregates from two input maps):
230 r.series in=one,two out=result_avg,res_slope,result_count meth=sum,slope,count
231
232 Example to use the file option of r.series:
233 cat > input.txt << EOF
234 map1
235 map2
236 map3
237 EOF
238 r.series file=input.txt out=result_sum meth=sum
239
240 Example to use the file option of r.series including weights. The
241 weight 0.75 should be assigned to map2. As the other maps do not have
242 weights we can leave it out:
243 cat > input.txt << EOF
244 map1
245 map2|0.75
246 map3
247 EOF
248 r.series file=input.txt out=result_sum meth=sum
249
250 Example for counting the number of days above a certain temperature
251 using daily average maps (’???’ as DOY wildcard):
252 # Approach for shell based systems
253 r.series input=`g.list rast pattern="temp_2003_???_avg" sep=,` \
254 output=temp_2003_days_over_25deg range=25.0,100.0 method=count
255 # Approach in two steps (e.g., for Windows systems)
256 g.list rast pattern="temp_2003_???_avg" output=mapnames.txt
257 r.series file=mapnames.txt \
258 output=temp_2003_days_over_25deg range=25.0,100.0 method=count
259
261 g.list, g.region, r.quantile, r.series.accumulate, r.series.interp,
262 r.univar
263
264 Hints for large raster data processing
265
267 Glynn Clements
268
270 Available at: r.series source code (history)
271
272 Main index | Raster index | Topics index | Keywords index | Graphical
273 index | Full index
274
275 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
276
277
278
279GRASS 7.8.5 r.series(1)