[GRASS-dev] Batch Procesiing in GRASS GIS

Sheeja Bhaskaran vbsheejabhaskar at yahoo.com
Mon Apr 27 00:52:07 EDT 2009


Sir,
>
>           My project is based on batch processing in GRASS GIS.
> The following steps have been performed.
> 1)v.in.db
> 2)v.to.rast
> 3)r.surf.idw
>
> The next step is to do batch processing on the above mapset and the above
> output should be displayed within a particular interval time given by the
> user.
>
> #!/bin/sh
> TMPDIR=/tmp
>
> MAINDIR=/Computer/disk/ProgramFiles/QuantumGIS
> MYUSER=$HOME/gbase
> export GISBASE=$MAINDIR/grass
> # the file contains the GRASS variables which define the LOCATION etc.
> echo "GISDBASE: $HOME/gbase
> LOCATION_NAME: Kerala
> MAPSET: PERMANENT
> " > $TMPDIR/.my_grassjob
> export GISRC=$TMPDIR/.my_grassjob
>
> export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH
> export LD_LIBRARY_PATH=$MAINDIR/lib:$GISBASE/lib:$LD_LIBRARY_PATH
>
> # settings for graphical output
> PNGOUTPUTDIR=$TMPDIR
> # current date
> DATE=`LC_ALL=C date -R | tr -s ' ' ' ' | cut -d' ' -f2,3,4 | tr -s ' ' '_'`
> export GRASS_PNGFILE=$PNGOUTPUTDIR/gbase_${DATE}.png
> export GRASS_TRUECOLOR=TRUE
> export GRASS_WIDTH=900
> export GRASS_PNG_COMPRESSION=1
>
> # use process ID (PID) as lock file number:
> export GIS_LOCK=$$
>
>
> ##### the algorithms goes here
>
> error_routine () {
>  echo "ERROR: $1"
>  exit 1
> }
>
>
> # set region to default settings (here: world)
> g.region -d || error_routine "g.region"
>
> #open PNG output
> d.mon start=PNG || error_routine "d.mon start=PNG"
>
>
>
> # import the maps:
>  v.in.db driver=mysql database=Kerala table=rain x=LON y=LAT output=Location
> key=ID || error_routine "v.in.db"
>  v.to.rast input=Location output=Loca use=attr column=ELEV_FT ||
> error_routine "v.to.rast"
>  r.surf.idw input=Loca output=surfloca || error_routine "r.surf.idw"
>
>
>
> # display
> d.vect Location || error_routine "d.vect"
>
> d.rast Loca column=class type=point \
>   themetype=graduated_points maxsize=20 nint=6  || error_routine "d.rast"
> d.rast surfloca || error_routine "d.rast"
>
> # close PNG output
> d.mon stop=PNG  || error_routine "d.mon stop"
>
> # remove imported map, no longer needed:
> g.remove vect=Location  || error_routine "g.remove"
> rm -f $TMPDIR/ $TMPDIR/
>
> # remove internal tmp stuff:
> $GISBASE/etc/clean_temp  || error_routine "clean_temp"
> rm -rf $TMPDIR/grass6-$USER-$GIS_LOCK
>
> # done.
> echo "Generated $GRASS_PNGFILE"
>
> Then the above script is performed by these steps:
>
> chmod u+x $HOME/my_grassjob.sh
> export GRASS_BATCH_JOB=$HOME/my_grassjob.sh
> grass63 ~/grassdata/spearfish60/neteler/
>
> Problem is concurrent users cannot access it.Display window never opens,
> what is wrong with the above script codings.Please correct it.Also guide me
> how to set the time intervals in batch processing.
>
> Thank You in advance.
>
> Regards
>
>
>


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20090426/6daf487e/attachment.html


More information about the grass-dev mailing list