[GRASS-user] shell script
Sandile Gumede
akasandile at gmail.com
Mon Jun 28 05:32:39 EDT 2010
Hi
I'm trying to run the script below but it's giving me an error saying
default region is not set.
Which command should I use to set the default region and do I put it?
#!/bin/sh
#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/lib/grass64
# path to GRASS database
GISDBASE=$HOME/grassdem
# nothing to change below
MAP=$1
LOCATION=$2
# generate temporal LOCATION:
TEMPDIR=FLOODS
mkdir -p $GISDBASE/$TEMPDIR/PERMANENT
# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6
fi
echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
echo "MAPSET:PERMANENT" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
export GISBASE=$GISBASE
# Create a WIND file with minimal information and no projection:
echo "proj: 0
zone: 0
north: 1
south: 0
east: 1
west: 0
cols: 1
rows: 1
e-w resol: 1
n-s resol: 1
top: 1
bottom: 0
cols3: 1
rows3: 1
depths: 1
e-w resol3: 1
n-s resol3: 1
t-b resol: 1
" > $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND
# Copy WIND-file to DEFAULT_WIND:
cp $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND \
$TEMPDIR/$LOCATION_NAME/$MAPSET/DEFAULT_WIND
# Set default database driver:
echo "DBF_DRIVER: dbf
DB_DATABASE : $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
" > $TEMPDIR/$LOCATION_NAME/$MAPSET/VAR
export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH
export LD_LIBRARY_PATH=$GISBASE/lib:$LD_LIBRARY_PATH
export GIS_LOCK=$$
export GISRC=$HOME/.grassrc6
db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
# this should print GRASS version used:
g.version
g.proj --quiet -c epsg=4326
g.region --quiet -s n=90 s=-90 w=-180 e=180 res=1
# other calculations go here....
# import rainfall data set.
# cd /home/tgumede1/grassdem
r.in.gdal input=$HOME/grassdem/TRMMLast1day.tif output=rainfall
g.region rast=rainfall
--
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100628/59d3cf35/attachment-0001.html
More information about the grass-user
mailing list