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
Always nice to find that that functionality you are looking for is already implemented :-). And if you are using GRASS functions through the QGIS toolbox, look under ‘advanced parameters’ in the r.series window.