.TH r.series 1grass "" "GRASS 8.3.2" "GRASS GIS User's Manual" .SH NAME \fI\fBr.series\fR\fR \- Makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers. .SH KEYWORDS raster, aggregation, series, parallel .SH SYNOPSIS \fBr.series\fR .br \fBr.series \-\-help\fR .br \fBr.series\fR [\-\fBnz\fR] [\fBinput\fR=\fIname\fR[,\fIname\fR,...]] [\fBfile\fR=\fIname\fR] \fBoutput\fR=\fIname\fR[,\fIname\fR,...] \fBmethod\fR=\fIstring\fR[,\fIstring\fR,...] [\fBquantile\fR=\fIfloat\fR[,\fIfloat\fR,...]] [\fBweights\fR=\fIfloat\fR[,\fIfloat\fR,...]] [\fBrange\fR=\fIlo,hi\fR] [\fBnprocs\fR=\fIinteger\fR] [\fBmemory\fR=\fImemory in MB\fR] [\-\-\fBoverwrite\fR] [\-\-\fBhelp\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] [\-\-\fBui\fR] .SS Flags: .IP "\fB\-n\fR" 4m .br Propagate NULLs .IP "\fB\-z\fR" 4m .br Do not keep files open .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-help\fR" 4m .br Print usage summary .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .IP "\fB\-\-ui\fR" 4m .br Force launching GUI dialog .SS Parameters: .IP "\fBinput\fR=\fIname[,\fIname\fR,...]\fR" 4m .br Name of input raster map(s) .IP "\fBfile\fR=\fIname\fR" 4m .br Input file with one raster map name and optional one weight per line, field separator between name and weight is | .IP "\fBoutput\fR=\fIname[,\fIname\fR,...]\fR \fB[required]\fR" 4m .br Name for output raster map .IP "\fBmethod\fR=\fIstring[,\fIstring\fR,...]\fR \fB[required]\fR" 4m .br Aggregate operation .br Options: \fIaverage, count, median, mode, minimum, min_raster, maximum, max_raster, stddev, range, sum, variance, diversity, slope, offset, detcoeff, tvalue, quart1, quart3, perc90, quantile, skewness, kurtosis\fR .IP "\fBquantile\fR=\fIfloat[,\fIfloat\fR,...]\fR" 4m .br Quantile to calculate for method=quantile .br Options: \fI0.0\-1.0\fR .IP "\fBweights\fR=\fIfloat[,\fIfloat\fR,...]\fR" 4m .br Weighting factor for each input map, default value is 1.0 for each input map .IP "\fBrange\fR=\fIlo,hi\fR" 4m .br Ignore values outside this range .IP "\fBnprocs\fR=\fIinteger\fR" 4m .br Number of threads for parallel computing .br Default: \fI1\fR .IP "\fBmemory\fR=\fImemory in MB\fR" 4m .br Maximum memory to be used (in MB) .br Cache size for raster rows .br Default: \fI300\fR .SH DESCRIPTION \fIr.series\fR makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers. .PP \fIFigure: Illustration for an average of three input rasters\fR .PP Following methods are available: .RS 4n .IP \(bu 4n average: average value .IP \(bu 4n count: count of non\-NULL cells .IP \(bu 4n median: median value .IP \(bu 4n mode: most frequently occurring value .IP \(bu 4n minimum: lowest value .IP \(bu 4n min_raster: raster map number with the minimum time\-series value .IP \(bu 4n maximum: highest value .IP \(bu 4n max_raster: raster map number with the maximum time\-series value .IP \(bu 4n stddev: standard deviation .IP \(bu 4n range: range of values (max \- min) .IP \(bu 4n sum: sum of values .IP \(bu 4n variance: statistical variance .IP \(bu 4n diversity: number of different values .IP \(bu 4n slope: linear regression slope .IP \(bu 4n offset: linear regression offset .IP \(bu 4n detcoeff: linear regression coefficient of determination .IP \(bu 4n tvalue: linear regression t\-value .IP \(bu 4n quart1: first quartile .IP \(bu 4n quart3: third quartile .IP \(bu 4n perc90: ninetieth percentile .IP \(bu 4n quantile: arbitrary quantile .IP \(bu 4n skewness: skewness .IP \(bu 4n kurtosis: kurtosis .RE Note that most parameters accept multiple answers, allowing multiple aggregates to be computed in a single run, e.g.: .PP .br .nf \fC r.series input=map1,...,mapN \(rs output=map.mean,map.stddev \(rs method=average,stddev \fR .fi or: .PP .br .nf \fC r.series input=map1,...,mapN \(rs output=map.p10,map.p50,map.p90 \(rs method=quantile,quantile,quantile \(rs quantile=0.1,0.5,0.9 \fR .fi The same number of values must be provided for all options. .SH NOTES .SS No\-data (NULL) handling With \fI\-n\fR flag, any cell for which any of the corresponding input cells are NULL is automatically set to NULL (NULL propagation). The aggregate function is not called, so all methods behave this way with respect to the \fI\-n\fR flag. .PP Without \fI\-n\fR flag, the complete list of inputs for each cell (including NULLs) is passed to the aggregate function. Individual aggregates can handle data as they choose. Mostly, they just compute the aggregate over the non\-NULL values, producing a NULL result only if all inputs are NULL. .SS Minimum and maximum analysis The \fImin_raster\fR and \fImax_raster\fR methods generate a map with the number of the raster map that holds the minimum/maximum value of the time\-series. The numbering starts at \fI0\fR up to \fIn\fR for the first and the last raster listed in \fIinput=\fR, respectively. .SS Range analysis If the \fIrange=\fR option is given, any values which fall outside that range will be treated as if they were NULL. The \fIrange\fR parameter can be set to \fIlow,high\fR thresholds: values outside of this range are treated as NULL (i.e., they will be ignored by most aggregates, or will cause the result to be NULL if \-n is given). The \fIlow,high\fR thresholds are floating point, so use \fI\-inf\fR or \fIinf\fR for a single threshold (e.g., \fIrange=0,inf\fR to ignore negative values, or \fIrange=\-inf,\-200.4\fR to ignore values above \-200.4). .SS Linear regression Linear regression (slope, offset, coefficient of determination, t\-value) assumes equal time intervals. If the data have irregular time intervals, NULL raster maps can be inserted into time series to make time intervals equal (see example). .SS Quantiles \fIr.series\fR can calculate arbitrary quantiles. .SS Memory consumption Memory usage is not an issue, as \fIr.series\fR only needs to hold one row from each map at a time. .SS Management of open file limits The maximum number of raster maps that can be processed is given by the user\-specific limit of the operating system. For example, the soft limits for users are typically 1024 files. The soft limit can be changed with e.g. ulimit \-n 4096 (UNIX\-based operating systems) but it cannot be higher than the hard limit. If the latter is too low, you can as superuser add an entry in: .br .nf \fC /etc/security/limits.conf # your_username hard nofile 4096 \fR .fi This will raise the hard limit to 4096 files. Also have a look at the overall limit of the operating system .br .nf \fC cat /proc/sys/fs/file\-max \fR .fi which on modern Linux systems is several 100,000 files. .PP For each map a weighting factor can be specified using the \fIweights\fR option. Using weights can be meaningful when computing the sum or average of maps with different temporal extent. The default weight is 1.0. The number of weights must be identical to the number of input maps and must have the same order. Weights can also be specified in the input file. .PP Use the \fB\-z\fR flag to analyze large amounts of raster maps without hitting open files limit and the \fIfile\fR option to avoid hitting the size limit of command line arguments. Note that the computation using the \fIfile\fR option is slower than with the \fIinput\fR option. For every single row in the output map(s) all input maps are opened and closed. The amount of RAM will rise linearly with the number of specified input maps. The \fIinput\fR and \fIfile\fR options are mutually exclusive: the former is a comma separated list of raster map names and the latter is a text file with a new line separated list of raster map names and optional weights. As separator between the map name and the weight the character \(dq|\(dq must be used. .SS Performance To enable parallel processing, the user can specify the number of threads to be used with the \fBnprocs\fR parameter (default 1). The \fBmemory\fR parameter (default 300 MB) can also be provided to determine the size of the buffer in MB for computation. .br \fIFigure: Benchmark on the left shows execution time for different number of cells, benchmark on the right shows execution time for different memory size for 10000x10000 raster. See benchmark scripts in source code. (Intel Core i9\-10940X CPU @ 3.30GHz x 28) \fR .PP To reduce the memory requirements to minimum, set option \fBmemory\fR to zero. To take advantage of the parallelization, GRASS GIS needs to compiled with OpenMP enabled. .SH EXAMPLES Using \fIr.series\fR with wildcards: .br .br .nf \fC r.series input=\(dq\(gag.list pattern=\(cqinsitu_data.*\(cq sep=,\(ga\(dq \(rs output=insitu_data.stddev method=stddev \fR .fi .PP Note the \fIg.list\fR script also supports regular expressions for selecting map names. .PP Using \fIr.series\fR with NULL raster maps (in order to consider a \(dqcomplete\(dq time series): .br .br .nf \fC r.mapcalc \(dqdummy = null()\(dq r.series in=map2001,map2002,dummy,dummy,map2005,map2006,dummy,map2008 \(rs out=res_slope,res_offset,res_coeff meth=slope,offset,detcoeff \fR .fi .PP Example for multiple aggregates to be computed in one run (3 resulting aggregates from two input maps): .br .nf \fC r.series in=one,two out=result_avg,res_slope,result_count meth=sum,slope,count \fR .fi .PP Example to use the file option of r.series: .br .nf \fC cat > input.txt << EOF map1 map2 map3 EOF r.series file=input.txt out=result_sum meth=sum \fR .fi .PP Example to use the file option of r.series including weights. The weight 0.75 should be assigned to map2. As the other maps do not have weights we can leave it out: .br .nf \fC cat > input.txt << EOF map1 map2|0.75 map3 EOF r.series file=input.txt out=result_sum meth=sum \fR .fi .PP Example for counting the number of days above a certain temperature using daily average maps (\(cq???\(cq as DOY wildcard): .br .nf \fC # Approach for shell based systems r.series input=\(gag.list rast pattern=\(dqtemp_2003_???_avg\(dq separator=comma\(ga \(rs output=temp_2003_days_over_25deg range=25.0,100.0 method=count # Approach in two steps (e.g., for Windows systems) g.list rast pattern=\(dqtemp_2003_???_avg\(dq output=mapnames.txt r.series file=mapnames.txt \(rs output=temp_2003_days_over_25deg range=25.0,100.0 method=count \fR .fi .SH SEE ALSO \fI g.list, g.region, r.quantile, r.series.accumulate, r.series.interp, r.univar \fR .PP Hints for large raster data processing .SH AUTHOR Glynn Clements .SH SOURCE CODE .PP Available at: r.series source code (history) .PP Accessed: Friday Mar 08 07:34:41 2024 .PP Main index | Raster index | Topics index | Keywords index | Graphical index | Full index .PP © 2003\-2024 GRASS Development Team, GRASS GIS 8.3.2 Reference Manual