[GRASS-user] output file location
Sandile Gumede
akasandile at gmail.com
Tue Oct 19 05:46:27 EDT 2010
Hello
Where do I get the output file which contains all the output for the script
below, the actual file name under my Mapset?
----------------------------------------------------------------------------------------------------------------------
#!/bin/sh
#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/lib/grass
# path to GRASS database
GISDBASE=$HOME/grassgis
LOCATION_NAME=SRTMDEM
MAPSET=PERMANENT
# nothing to change below
MAP=$1
LOCATION=$2
# generate temporal LOCATION:
TEMPDIR=FLOODS
mkdir -p $GISDBASE/$LOCATION_NAME/$MAPSET
# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6
fi
echo "LOCATION_NAME: $LOCATION_NAME" > $HOME/.grassrc6
echo "MAPSET:$MAPSET" >> $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: 3
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
" > $GISDBASE/$LOCATION_NAME/$MAPSET/WIND
# Copy WIND-file to DEFAULT_WIND:
cp $GISDBASE/$LOCATION_NAME/$MAPSET/WIND \
$GISDBASE/$LOCATION_NAME/$MAPSET/DEFAULT_WIND
echo "name: Latitude-Longitude
datum: wgs84
towgs84: 0.000,0.000,0.000
proj: ll
ellps: wgs84
"> $GISDBASE/$LOCATION_NAME/$MAPSET/PROJ_INFO
echo "unit: degree
ubits: degrees
meters: 1.0
"> $GISDBASE/$LOCATION_NAME/$MAPSET/PROJ_UNITS
export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH
export LD_LIBRARY_PATH=$GISBASE/lib:$LD_LIBRARY_PATH
export GIS_LOCK=$$
export GISRC=$HOME/.grassrc6
# this should print GRASS version used:
g.version
# other calculations go here....
# import rainfall data set.
cd $HOME/grassgis
# DEM and Rainfall data sets.
r.in.gdal --o input=$HOME/grassgis/dem1.tif output=dem1
# r.in.gdal --o input=$HOME/grassgis/dem2.tif output=dem2
# r.in.gdal --o input=$HOME/grassgis/dem3.tif output=dem3
# r.in.gdal --o input=$HOME/grassgis/dem4.tif output=dem4
r.in.gdal --o input=$HOME/grassgis/Rainfall.tif output=rainfall
# set region resolution to be the dem
g.region rast=dem1 -p
# create MASK to the dem
r.mask input=dem1 at PERMANENT 'maskcats=1 thru 10000'
# calculate rainfall resolution to be the dem resolution.
r.mapcalculator amap=rainfall formula=A*1.0 help=- outfile=rain1
# creating set of maps indicating flow acc, drainage dir, streams
r.watershed --o elevation=dem1 at PERMANENT drainage=flow1_direction
basin=catch1 stream=str1 accumulation=acc1 threshold=1000
# convert catch raster to polygon vector
r.to.vect in=catch1 out=catchments1 feature=area
# Calculate univariate statistics
v.rast.stats vector=catchments1 raster=rain1 colpre=precip
# view results
v.info -c catchments1
v.db.select catchments1
# remove existing mask
r.mask -r input=dem1 at PERMANENT 'maskcats=1 thru 10000'
-------------------------------------------------------------------------------------------------------------------------------------------------------------
--
Kind Regards
TS Gumede | CSIR | Meraka Institute | ICT4EO Research Group
Office Tel: 012 841 2606 | mobile : 072 258 1650
*"Work like a slave in order to live like a King" ~ Unknown*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20101019/a1277aa8/attachment.html
More information about the grass-user
mailing list