[GRASSLIST:7304] Nested 'for' statements in batch grass cmd job

Thomas Colson tom_colson at ncsu.edu
Fri Jun 24 14:19:56 EDT 2005


This may be a question more for bash gurus...I'm clearly not one.

I'm trying to "batch" interpolate vector 3d points using r.surf.rst. I
want to output different resolutions, using different tension and
smoothing params on the same input...then do a sink fill and flow dir,
then convert it all to ESRI ascii. Ideally I'd start this at 5 PM today,
and come in monday and find dev/sda1 full of all the rasters I need.....

So far I have the following, but I can't quite figure out how to make
tension and smoothing part of the for....sequence statement. Obviously I
can't use i$ for tension and smoothing in the same loop (tension range 10
: 60....smoothing range .01 : .1) any ideas would be appreciated.



# Generate DEMS at 5,10,15 and 20 ft resolution

for i in `seq 5 5 20`
do
             g.region vect=test res=$i
	     v.surf.rst input=test layer=0 zcolumn=flt1 dmax=12.5 dmin=2.5
elev=aelev$i
 zmult=1 tension=40 smooth=0.1 segmax=40 npmin=200
done


for RAST in `g.list type=rast | sed 1,2d | grep -v '^-*$'`

do
    echo "Fill Sinks and Make Flow Dir Raster for '${RAST}'"
    CMD="r.fill.dir input=${RAST} elevation=fil_${RAST}
direction=fdir_${RAST} type=grass"
    echo $CMD
    $CMD
done

for RAST in `g.list type=rast | sed 1,2d | grep -v '^-*$'`

do
    echo "Export all rasters to ESRI ASCII format '${RAST}'"
    CMD="r.out.arc input=${RAST} output=${RAST} dp=6"
    echo $CMD
    $CMD
done


exit 0




More information about the grass-user mailing list