[GRASS-user] Re: third raster -> as a function of two input raster (r.series?)

Marcello Gorini gorini at gmail.com
Sat Feb 26 08:42:19 EST 2011


>"Gabriele N." says:
>
>I have two raster.
>
>I would like in output a third raster that contains only the areas that
have high values of the first >raster >and with high values of the second
raster (and with the areas that have low values of the first >raster >and
low values of the second raster). Obviously the scale of values are
different.
>To do this I thought of using r.series or  r.statistics but perhaps is not
the right solution.
>Help / advice?


Hey,

I would say the best solution is to use r.mapcalc. With it you are free to
do all kinds of reasoning with respect to both maps. 
It seems to me that you want a classified raster, for instance, with 1 for
low values in raster1 and raster2, 3 for high values in both rasters and 2
for everything else. So obviously, you first need at least two thresholds in
order to define what is low and high in each raster, regarding your specific
analysis. Then you would simply do:

r.mapcalc "output_raster=if(raster1<threshold1 &&
raster2<threshold2,1,if(raster1>threshold1 && raster2>threshold2,3,2))"

Look at r.mapcalc with g.manual and in the web, because there is plenty of
material and it is very powerful.

Hope it helps,
Marcello.




-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/third-raster-as-a-function-of-two-input-raster-r-series-tp6067501p6067611.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list