On 04/03/2014 11:31 AM, rajatrn wrote:
Hi,
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.
I know it is simpler to do it in R but will be great if can be implemented
on using grass terminal/shell.
Thank you in advance,
Sincerely,
Rajat

Maybe something along these lines (not tested):

for i in `seq 1 22`; do \
    NDVI=`sed -n "${i}p" NDVIFILES` ;
    VIQA=`sed -n "${i}p" VIQALIST` ;
    NEW=Mask${NDVI} ;
    echo "Creating ${NEW};
    r.mapcalc " $NEW = $NDVI * $VIQA ";
done




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/looping-r-mapcalc-in-a-shell-script-tp5132797.html
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.



_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to