Hi<br><br>I'm trying to run the script below but it's giving me an error saying default region is not set.<br><br>Which command should I use to set the default region and do I put it?<br><br>#!/bin/sh<br><br>#variable to customize:<br>
# path to GRASS software main directory<br>GISBASE=/usr/lib/grass64<br># path to GRASS database<br>GISDBASE=$HOME/grassdem <br><br># nothing to change below<br>MAP=$1<br>LOCATION=$2<br><br><br># generate temporal LOCATION:<br>
TEMPDIR=FLOODS<br>mkdir -p $GISDBASE/$TEMPDIR/PERMANENT<br><br># save existing $HOME/.grassrc6<br>if test -e $HOME/.grassrc6 ; then<br>mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6<br>fi<br><br>echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6<br>
echo "MAPSET:PERMANENT" >> $HOME/.grassrc6<br>echo "DIGITIZER: none" >> $HOME/.grassrc6<br>echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6<br>export GISBASE=$GISBASE<br>
<br># Create a WIND file with minimal information and no projection:<br>echo "proj: 0<br>zone: 0<br>north: 1<br>south: 0<br>east: 1<br>west: 0<br>cols: 1<br>rows: 1<br>e-w resol: 1<br>
n-s resol: 1<br>top: 1<br>bottom: 0<br> cols3: 1<br>rows3: 1<br>depths: 1<br>e-w resol3: 1<br>n-s resol3: 1<br>t-b resol: 1<br>" > $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND<br> <br># Copy WIND-file to DEFAULT_WIND:<br>
cp $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND \<br> $TEMPDIR/$LOCATION_NAME/$MAPSET/DEFAULT_WIND<br><br># Set default database driver:<br>echo "DBF_DRIVER: dbf<br>DB_DATABASE : $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/<br>" > $TEMPDIR/$LOCATION_NAME/$MAPSET/VAR<br>
<br>export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH<br>export LD_LIBRARY_PATH=$GISBASE/lib:$LD_LIBRARY_PATH<br>export GIS_LOCK=$$<br>export GISRC=$HOME/.grassrc6<br>db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'<br>
<br># this should print GRASS version used:<br>g.version<br><br>g.proj --quiet -c epsg=4326<br><br>g.region --quiet -s n=90 s=-90 w=-180 e=180 res=1<br><br># other calculations go here....<br><br># import rainfall data set.<br>
# cd /home/tgumede1/grassdem<br><br>r.in.gdal input=$HOME/grassdem/TRMMLast1day.tif output=rainfall<br><br>g.region rast=rainfall<br><br clear="all"><br>-- <br>Kind Regards<br>TS Gumede<br>CSIR, Meraka Institute<br>072 258 1650<br>
<br>