Hi,
I’ve tried to sort out the issue of the region resolution. Now when I’m running v.rast.stats it says:
ERROR: No categories found in raster map
Here is the script I’m running thats giving me that error:
#!/bin/sh
#variable to customize:
path to GRASS software main directory
GISBASE=/usr/lib/grass64
path to GRASS database
GISDBASE=$HOME/grassdata/Cape_
Town
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/tgumede1/grassdata/Cape_Town
rainfall data set.
r.in.gdal input=$HOME/grassdata/Cape_Town/TRMMLast1day.tif output=rainfall
DEM data set.
r.in.gdal input=$HOME/grassdata/Cape_Town/Dem_CF.tif target=SRTMDEM output=dem
g.region rast=dem -p
creating set of maps indicating flow acc, drainage dir, streams
r.watershed --o elevation=dem@PERMANENT drainage=flow_direction basin=catch accumulation=acc threshold=1 memory=300 stream=str
convert catch raster to polygon vector
r.to.vect in=catch@PERMANENT out=catchments feature=area
g.region rast=rainfall -p
Calculate univariate statistics
v.rast.stats -c vector=catchments@PERMANENT raster=rainfall@PERMANENT colpre=precp
–
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650