[GRASS-user] Cluster whit area?

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Wed Aug 4 15:37:06 EDT 2010


(apologies for interfering...)

Etienne wrote:
> Hi Dylan and everybody
> I'm come back. I have past this week on R for uderstand what you do in
> http://casoilresource.lawr.ucdavis.edu/drupal/node/340
> Now it's great for R but... I don't understand how make a loop in grass
> in the web site we can read
> 
> for x in `seq 1 5`
> do v.extract --o in=bclust where="cluster=$x" out=bclust_$x
> v.hull --o in=bclust_$x out=bclust_hull_$x
> d.vect bclust_hull_$x type=boundary fcol=none width=2 col=white
> d.vect bclust icon=basic/box fcol=black col=black size=6
> done
> 
> but I have an error and I dont understand very well how work the loop?
> My message error is
> 
> Sorry <1> is not a valid option
> Sorry <5> is not a valid option

Try out like this:

for x in `seq 1 5`; do
    v.extract --o in=bclust where="cluster="${x}"" out=bclust_"${x}"
    v.hull --o in=bclust_"${x}" out=bclust_hull_"${x}"
    d.vect bclust_hull_"${x}" type=boundary fcol=none width=2 col=white
    d.vect bclust icon=basic/box fcol=black col=black size=6
done

By the way, I remember reading expert comment in the list that using "${x}" is 
rather a good idea.

Cheers, Nikos


More information about the grass-user mailing list