Hi Rajat, If you send me your two files I can send you a line of code that should work. In this case I will need to know if you work with GRASS 6 or 7 and your operating system...
Cheers Stefan From: Rajat Nayak [mailto:rajat27...@gmail.com] Sent: 4. april 2014 04:47 To: Blumentrath, Stefan Subject: Re: [GRASS-user] looping r.mapcalc in a shell script Thank you Stefan for your reply. One of the problems I'm facing with all the suggested codes is, the code is unable to find either of the file lists. Both the filelists were created using g.mlist command, it it worked fine with other loops like reclass. I will work again on your suggested line of thoughts, and hope will be able to crack it. Regards Rajat Rajat Nayak On Thu, Apr 3, 2014 at 5:38 PM, Blumentrath, Stefan <stefan.blumentr...@nina.no<mailto:stefan.blumentr...@nina.no>> wrote: You could also combine your two lists using the "paste" command, then "awk" in order to create proper map calculator expressions, which you then can send to the map calculator through "xargs". That way you could process the maps in parallel (if you are on a 64bit system with multi cores)... Something like (would likely require some adjustments, e.g. regarding field delimiters): paste NDVIFILES VIQALIST | awk '{print \" $1 "_MASK"=$1 '" * " $2 \"}' | xargs -P 4 r.mapcalc {} Cheers Stefan -----Original Message----- From: grass-user-boun...@lists.osgeo.org<mailto:grass-user-boun...@lists.osgeo.org> [mailto:grass-user-boun...@lists.osgeo.org<mailto:grass-user-boun...@lists.osgeo.org>] On Behalf Of rajatrn Sent: 3. april 2014 10:31 To: grass-user@lists.osgeo.org<mailto:grass-user@lists.osgeo.org> Subject: [GRASS-user] looping r.mapcalc in a shell script 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 -- 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 grass-user@lists.osgeo.org<mailto:grass-user@lists.osgeo.org> http://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user