[GRASS-user] Re: Values from multiple raster -

Glynn Clements glynn at gclements.plus.com
Tue Nov 23 19:22:20 EST 2010


Gabriele N. wrote:

> Thanks for the interesting explanation.
> I did then so:
> 
> r.mapcalc "A_new = (double(A))  and r.mapcalc "B_new = (double(B)) 
> 
> and then 
> 
> r.mapcalc "output" = "(("A_new" * 10000)+("B_new" ))"

The same result can be achieved with one command:

	r.mapcalc "output = A * 10000.0 + B"

The multiply will cause A to be converted to double to match the other
argument (floating-point constants are double unless an explicit "f"
suffix is given), the multiply will yield a double result, and the
addition will convert B to double to match this.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list