1r.series(1) Grass 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 · maximum: highest value
88
89 · range: range of values (max - min)
90
91 · stddev: standard deviation
92
93 · sum: sum of values
94
95 · variance: statistical variance
96
97 · diversity: number of different values
98
99 · slope: linear regression slope
100
101 · offset: linear regression offset
102
103 · detcoeff: linear regression coefficient of determination
104
105 · tvalue: linear regression t-value
106
107 · min_raster: raster map number with the minimum time-series
108 value
109
110 · max_raster: raster map number with the maximum time-series
111 value
112 Note that most parameters accept multiple answers, allowing multiple
113 aggregates to be computed in a single run, e.g.:
114
115 r.series input=map1,...,mapN \
116 output=map.mean,map.stddev \
117 method=average,stddev
118 or:
119
120 r.series input=map1,...,mapN \
121 output=map.p10,map.p50,map.p90 \
122 method=quantile,quantile,quantile \
123 quantile=0.1,0.5,0.9
124 The same number of values must be provided for all options.
125
127 No-data (NULL) handling
128 With -n flag, any cell for which any of the corresponding input cells
129 are NULL is automatically set to NULL (NULL propagation). The aggre‐
130 gate function is not called, so all methods behave this way with
131 respect to the -n flag.
132
133 Without -n flag, the complete list of inputs for each cell (including
134 NULLs) is passed to the aggregate function. Individual aggregates can
135 handle data as they choose. Mostly, they just compute the aggregate
136 over the non-NULL values, producing a NULL result only if all inputs
137 are NULL.
138
139 Minimum and maximum analysis
140 The min_raster and max_raster methods generate a map with the number of
141 the raster map that holds the minimum/maximum value of the time-series.
142 The numbering starts at 0 up to n for the first and the last raster
143 listed in input=, respectively.
144
145 Range analysis
146 If the range= option is given, any values which fall outside that range
147 will be treated as if they were NULL. The range parameter can be set to
148 low,high thresholds: values outside of this range are treated as NULL
149 (i.e., they will be ignored by most aggregates, or will cause the
150 result to be NULL if -n is given). The low,high thresholds are floating
151 point, so use -inf or inf for a single threshold (e.g., range=0,inf to
152 ignore negative values, or range=-inf,-200.4 to ignore values above
153 -200.4).
154
155 Linear regression
156 Linear regression (slope, offset, coefficient of determination,
157 t-value) assumes equal time intervals. If the data have irregular time
158 intervals, NULL raster maps can be inserted into time series to make
159 time intervals equal (see example).
160
161 Quantiles
162 r.series can calculate arbitrary quantiles.
163
164 Memory consumption
165 Memory usage is not an issue, as r.series only needs to hold one row
166 from each map at a time.
167
168 Management of open file limits
169 The maximum number of raster maps that can be processed is given by the
170 user-specific limit of the operating system. For example, the soft lim‐
171 its for users are typically 1024 files. The soft limit can be changed
172 with e.g. ulimit -n 4096 (UNIX-based operating systems) but it cannot
173 be higher than the hard limit. If the latter is too low, you can as
174 superuser add an entry in:
175 /etc/security/limits.conf
176 # <domain> <type> <item> <value>
177 your_username hard nofile 4096
178 This will raise the hard limit to 4096 files. Also have a look at the
179 overall limit of the operating system
180 cat /proc/sys/fs/file-max
181 which on modern Linux systems is several 100,000 files.
182
183 For each map a weighting factor can be specified using the weights
184 option. Using weights can be meaningful when computing the sum or aver‐
185 age of maps with different temporal extent. The default weight is 1.0.
186 The number of weights must be identical to the number of input maps and
187 must have the same order. Weights can also be specified in the input
188 file.
189
190 Use the -z flag to analyze large amounts of raster maps without hitting
191 open files limit and the file option to avoid hitting the size limit of
192 command line arguments. Note that the computation using the file
193 option is slower than with the input option. For every sinlge row in
194 the output map(s) all input maps are opened and closed. The amount of
195 RAM will rise linearly with the number of specified input maps. The
196 input and file options are mutually exclusive: the former is a comma
197 separated list of raster map names and the latter is a text file with a
198 new line separated list of raster map names and optional weights. As
199 separator between the map name and the weight the character "|" must be
200 used.
201
203 Using r.series with wildcards:
204 r.series input="`g.list pattern=’insitu_data.*’ sep=,`" \
205 output=insitu_data.stddev method=stddev
206
207 Note the g.list script also supports regular expressions for selecting
208 map names.
209
210 Using r.series with NULL raster maps (in order to consider a "complete"
211 time series):
212 r.mapcalc "dummy = null()"
213 r.series in=map2001,map2002,dummy,dummy,map2005,map2006,dummy,map2008 \
214 out=res_slope,res_offset,res_coeff meth=slope,offset,detcoeff
215
216 Example for multiple aggregates to be computed in one run (3 resulting
217 aggregates from two input maps):
218 r.series in=one,two out=result_avg,res_slope,result_count meth=sum,slope,count
219
220 Example to use the file option of r.series:
221 cat > input.txt << EOF
222 map1
223 map2
224 map3
225 EOF
226 r.series file=input.txt out=result_sum meth=sum
227
228 Example to use the file option of r.series including weights. The
229 weight 0.75 should be assigned to map2. As the other maps do not have
230 weights we can leave it out:
231 cat > input.txt << EOF
232 map1
233 map2|0.75
234 map3
235 EOF
236 r.series file=input.txt out=result_sum meth=sum
237
238 Example for counting the number of days above a certain temperature
239 using daily average maps (’???’ as DOY wildcard):
240 # Approach for shell based systems
241 r.series input=`g.list rast pattern="temp_2003_???_avg" sep=,` \
242 output=temp_2003_days_over_25deg range=25.0,100.0 method=count
243 # Approach in two steps (e.g., for Windows systems)
244 g.list rast pattern="temp_2003_???_avg" output=mapnames.txt
245 r.series file=mapnames.txt \
246 output=temp_2003_days_over_25deg range=25.0,100.0 method=count
247
249 g.list, g.region, r.quantile, r.series.accumulate, r.series.interp,
250 r.univar
251
252 Hints for large raster data processing
253
255 Glynn Clements
256
257 Last changed: $Date: 2018-01-16 20:08:59 +0100 (Tue, 16 Jan 2018) $
258
260 Available at: r.series source code (history)
261
262 Main index | Raster index | Topics index | Keywords index | Graphical
263 index | Full index
264
265 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
266
267
268
269GRASS 7.4.4 r.series(1)