[GRASS-user] looping r.mapcalc in a shell script

Glynn Clements glynn at gclements.plus.com
Thu Apr 3 15:55:57 PDT 2014


rajatrn wrote:

> I have two layer lists, NDVIFILES and VIQALIST, both developed using g.mlist
> command in GRASS.
> Each file has 22 items in it. I would like to perform a simple raster
> calculation of the following form,
> Mask$NDVIFILES [i] = NDVIFILES[i] * VIQALIST[i]
> I'm unable to create a loop which can sequentially produce the required
> outputs.
> I will be grateful if anyone can help me with creating a loop using
> bash/shell script.

	while read ndvi <&3 ; do
	    read viqa <&4
	    r.mapcalc "Mask$ndvi = $ndvi * $viqa"
	done 3< NDVIFILES 4< VIQALIST

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


More information about the grass-user mailing list