r.mapcalc loops
R.A.Sanderson
R.A.Sanderson at newcastle.ac.uk
Fri Jun 27 05:21:40 EDT 1997
Dear Erin
Try this in your shell script:
At 19:10 26/06/97 +0000, you wrote:
>Is it possible to do a loop within r.mapcalc? If so, could someone
>post an example of how I could increment the i and j variables that
>indicate the relative position of a pixel (eg., x[-1,2]. I
>determined that I could put an address in those positions and do the
>loop around r.mapcalc, but I assume I could save time if I can do it
>within. I want to do a pretty big neighborhood but keep the window
>resolution high. If I were a REAL woman of course I would do it all
>in C, but it boggles my mind. Any suggestions? I'm trying to
>put an error distribution around telemetry points.
>My guts of my current script is like this:
>r.mapcalc count_sites = 0
while [ $i != 5 ]
do
j=1
while [ $j != 5 ]
do
put in whatever weights you're using
r.mapcalc count_sites = count_sites + telempts[i, j]
j=`expr $j + 1`
done
i=`expr $i + 1`
done
Hope I've understood your question properly and this helps to answer it!
Regards
Roy
----------------------------------------------------------------------------
Roy Sanderson
Centre for Land Use and Water Resources Research
Porter Building
University of Newcastle
Newcastle upon Tyne
NE1 7RU
United Kingdom
Tel: +44 191 222 7789
Fax: +44 191 222 6563
URL: http://www.cluwrr.ncl.ac.uk
----------------------------------------------------------------------------
More information about the grass-user
mailing list