Author: Paulo van Breugel
Updated on: 2015-12-03
One of the fundamental functions in GRASS GIS is the r.series function. It makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers. I use it very often in my analyses, but I only recently ‘discovered’ this option to ignore values outside an user-defined range.
From the manual page; if the range= option is given, any values which fall outside that range will be treated as if they were NULL. For example, if you have daily temperature data layers, you can use this options to count the number of days above a certain temperature:
# Use g.list to get all layer names and write it to a text file g.list type=raster pattern="temp_2003_*" output=mapnames.txt # Now use the r.series to count from all these layers the number of days with # temperatures between 5 and 10 degrees. r.series file=mapnames.txt output=outmap range=5.0,10.0 method=count
Note that if you are using GRASS functions through the QGIS toolbox, you need to look under ‘advanced parameters’ in the r.series window to find this functionality.
If you have questions
If you have questions or comments about the text, let me know. You can use this contact form. Please make sure to include the page title ("The r.series function applied to a range of values") or page name ("rseries-range").