measuring area

Hi all,
        I have a situation in which I am trying to extend (grow) the area of a
patch in a particular direction, depending on the ajacent cell. I want the patc
h to grow only untill it gets to a specified size ( say 20 Hectares). The troub
le I have is stopping the growth.
I have managed to get the patch to grow by identifying potential growth areas a
nd runing the script below

I would appreciate any suggestion.

Thanks Joe

raster map test.g has three categories

cat value cat label
0 potenial growth
5 non growth
999 patch value

#!/bin/csh -f
# r.mapcalc script to grow remnant aeras in suitable soil types.

@ i=1
@ num=10
echo $i
echo "this will run through "$num, "loops "
d.erase
g.copy rast=test.g,output
#echo " now using "output.$i--
while ($i <= $num)

r.mapcalc output.$i = 'if(output,output, eval(if(output[0,-1]==999|| output[0,1
]==999||output[-1,0]==999||output[1,0]==999,999)))'

g.copy rast=output.$i,output
@ i++
echo $i
end

Hi all,
I have a situation in which I am trying to extend (grow) the
area of a patch in a particular direction, depending on the ajacent
cell. I want the patch to grow only untill it gets to a specified size
( say 20 Hectares). The trouble I have is stopping the growth. I have
managed to get the patch to grow by identifying potential growth areas
and runing the script below

I would appreciate any suggestion.

Thanks Joe

You have to run a r.stats once every loop to determine the size of the
patch growth. The result, the area you filter out with awk from the
r.stats command. That value is assign to a variable that You use to check
for ending criteria in the while loop.

Here is the principle:

SIZE=`r.stats -a output | awk 'pattern plus right column'`

Good luck

Lars

Lars Schylberg Email: lasc@celsiustech.se
CelsiusTech IT or: larss@fmi.kth.se
S-175 88 Jarfalla Tel. +46 8 580 847 03
Sweden Fax. +46 8 580 123 20