[GRASS-user] output file location

2010-10-19 Thread Sandile Gumede
Hi

Thanks, for grass module v.rast.stats vect=catchments1 rast=rain1
colpre=precip , is it the output file that I'm looking for in the path
below? If so which program is used to open it, I'm using ubuntu 9.04, my
default GRASS database is DBMF

$LOCATION_NAME/$MAPSET/dbf/catchments1.dbf

On Tue, Oct 19, 2010 at 2:52 PM, Micha Silver  wrote:

> Sandile Gumede wrote:
>
>  Hello
>>
>> Where do I get the output file which contains all the output for the
>> script below, the actual file name under my Mapset?
>>
>>  Maps output by GRASS are part of the GRASS database. Each vector or
> raster is not a single file, but rather a directory which contains several
> files. Each vector map has a directory under $LOCATION_NAME/$MAPSET/vector/
> and it might also have a dbf entry or an sqlite table for attributes. The
> parts of a raster map are split among a few directories:
> $LOCATION_NAME/$MAPSET/cats , $LOCATION_NAME/$MAPSET/cell ,
> $LOCATION_NAME/$MAPSET/hist etc.
>
> --
> Micha
>



-- 
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*
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] output file location

2010-10-19 Thread Sandile Gumede
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=d...@permanent 'maskcats=1 thru 1'

# 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=d...@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=d...@permanent 'maskcats=1 thru 1'
-

-- 
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*
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.db.select

2010-08-24 Thread Sandile Gumede
Hi,

How was the mean calculated from the table below? these are the output of
v.db.select from v.rast.stats.

   Cat

n

min

max

range

mean

stddev

variance

coeff-va

sum

26

1126

78

97

19

86.59

9.46

89.42

10.92

97499


-- 
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*
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] NULL cells

2010-07-27 Thread Sandile Gumede
output of v.info catchments, see below:


Type of Map:  vector (level: 2)


Number of points:   0   Number of areas:  2273

Number of lines:0   Number of islands:1

Number of boundaries:   4928Number of faces:  0

Number of centroids:2273Number of kernels:0



Map is 3D:  No

Number of dblinks:  1



  Projection: Latitude-Longitude

N:  33:40:46.499215SS:  34:00:52.499215S

E:  19:10:16.500436EW:  18:17:55.500436E



Digitization threshold: 0
Comments:


output of r.info, see below:

Type of Map:  raster   Number of Categories: 232
Data Type:CELL

Rows: 1

Columns:  3

Total Cells:  3

 Projection: Latitude-Longitude

 N: 33:30SS: 33:45S   Res:  0:15

 E:19EW: 18:15E   Res:  0:15

Range of data:min = 0  max = 232



Data Description:
 generated by r.in.gdal


GRASS 6.4.0RC6 (SRTMDEM):~ > v.extract catchments out=catch_691
where="cat=691"
1 categories loaded from table 
Extracting features...
Building topology for vector map ...
Registering primitives...
237 primitives registered
804 vertices registered
Building areas...
 100%
1 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 237
Number of primitives: 237
Number of points: 0
Number of lines: 0
Number of boundaries: 236
Number of centroids: 1
Number of areas: 1
Number of isles: 1
Writing attributes...
v.extract complete.

GRASS 6.4.0RC6 (SRTMDEM):~ > g.region rast=rainfall

GRASS 6.4.0RC6 (SRTMDEM):~ > d.rast rainfall
 100%
GRASS 6.4.0RC6 (SRTMDEM):~ > d.vect catch_691
The bounding box of the map is outside the current region, nothing drawn.


Now, do you think this would ever work out?

Can the Aster_Dem work with this rainfall (TRMM ) data? Can also the
resolution of raster (Aster and TRMM) maps be a problem? If yes, I know how
to download it, I would only need the projection steps








On Thu, Jul 22, 2010 at 9:42 PM, Micha Silver  wrote:

>  On 07/22/2010 10:55 AM, Sandile Gumede wrote:
>
> Hi
> How do you remove null cells, I guess that is what's causing the problem.
>
> Sandile:
> If I remember your project details, I think that the problem is not the
> null cells in your rainfall data, but rather the very small catchment
> polygons, some of which fall *totally* within a single rainfall cell which
> has a null value.
>
>
> r.to.vect complete.
>
> I guess this step is your conversion of basins to a polygon vector map? How
> many polygons are you getting? Check with v.info. What size are they?
> v.db.addcol catchments col="area_sqm double precision"
> v.to.db catchments opt=area col=area_sqm units=me
>
> And please remind us of the resolution of the rainfall raster with:
> r.info rainfall
>
> GRASS 6.4.0svn (SRTMDEM):~ > r.univar rainfall 100%
>
> total null and non-null cells: 12967201
> total null cells: 7202
>
> Of the non-null cells:
> --
> n: 1295
> minimum: 0
> maximum: 36
> range: 36
> mean: 4.99965
> mean of absolute values: 4.99965
> standard deviation: 9.57207
> variance: 91.6246
> variation coefficient: 191.455 %
> sum: 64795464
>
> GRASS 6.4.0svn (SRTMDEM):~ > v.rast.stats vect=catchments rast=rainfall
> colprefix=precip
> Processing data (16 categories)...
> Updating the database ...
> DBMI-DBF driver error:
> SQL parser error: syntax error processing 'NULL'
> in statement:
> UPDATE catchments SET precip_cf_=-NULL WHERE cat=10728
> Error in db_execute_immediate()
>
> ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL WHERE
>cat=10728'
>
>
>  Another suggestion: One of the catchment polygons that is failing above
> has cat value 10728. How about extracting just that single polygon, then
> display it on a map together with the rainfall raster to see where it falls?
>
> # extract
> v.extract catchments out=catch_10728 where="cat=10728"
> # Display
> g.region rast=rainfall
> d.rast rainfall
> d.vect catch_10728
>
> --
> cheers,
> Micha
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>
> This mail was received via Mail-SeCure System.
>
>
> ___
> grass-user mailing list
> grass-u...@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/grass-user
>
>
> This mail was received via Mail-SeCure System.
>
>
>
>
>
>
> --
> Micha Silver
> Arava Development Co. +972-52-3665918http://surfaces.co.il
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] NULL cells

2010-07-22 Thread Sandile Gumede
Hi
How do you remove null cells, I guess that is what's causing the problem.

r.to.vect complete.
GRASS 6.4.0svn (SRTMDEM):~ > r.univar rainfall 100%
total null and non-null cells: 12967201
total null cells: 7202

Of the non-null cells:
--
n: 1295
minimum: 0
maximum: 36
range: 36
mean: 4.99965
mean of absolute values: 4.99965
standard deviation: 9.57207
variance: 91.6246
variation coefficient: 191.455 %
sum: 64795464

GRASS 6.4.0svn (SRTMDEM):~ > v.rast.stats vect=catchments rast=rainfall
colprefix=precip
Processing data (16 categories)...
Updating the database ...
DBMI-DBF driver error:
SQL parser error: syntax error processing 'NULL'
in statement:
UPDATE catchments SET precip_cf_=-NULL WHERE cat=10728
Error in db_execute_immediate()

ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL WHERE
   cat=10728'


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-22 Thread Sandile Gumede
Hello Micha,

Can you please put all the steps you did here?

On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:

>  Hello Sandile:
> I tried to duplicate your steps and it seems to work for me.
> Here's what I did:
>
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdalinfo 3B42RT.2010032900.1day.tif
> Driver: GTiff/GeoTIFF
> Files: 3B42RT.2010032900.1day.tif
>3B42RT.2010032900.1day.tfw
> Size is 1440, 480
> Coordinate System is `'
> Origin = (-180.000,60.000)
>
> Pixel Size = (0.250,-0.250)
> 
>
>  Note: no projection info above 
>
>  Now I use the -projwin option of gdal_translate to select a small
> window
> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
> 3B42RT.2010032900.1day.tif rainfall_il.tif
>
>  GEOGCS entry now shows 4326 
>
> g.mapset map=ASTER_DEM loc=WGS84
> - A location setup as EPSG:4326
>
> r.in.gdal israel.tif out=rainfall_il
>
> r.univar rainfall_il
>  100%
> total null and non-null cells: 7776
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 7776
> minimum: 0
> maximum: 34
> range: 34
> mean: 0.364583
> mean of absolute values: 0.364583
> standard deviation: 3.45241
> variance: 11.9192
> variation coefficient: 946.948 %
> sum: 2835
>
>
> - Now using an existing catchment vector map 
> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
> v.info -c arava_wsheds
> Displaying column types/names for database connection of layer 1:
> INTEGER|cat
> CHARACTER|label
> DOUBLE PRECISION|area_km
> INTEGER|precip_n
> DOUBLE PRECISION|precip_min
> DOUBLE PRECISION|precip_max
> DOUBLE PRECISION|precip_range
> DOUBLE PRECISION|precip_mean
> DOUBLE PRECISION|precip_stddev
> DOUBLE PRECISION|precip_variance
> DOUBLE PRECISION|precip_cf_var
> DOUBLE PRECISION|precip_sum
>
>  and some values 
>
> v.db.select arava_wsheds
>
> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
> 28|Og|124.122969|
> 36|Zarqa|273.606213|
> 24|Kidron|122.460114|
> 9|Darga|289.012122|
> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>
>  (Many catchments have 0 or no value because of the small region I
> chose. The global data is 1/4 degree resolution and my region is only 2 deg
> E-W.)
>
> HTH...
> --
> Micha
>
>
>
> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>
> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
>
> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
>> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
>> TRMMLa

[GRASS-user] DBMI-DBF driver error

2010-07-18 Thread Sandile Gumede
p/tgumede1-desktop/23218.0
23218.0
/home/tgumede1/grassdata/Cape_Town/Original/SRTMDEM/PERMANENT/.tmp/tgumede1-desktop/23218.0.cats
/home/tgumede1/grassdata/Cape_Town/Original/SRTMDEM/PERMANENT/.tmp/tgumede1-desktop/23218.0.sql
+ [ 1 -eq 0 ]
+ exit 1


On Fri, Jul 16, 2010 at 10:12 PM, Markus Neteler  wrote:

> On Thu, Jul 15, 2010 at 1:10 PM, Sandile Gumede 
> wrote:
> ...
> >> I'm using GTOPO30 DEM data and TRMM (rainfall) data, I selected the data
> >> for the whole of africa but I'm getting an error when executing
> >> v.rast.stats.
> ...
> >> v.rast.stats vector=catchments raster=rainfall colprefix=precip
> >> WARNING: Area without centroid (may be OK for island)
> >> WARNING: Area without centroid (may be OK for island)
> >> WARNING: Area without centroid (may be OK for island)
> >> DBMI-DBF driver error:
> >> SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
> >> in statement:
> >> UPDATE catchments SET precip_cf_=-NULL WHERE cat=17
> >> Error in db_execute_immediate()
> >>
> >> ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL
> >> WHERE
> >>cat=17'
>
> There is a minus sign in front of NULL - never seen that and likely not
> SQL compliant (at least for the DBF driver which is just an enhanced table
> driver).
>
> Maybe it comes from here?
>
> [nete...@localhost v.rast.stats]$ grep NULL *
> v.rast.stats:   eval `r.univar -g $EXTSTAT map="$RASTER"
> percentile="$GIS_OPT_PERCENTILE" | sed 's+nan+NULL+g'`
>
> but AFAIK r.univar would not output -nan.
>
> Please edit your v.rast.stats script ("which v.rast.stats") to find
> the path if on Unix-like OS)
> and change the first line from
>
> #!/bin/sh
>
> to
>
> #!/bin/sh -x
>
> and run it again. From the detailed output you may see where this spurious
> "-"
> comes in and tell us about it.
>
> Markus
>



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] DBMI-DBF driver error

2010-07-18 Thread Sandile Gumede
e1-desktop/23218.0
23218.0
/home/tgumede1/grassdata/Cape_Town/Original/SRTMDEM/PERMANENT/.tmp/tgumede1-desktop/23218.0.cats
/home/tgumede1/grassdata/Cape_Town/Original/SRTMDEM/PERMANENT/.tmp/tgumede1-desktop/23218.0.sql
+ [ 1 -eq 0 ]
+ exit 1


On Fri, Jul 16, 2010 at 10:12 PM, Markus Neteler  wrote:

> On Thu, Jul 15, 2010 at 1:10 PM, Sandile Gumede 
> wrote:
> ...
> >> I'm using GTOPO30 DEM data and TRMM (rainfall) data, I selected the data
> >> for the whole of africa but I'm getting an error when executing
> >> v.rast.stats.
> ...
> >> v.rast.stats vector=catchments raster=rainfall colprefix=precip
> >> WARNING: Area without centroid (may be OK for island)
> >> WARNING: Area without centroid (may be OK for island)
> >> WARNING: Area without centroid (may be OK for island)
> >> DBMI-DBF driver error:
> >> SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
> >> in statement:
> >> UPDATE catchments SET precip_cf_=-NULL WHERE cat=17
> >> Error in db_execute_immediate()
> >>
> >> ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL
> >> WHERE
> >>cat=17'
>
> There is a minus sign in front of NULL - never seen that and likely not
> SQL compliant (at least for the DBF driver which is just an enhanced table
> driver).
>
> Maybe it comes from here?
>
> [nete...@localhost v.rast.stats]$ grep NULL *
> v.rast.stats:   eval `r.univar -g $EXTSTAT map="$RASTER"
> percentile="$GIS_OPT_PERCENTILE" | sed 's+nan+NULL+g'`
>
> but AFAIK r.univar would not output -nan.
>
> Please edit your v.rast.stats script ("which v.rast.stats") to find
> the path if on Unix-like OS)
> and change the first line from
>
> #!/bin/sh
>
> to
>
> #!/bin/sh -x
>
> and run it again. From the detailed output you may see where this spurious
> "-"
> comes in and tell us about it.
>
> Markus
>



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] DBMI-DBF driver error

2010-07-15 Thread Sandile Gumede
Hi

Can anyone help me on this problem?

On Wed, Jul 14, 2010 at 1:31 PM, Sandile Gumede wrote:

> Hi,
>
> I'm using GTOPO30 DEM data and TRMM (rainfall) data, I selected the data
> for the whole of africa but I'm getting an error when executing
> v.rast.stats.
>
> Here is a step-by-step of what I did:
>
> 1. GTOPO30 DEM
>- downloaded e020n10,w020s10,e020n40,w020n40 compressed files from "
> ftp://edcftp.cr.usgs.gov/pub/data/gtopo30/global/";.
>- decompressed all the above files.
>- Added "PIXELTYPE SIGNEDINT" in all .HDR files
>- warp merged all the .DEM file with  "gdalwarp *.DEM Africa.tif"
> command.
>- projected it with "gdal_translate -a_srs EPSG:4326  Africa.tif
> DEM.tif"
>
> 2. TRMM "rainfall" data
>   - downloaded 3B42RT.2010061503.1day.tif,3B42RT.2010061503.1day.tfw
> from "".
>   - projected it with "gdal_translate -a_srs EPSG:4326 -projwin -20 40
> 60 -60 3B42RT.2010061503.1day.tif TRMM.tif ".
>
> Then, imported the two data sets:
>
> r.in.gdal in=/home/tgumede1/grassdem/ict4eo/DEM.tif out=dem
>
> Projection of input dataset and current location appear to match
>  100%
> r.in.gdal complete. Raster map  created.
>
> g.region rast=dem
>
> r.in.gdal in=/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif out=rainfall
> target=CapeTown
>
> Projection of input dataset and current location appear to match
>  100%
> r.in.gdal complete. Raster map  created.
>
> r.watershed elevation=dem accumulation=acc drainage=direction stream=str
> basin=catch memory=300 threshold=10
>
> SECTION 1a (of 5): Initiating Memory.
> SECTION 1b (of 5): Determining Offmap Flow.
>  100%
> SECTION 2: A * Search.
>  100%
> SECTION 3: Accumulating Surface Flow.
>  100%
> SECTION 4: Watershed determination.
>  100%
> SECTION 5: Closing Maps.
>  100%
>
>   Q: How do one really know the exact threshold value?
>
> r.to.vect in=catch out=catchments feature=area
>
> Extracting areas...
>  100%
>  100%
> Building topology for vector map ...
> Registering primitives...
> 134246 primitives registered
> 701002 vertices registered
> Building areas...
>  100%
> 44645 areas built
>
> 1 isles built
> Attaching islands...
>  100%
> Attaching centroids...
>  100%
> Number of nodes: 89602
> Number of primitives: 134246
>
> Number of points: 0
> Number of lines: 0
> Number of boundaries: 89604
> Number of centroids: 44642
> Number of areas: 44645
> Number of isles: 1
> Number of areas without centroid: 3
> r.to.vect complete.
>
>
> g.region rast=rainfall
>
> v.rast.stats vector=catchments raster=rainfall colprefix=precip
> WARNING: Area without centroid (may be OK for island)
> WARNING: Area without centroid (may be OK for island)
> WARNING: Area without centroid (may be OK for island)
>
> DBMI-DBF driver error:
> SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
> in statement:
> UPDATE catchments SET precip_cf_=-NULL WHERE cat=17
>
> Error in db_execute_immediate()
>
> ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL WHERE
>cat=17'
>
>
> - output of r.info -g
>
> r.info -g rainfall
> north=40
> south=-60
> east=60
> west=-20
>
> - output of v.info
>
> v.info -g catchments
> north=40
> south=-60
> east=60
> west=-20
>
> top=0.00
> bottom=0.00
>
> output of r.info
>
> Type of Map:  raster   Number of Categories: 2559
> Data Type:
> CELL
> Rows:
> 400
> Columns:
> 320
> Total Cells:
> 128000
>  Projection:
> Latitude-Longitude
>  N:40NS:60S   Res:
> 0:15
>  E:60EW:20W   Res:
> 0:15
> Range of data:min = 0  max =
> 2559
>
>
> Data
> Description:
>  generated by
> r.in.gdal
>
>
>
> Comments:
>  r.in.gdal input="/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif"
> \
>  output="rainfall" target="CapeTown"
>
>
> - output of r.univar
>
> r.univar rainfall
>  100%
> total null and non-null cells: 11520
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 11520
> minimum: 0
> maximum: 2559
> range: 2559
> mean: 22.4897
> mean of absolute values: 22.4897
> standard deviation: 83.1312
> variance: 6910.79
> variation coefficient: 369.642 %
> sum: 2590809300
>
>
>
>
>
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-15 Thread Sandile Gumede
Hi Micha

Which DEM data you used to test this rainfall data?

Can I have it?

Can you also post the steps you did, maybe I'm missing something?


On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:

>  Hello Sandile:
> I tried to duplicate your steps and it seems to work for me.
> Here's what I did:
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdalinfo 3B42RT.2010032900.1day.tif
> Driver: GTiff/GeoTIFF
> Files: 3B42RT.2010032900.1day.tif
>3B42RT.2010032900.1day.tfw
> Size is 1440, 480
>
> Coordinate System is `'
> Origin = (-180.000,60.000)
> Pixel Size = (0.250,-0.250)
> 
>
>  Note: no projection info above 
>
>  Now I use the -projwin option of gdal_translate to select a small
> window
> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
> 3B42RT.2010032900.1day.tif rainfall_il.tif
>
>  GEOGCS entry now shows 4326 
>
> g.mapset map=ASTER_DEM loc=WGS84
> - A location setup as EPSG:4326
>
> r.in.gdal israel.tif out=rainfall_il
>
> r.univar rainfall_il
>  100%
> total null and non-null cells: 7776
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 7776
> minimum: 0
> maximum: 34
> range: 34
> mean: 0.364583
> mean of absolute values: 0.364583
> standard deviation: 3.45241
> variance: 11.9192
> variation coefficient: 946.948 %
> sum: 2835
>
>
> - Now using an existing catchment vector map 
> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
> v.info -c arava_wsheds
> Displaying column types/names for database connection of layer 1:
> INTEGER|cat
> CHARACTER|label
> DOUBLE PRECISION|area_km
> INTEGER|precip_n
> DOUBLE PRECISION|precip_min
> DOUBLE PRECISION|precip_max
> DOUBLE PRECISION|precip_range
> DOUBLE PRECISION|precip_mean
> DOUBLE PRECISION|precip_stddev
> DOUBLE PRECISION|precip_variance
> DOUBLE PRECISION|precip_cf_var
> DOUBLE PRECISION|precip_sum
>
>  and some values 
>
> v.db.select arava_wsheds
>
> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
> 28|Og|124.122969|
> 36|Zarqa|273.606213|
> 24|Kidron|122.460114|
> 9|Darga|289.012122|
> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>
>  (Many catchments have 0 or no value because of the small region I
> chose. The global data is 1/4 degree resolution and my region is only 2 deg
> E-W.)
>
> HTH...
> --
> Micha
>
>
> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>
> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
>
> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
&

[GRASS-user] Re: v.rast.stats

2010-07-14 Thread Sandile Gumede
Hi Micha

Which DEM data you used to test this rainfall data?

Can I have it?

On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:

>  Hello Sandile:
> I tried to duplicate your steps and it seems to work for me.
> Here's what I did:
>
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdalinfo 3B42RT.2010032900.1day.tif
> Driver: GTiff/GeoTIFF
> Files: 3B42RT.2010032900.1day.tif
>3B42RT.2010032900.1day.tfw
> Size is 1440, 480
> Coordinate System is `'
> Origin = (-180.000,60.000)
> Pixel Size = (0.250,-0.250)
> 
>
>  Note: no projection info above 
>
>  Now I use the -projwin option of gdal_translate to select a small
> window
> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
> 3B42RT.2010032900.1day.tif rainfall_il.tif
>
>  GEOGCS entry now shows 4326 
>
> g.mapset map=ASTER_DEM loc=WGS84
> - A location setup as EPSG:4326
>
> r.in.gdal israel.tif out=rainfall_il
>
> r.univar rainfall_il
>  100%
> total null and non-null cells: 7776
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 7776
> minimum: 0
> maximum: 34
> range: 34
> mean: 0.364583
> mean of absolute values: 0.364583
> standard deviation: 3.45241
> variance: 11.9192
> variation coefficient: 946.948 %
> sum: 2835
>
>
> - Now using an existing catchment vector map 
> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
> v.info -c arava_wsheds
> Displaying column types/names for database connection of layer 1:
> INTEGER|cat
> CHARACTER|label
> DOUBLE PRECISION|area_km
> INTEGER|precip_n
> DOUBLE PRECISION|precip_min
> DOUBLE PRECISION|precip_max
> DOUBLE PRECISION|precip_range
> DOUBLE PRECISION|precip_mean
> DOUBLE PRECISION|precip_stddev
> DOUBLE PRECISION|precip_variance
> DOUBLE PRECISION|precip_cf_var
> DOUBLE PRECISION|precip_sum
>
>  and some values 
>
> v.db.select arava_wsheds
>
> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
> 28|Og|124.122969|
> 36|Zarqa|273.606213|
> 24|Kidron|122.460114|
> 9|Darga|289.012122|
> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>
>  (Many catchments have 0 or no value because of the small region I
> chose. The global data is 1/4 degree resolution and my region is only 2 deg
> E-W.)
>
> HTH...
> --
> Micha
>
>
>
> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>
> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
>
> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
>> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day

[GRASS-user] v.rast.stats

2010-07-14 Thread Sandile Gumede
Hi,

Can anyone help!

On Wed, Jul 14, 2010 at 1:31 PM, Sandile Gumede wrote:

> Hi,
>
> I'm using GTOPO30 DEM data and TRMM (rainfall) data, I selected the data
> for the whole of africa but I'm getting an error when executing
> v.rast.stats.
>
> Here is a step-by-step of what I did:
>
> 1. GTOPO30 DEM
>- downloaded e020n10,w020s10,e020n40,w020n40 compressed files from "
> ftp://edcftp.cr.usgs.gov/pub/data/gtopo30/global/";.
>- decompressed all the above files.
>- Added "PIXELTYPE SIGNEDINT" in all .HDR files
>- warp merged all the .DEM file with  "gdalwarp *.DEM Africa.tif"
> command.
>- projected it with "gdal_translate -a_srs EPSG:4326  Africa.tif
> DEM.tif"
>
> 2. TRMM "rainfall" data
>   - downloaded 3B42RT.2010061503.1day.tif,3B42RT.2010061503.1day.tfw
> from "".
>   - projected it with "gdal_translate -a_srs EPSG:4326 -projwin -20 40
> 60 -60 3B42RT.2010061503.1day.tif TRMM.tif ".
>
> Then, imported the two data sets:
>
> r.in.gdal in=/home/tgumede1/grassdem/ict4eo/DEM.tif out=dem
>
> Projection of input dataset and current location appear to match
>  100%
> r.in.gdal complete. Raster map  created.
>
> g.region rast=dem
>
> r.in.gdal in=/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif out=rainfall
> target=CapeTown
>
> Projection of input dataset and current location appear to match
>  100%
> r.in.gdal complete. Raster map  created.
>
> r.watershed elevation=dem accumulation=acc drainage=direction stream=str
> basin=catch memory=300 threshold=10
>
> SECTION 1a (of 5): Initiating Memory.
> SECTION 1b (of 5): Determining Offmap Flow.
>  100%
> SECTION 2: A * Search.
>  100%
> SECTION 3: Accumulating Surface Flow.
>  100%
> SECTION 4: Watershed determination.
>  100%
> SECTION 5: Closing Maps.
>  100%
>
>   Q: How do one really know the exact threshold value?
>
> r.to.vect in=catch out=catchments feature=area
>
> Extracting areas...
>  100%
>  100%
> Building topology for vector map ...
> Registering primitives...
> 134246 primitives registered
> 701002 vertices registered
> Building areas...
>  100%
> 44645 areas built
>
> 1 isles built
> Attaching islands...
>  100%
> Attaching centroids...
>  100%
> Number of nodes: 89602
> Number of primitives: 134246
>
> Number of points: 0
> Number of lines: 0
> Number of boundaries: 89604
> Number of centroids: 44642
> Number of areas: 44645
> Number of isles: 1
> Number of areas without centroid: 3
> r.to.vect complete.
>
>
> g.region rast=rainfall
>
> v.rast.stats vector=catchments raster=rainfall colprefix=precip
> WARNING: Area without centroid (may be OK for island)
> WARNING: Area without centroid (may be OK for island)
> WARNING: Area without centroid (may be OK for island)
>
> DBMI-DBF driver error:
> SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
> in statement:
> UPDATE catchments SET precip_cf_=-NULL WHERE cat=17
>
> Error in db_execute_immediate()
>
> ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL WHERE
>cat=17'
>
>
> - output of r.info -g
>
> r.info -g rainfall
> north=40
> south=-60
> east=60
> west=-20
>
> - output of v.info
>
> v.info -g catchments
> north=40
> south=-60
> east=60
> west=-20
>
> top=0.00
> bottom=0.00
>
> output of r.info
>
> Type of Map:  raster   Number of Categories: 2559
> Data Type:
> CELL
> Rows:
> 400
> Columns:
> 320
> Total Cells:
> 128000
>  Projection:
> Latitude-Longitude
>  N:40NS:60S   Res:
> 0:15
>  E:60EW:20W   Res:
> 0:15
> Range of data:min = 0  max =
> 2559
>
>
> Data
> Description:
>  generated by
> r.in.gdal
>
>
>
> Comments:
>  r.in.gdal input="/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif"
> \
>  output="rainfall" target="CapeTown"
>
>
> - output of r.univar
>
> r.univar rainfall
>  100%
> total null and non-null cells: 11520
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 11520
> minimum: 0
> maximum: 2559
> range: 2559
> mean: 22.4897
> mean of absolute values: 22.4897
> standard deviation: 83.1312
> variance: 6910.79
> variation coefficient: 369.642 %
> sum: 2590809300
>
>
>
>
>
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-14 Thread Sandile Gumede
Hi,

I'm using GTOPO30 DEM data and TRMM (rainfall) data, I selected the data for
the whole of africa but I'm getting an error when executing v.rast.stats.

Here is a step-by-step of what I did:

1. GTOPO30 DEM
   - downloaded e020n10,w020s10,e020n40,w020n40 compressed files from "
ftp://edcftp.cr.usgs.gov/pub/data/gtopo30/global/";.
   - decompressed all the above files.
   - Added "PIXELTYPE SIGNEDINT" in all .HDR files
   - warp merged all the .DEM file with  "gdalwarp *.DEM Africa.tif"
command.
   - projected it with "gdal_translate -a_srs EPSG:4326  Africa.tif
DEM.tif"

2. TRMM "rainfall" data
  - downloaded 3B42RT.2010061503.1day.tif,3B42RT.2010061503.1day.tfw
from "".
  - projected it with "gdal_translate -a_srs EPSG:4326 -projwin -20 40
60 -60 3B42RT.2010061503.1day.tif TRMM.tif ".

Then, imported the two data sets:

r.in.gdal in=/home/tgumede1/grassdem/ict4eo/DEM.tif out=dem
Projection of input dataset and current location appear to match
 100%
r.in.gdal complete. Raster map  created.

g.region rast=dem

r.in.gdal in=/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif out=rainfall
target=CapeTown
Projection of input dataset and current location appear to match
 100%
r.in.gdal complete. Raster map  created.

r.watershed elevation=dem accumulation=acc drainage=direction stream=str
basin=catch memory=300 threshold=10
SECTION 1a (of 5): Initiating Memory.
SECTION 1b (of 5): Determining Offmap Flow.
 100%
SECTION 2: A * Search.
 100%
SECTION 3: Accumulating Surface Flow.
 100%
SECTION 4: Watershed determination.
 100%
SECTION 5: Closing Maps.
 100%

  Q: How do one really know the exact threshold value?

r.to.vect in=catch out=catchments feature=area
Extracting areas...
 100%
 100%
Building topology for vector map ...
Registering primitives...
134246 primitives registered
701002 vertices registered
Building areas...
 100%
44645 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 89602
Number of primitives: 134246
Number of points: 0
Number of lines: 0
Number of boundaries: 89604
Number of centroids: 44642
Number of areas: 44645
Number of isles: 1
Number of areas without centroid: 3
r.to.vect complete.


g.region rast=rainfall

v.rast.stats vector=catchments raster=rainfall colprefix=precip
WARNING: Area without centroid (may be OK for island)
WARNING: Area without centroid (may be OK for island)
WARNING: Area without centroid (may be OK for island)
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
in statement:
UPDATE catchments SET precip_cf_=-NULL WHERE cat=17
Error in db_execute_immediate()

ERROR: Error while executing: 'UPDATE catchments SET precip_cf_=-NULL WHERE
   cat=17'


- output of r.info -g

r.info -g rainfall
north=40
south=-60
east=60
west=-20

- output of v.info

v.info -g catchments
north=40
south=-60
east=60
west=-20
top=0.00
bottom=0.00

output of r.info

Type of Map:  raster   Number of Categories: 2559
Data Type:CELL

Rows: 400

Columns:  320

Total Cells:  128000

 Projection: Latitude-Longitude

 N:40NS:60S   Res:  0:15

 E:60EW:20W   Res:  0:15

Range of data:min = 0  max = 2559



Data Description:

 generated by r.in.gdal



Comments:

 r.in.gdal input="/home/tgumede1/grassdem/ict4eo/CapeTown_TRMMs.tif" \

 output="rainfall" target="CapeTown"


- output of r.univar

r.univar rainfall
 100%
total null and non-null cells: 11520
total null cells: 0

Of the non-null cells:
--
n: 11520
minimum: 0
maximum: 2559
range: 2559
mean: 22.4897
mean of absolute values: 22.4897
standard deviation: 83.1312
variance: 6910.79
variation coefficient: 369.642 %
sum: 2590809300





-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-13 Thread Sandile Gumede
Hi

Thanks.

How do I project the GTOPO30 data to get a specific region using
coordinates, say I need the region within these coordinates:

Upper Left (18.2987501, -33.6795831)
Lower Right (19.1712501, -34.0145831)



On Tue, Jul 13, 2010 at 4:20 PM, Markus Neteler  wrote:

> On Tue, Jul 13, 2010 at 1:19 PM, Sandile Gumede 
> wrote:
> > Hi,
> >
> > Thanks for the suggestions. I have downloaded the GTOPO30 data from their
> > website, its a compressed file e020n40.tar.gz I guess these are the
> > coordinates for part of Africa. I have decompressed the file and inside
> > there are 8 files; .DEM, .DMW, .GIF, .HDR, .PRJ, .SCH, .STX, .SRC.
> >
> > Is the .GIF file the one I'm supposed to project in order to use it in
> > GRASS?
>
> Better use the HDR file. I have added a note here:
>
> http://grass.osgeo.org/wiki/Global_datasets#GTOPO30
>
> Markus
>



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-13 Thread Sandile Gumede
Hi,

Thanks for the suggestions. I have downloaded the GTOPO30 data from their
website, its a compressed file e020n40.tar.gz I guess these are the
coordinates for part of Africa. I have decompressed the file and inside
there are 8 files; .DEM, .DMW, .GIF, .HDR, .PRJ, .SCH, .STX, .SRC.

Is the .GIF file the one I'm supposed to project in order to use it in
GRASS?


> 2010/7/9 
>
> > These are my data sets attached:
>> >
>> > 1. Dem_CF.tif   is the DEM
>> > 2. TRMMLast1day.tif  is the rainfall data
>> >
>> > On Fri, Jul 9, 2010 at 2:53 PM, Sandile Gumede 
>> > wrote:
>> >
>> >> Is there any one who can help me?
>>
>> I'm away this week, so I can only add a quick response:
>>
>> I still see two "glaring" problems in your technique.
>> 1- You mentioned that you try to "sort out the resolution" between the two
>> data sources. One source, the rainfall data, is a raster of 27 km. pixel
>> size, while the other, the DEM is 90 m. pixel size. I don't believe that
>> you can resolve this gap. You can not compare data with such a gap in
>> resolution.  The only thing possible with rainfall data at that resolution
>> is *continent scale* maps. You can get the gtopo30 DEM (1 km. resolution,
>> I think) for all of Africa for example, and compare that with rainfall
>> data for all of Africa.
>> 2- When you get to the step of watershed creation, you seem to be using
>> illogical threshold values. Below you set threshold=1. That means every
>> single cell in the dem will become a basin! That's certainly *not* what
>> you want. Typical threshold values will be in the 1000's, even 10's of
>> thousands.
>> --
>> Micha
>> >>
>> >>
>> >> On Wed, Jul 7, 2010 at 3:15 PM, Sandile Gumede
>> >> wrote:
>> >>
>> >>> 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:

[GRASS-user] Re: v.rast.stats

2010-07-13 Thread Sandile Gumede
Hi,

Thanks for the suggestions. I have downloaded the GTOPO30 data from their
website, its a compressed file e020n40.tar.gz I guess these are the
coordinates for part of Africa. I have decompressed the file and inside
there are 8 files; .DEM, .DMW, .GIF, .HDR, .PRJ, .SCH, .STX, .SRC.

Is the .GIF file the one I'm supposed to project in order to use it in
GRASS?

2010/7/9 

> > These are my data sets attached:
> >
> > 1. Dem_CF.tif   is the DEM
> > 2. TRMMLast1day.tif  is the rainfall data
> >
> > On Fri, Jul 9, 2010 at 2:53 PM, Sandile Gumede 
> > wrote:
> >
> >> Is there any one who can help me?
>
> I'm away this week, so I can only add a quick response:
>
> I still see two "glaring" problems in your technique.
> 1- You mentioned that you try to "sort out the resolution" between the two
> data sources. One source, the rainfall data, is a raster of 27 km. pixel
> size, while the other, the DEM is 90 m. pixel size. I don't believe that
> you can resolve this gap. You can not compare data with such a gap in
> resolution.  The only thing possible with rainfall data at that resolution
> is *continent scale* maps. You can get the gtopo30 DEM (1 km. resolution,
> I think) for all of Africa for example, and compare that with rainfall
> data for all of Africa.
> 2- When you get to the step of watershed creation, you seem to be using
> illogical threshold values. Below you set threshold=1. That means every
> single cell in the dem will become a basin! That's certainly *not* what
> you want. Typical threshold values will be in the 1000's, even 10's of
> thousands.
> --
> Micha
> >>
> >>
> >> On Wed, Jul 7, 2010 at 3:15 PM, Sandile Gumede
> >> wrote:
> >>
> >>> 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
>

[GRASS-user] v.rast.stats

2010-07-09 Thread Sandile Gumede
Is there any one who can help me?

On Wed, Jul 7, 2010 at 3:15 PM, Sandile Gumede  wrote:

> 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=...@permanent drainage=flow_direction
> basin=catch accumulation=acc threshold=1 memory=300 stream=str
>
> # convert catch raster to polygon vector
> r.to.vect in=ca...@permanent out=catchments feature=area
>
>  g.region rast=rainfall -p
>
> # Calculate univariate statistics
> v.rast.stats -c vector=catchme...@permanent 
> raster=rainf...@permanentcolpre=precp
>
>
>
> On Wed, Jul 7, 2010 at 9:18 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> Which module do I use to change the resolutions?
>>
>>
>> 2010/7/6 
>>
>>> Hello Sandile:
>>> It seems you are importing two raster with vastly different resolutions.
>>> (I think we already came across this). See below...
>>>
>>> > Hi
>>> >
>>> > Below is a step-by-step of what I have done but I'm getting an error
>>> when
>>> > running v.rast.stats vector=catchments raster=rainfall layer=1
>>> > colprefix=area.
>>> >
>>> >
>>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
>>> > in=/home/tgumede1/grassdata/Cape_Town/TRMMLast1day.tif out=rainfall
>>> >
>>> > Projection of input dataset and current location appear to match
>>> >  100%
>>> > r.in.gdal complete. Raster map  created.
>>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=rainfall -p
>>> > projection: 3 (Latitude-Longitude)
>>> > zone:   0
>>> > datum:  wgs84
>>> > ellipsoid:  wgs84
>>> > north:  33:30S
>>> > south:  33:45S
>>> > west:   18:15E
>>> > east:   19E
>>> > nsres:  0:15
>>> > ewres:  0:15
>>> > rows:   1
>>> > cols:   3
>>> > cells:  3
>>>
>>>

[GRASS-user] v.rast.stats

2010-07-09 Thread Sandile Gumede
; 24|Kidron|122.460114|
> 9|Darga|289.012122|
> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>
>  (Many catchments have 0 or no value because of the small region I
> chose. The global data is 1/4 degree resolution and my region is only 2 deg
> E-W.)
>
> HTH...
> --
> Micha
>
>
>
> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>
> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
>
> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
>> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
>> TRMMLast1day.tif
>>
>>
>>
>>  2010/6/15 Micha Silver 
>>
>>>  On 15/06/2010 14:35, Sandile Gumede wrote:
>>>
>>> Hi
>>> If I run g.region rast=rainfall -p, I get:
>>>
>>>   OK, what you've done here is change the current region to match the
>>> raster "rainfall".
>>> Can you now try:
>>> v.rast.stats -c vect=catchments rast=rainfall pref=precip
>>>
>>>
>>>
>>>
>>> projection: 3 (Latitude-Longitude)
>>> zone:   0
>>> datum:  wgs84
>>> ellipsoid:  wgs84
>>> north:  33:40:46.49916S
>>> south:  34:20:55.49928S
>>> west:   18:17:55.50036E
>>> east:   19:10:16.50036E
>>> nsres:  0:00:05.01875
>>> ewres:  0:00:02.18125
>>> rows:   480
>>> cols:   1440
>>> cells:  691200
>>>
>>> and If I run r.univar rainfall, I get the following output:
>>>
>>>  100%
>>> total null and non-null cells: 691200
>>> total null cells: 0
>>>
>>> Of the non-null cells:
>>> --
>>> n: 691200
>>> minimum: 0
>>> maximum: 3094
>>> range: 3094
>>> mean: 22.0228
>>> mean of absolute values: 22.0228
>>> standard deviation: 76.1639
>>> variance: 5800.94
>>> variation coefficient: 345.841 %
>>> sum: 15222164
>>>
>>>
>>>
>>> On Tue, Jun 15, 2010 at 12:22 PM, Hamish  wrote:
>>>
>>>> Micha wrote:
>>>> > The only unusual thing I notice above is that the resolution settings
>>>> > for the raster are different N-S and E-W. This came from the original
>>>> > tiff (see below) which also has rectangular pixels,
>>>>
>>>>  that is perfectly normal for a lat/lon map away from the equator.
>>>> longitude scales a cos(lat).
>>>>
>>>>
>>>> > (the v.rast.stats module creates a temp raster at the *current
>>>> region's
>>>> > resolution* settings, which might be different from this rainfall
>>>> > raster's rectangular resolution...)
>>>>
>>>>  the results of:
>>>>
>>>> g.region -p rast=mapname
>>>> r.univar mapname
>>>>
>>>>
>>>> could help.
>>>>
>>>>
>>>> Hamish
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Kind Regards
>>> TS Gumede
>>> CSIR, Meraka Institute
>>> 072 258 1650
>>>
>>>
>>>  This mail was received via Mail-SeCure System.
>>>
>>>
>>>
>>> --
>>> Micha Silverhttp://www.surfaces.co.il/
>>> Arava Development Co.  +972-52-3665918
>>>
>>>
>>>
>>
>>
>> --
>> Kind Regards
>> TS Gumede
>> CSIR, Meraka Institute
>> 072 258 1650
>>
>>
>
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>
> This mail was received via Mail-SeCure System.
>
>
>
> --
> Micha Silver
> Arava Development Co. +972-52-3665918http://surfaces.co.il
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] No Categories found

2010-07-08 Thread Sandile Gumede
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=...@permanent drainage=flow_direction basin=catch
accumulation=acc threshold=1 memory=300 stream=str

# convert catch raster to polygon vector
r.to.vect in=ca...@permanent out=catchments feature=area

 g.region rast=rainfall -p

# Calculate univariate statistics
v.rast.stats -c vector=catchme...@permanent
raster=rainf...@permanentcolpre=precp


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-07-07 Thread Sandile Gumede
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=...@permanent drainage=flow_direction basin=catch
accumulation=acc threshold=1 memory=300 stream=str

# convert catch raster to polygon vector
r.to.vect in=ca...@permanent out=catchments feature=area

 g.region rast=rainfall -p

# Calculate univariate statistics
v.rast.stats -c vector=catchme...@permanent
raster=rainf...@permanentcolpre=precp



On Wed, Jul 7, 2010 at 9:18 AM, Sandile Gumede  wrote:

> Hi
>
> Which module do I use to change the resolutions?
>
>
> 2010/7/6 
>
>> Hello Sandile:
>> It seems you are importing two raster with vastly different resolutions.
>> (I think we already came across this). See below...
>>
>> > Hi
>> >
>> > Below is a step-by-step of what I have done but I'm getting an error
>> when
>> > running v.rast.stats vector=catchments raster=rainfall layer=1
>> > colprefix=area.
>> >
>> >
>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
>> > in=/home/tgumede1/grassdata/Cape_Town/TRMMLast1day.tif out=rainfall
>> >
>> > Projection of input dataset and current location appear to match
>> >  100%
>> > r.in.gdal complete. Raster map  created.
>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=rainfall -p
>> > projection: 3 (Latitude-Longitude)
>> > zone:   0
>> > datum:  wgs84
>> > ellipsoid:  wgs84
>> > north:  33:30S
>> > south:  33:45S
>> > west:   18:15E
>> > east:   19E
>> > nsres:  0:15
>> > ewres:  0:15
>> > rows:   1
>> > cols:   3
>> > cells:  3
>>
>> Here, the rainfall data has a resolution of 0:15 = 15 minutes or 1/4
>> degree. THat's approximately (at the equator) about 27 km. So *one* raster
>> cell is 27 km X 27 km =~ 730 sq.km. Your region is covered by 3 cells, 1
>> row by 3 columns. Not very helpful data!
>>
>> Next...
>>
>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
>> > in=/home/tgumede1/grassdata/Cape_Town/Dem_CF.tif out=dem target=SRTMDEM
>> >
>> >
>> > Projection of input dataset and current location appear to match
>> >  100%
>> > r.in.gdal complete. Raster map  created.
>> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=dem -p
>> > projection: 3 (Latitude-Longitude)
>> > zone:   0
>> >

[GRASS-user] gdal_translate

2010-07-07 Thread Sandile Gumede
Hi

Which module do I use to change the resolutions?

2010/7/6 

> Hello Sandile:
> It seems you are importing two raster with vastly different resolutions.
> (I think we already came across this). See below...
>
> > Hi
> >
> > Below is a step-by-step of what I have done but I'm getting an error when
> > running v.rast.stats vector=catchments raster=rainfall layer=1
> > colprefix=area.
> >
> >
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
> > in=/home/tgumede1/grassdata/Cape_Town/TRMMLast1day.tif out=rainfall
> >
> > Projection of input dataset and current location appear to match
> >  100%
> > r.in.gdal complete. Raster map  created.
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=rainfall -p
> > projection: 3 (Latitude-Longitude)
> > zone:   0
> > datum:  wgs84
> > ellipsoid:  wgs84
> > north:  33:30S
> > south:  33:45S
> > west:   18:15E
> > east:   19E
> > nsres:  0:15
> > ewres:  0:15
> > rows:   1
> > cols:   3
> > cells:  3
>
> Here, the rainfall data has a resolution of 0:15 = 15 minutes or 1/4
> degree. THat's approximately (at the equator) about 27 km. So *one* raster
> cell is 27 km X 27 km =~ 730 sq.km. Your region is covered by 3 cells, 1
> row by 3 columns. Not very helpful data!
>
> Next...
>
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
> > in=/home/tgumede1/grassdata/Cape_Town/Dem_CF.tif out=dem target=SRTMDEM
> >
> >
> > Projection of input dataset and current location appear to match
> >  100%
> > r.in.gdal complete. Raster map  created.
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=dem -p
> > projection: 3 (Latitude-Longitude)
> > zone:   0
> > datum:  wgs84
> > ellipsoid:  wgs84
> > north:  33:40:46.499215S
> > south:  34:00:52.499215S
> > west:   18:17:55.500436E
> > east:   19:10:16.500436E
> > nsres:  0:00:03
> > ewres:  0:00:03
> > rows:   402
> > cols:   1047
> > cells:  420894
>
> Your DEM layer, on the other hand, is of resolution 3 arc seconds, or
> about 90 meters on a side. So each cell is 90 m. X 90 m = 8100 sq.m. =~
> 0.0081 sq.km.
>
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.watershed elevation=dem
> > accumulation=acc drainage=direction basin=catch stream=str threshold=200
> >
>
> Here you chose a threshold of 200. That's 200 cells, so about 200 X 0.0081
> sq.km, or 1.6 sq km. As a result (see below, the output of r.to.vect) you
> are getting over 19,000 tiny little catchments. Are you sure that's what
> you want??
>
> Finally, you're trying to get raster values for 19,000 tiny vector areas
> where the raster (rainfall) is only 3 cells! You'll have 1000's of
> catchments with all the same values. And I guess that some of these
> catchments are extending outside of the three rainfall cells, and causing
> the  NULL value error.
>
> In short: I think you'll need to match the resolution of the DEM to that
> of the rainfall data. If the rainfall is only as accurate as 1 data value
> per 730 sq.km. then you will be able to do vector-raster analyses only at
> that resolution = i.e. continent scale maps.
>
> HTH
> --
> Micha
>
> >
> > SECTION 1a (of 5): Initiating Memory.
> > SECTION 1b (of 5): Determining Offmap Flow.
> >  100%
> > SECTION 2: A * Search.
> >  100%
> > SECTION 3: Accumulating Surface Flow.
> >  100%
> > SECTION 4: Watershed determination.
> >  100%
> > SECTION 5: Closing Maps.
> >  100%
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.to.vect -s in=catch out=catchments
> > feature=area
> > Extracting areas...
> >  100%
> >  100%
> > Building topology for vector map ...
> > Registering primitives...
> > 60653 primitives registered
> > 314051 vertices registered
> > Building areas...
> >  100%
> > 19885 areas built
> > 1 isles built
> > Attaching islands...
> >  100%
> > Attaching centroids...
> >  100%
> > Number of nodes: 40769
> > Number of primitives: 60653
> > Number of points: 0
> > Number of lines: 0
> > Number of boundaries: 40768
> > Number of centroids: 19885
> > Number of areas: 19885
> > Number of isles: 1
> > r.to.vect complete.
> >
> > GRASS 6.4.0RC5+39438 (SRTMDEM):~ > v.rast.stats vector=catchments
> > raster=rainfall layer=1 colprefix=precip
> >
> > DBMI-DBF driver error:
> > SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
> > in statement:
> > UPDATE catchments SET precip_min=-NULL WHERE cat=10163
> > Error in db_execute_immediate()
> >
> > ERROR: Error while executing: 'UPDATE catchments SET precip_min=-NULL
> > WHERE
> >cat=10163'
> >
> >
> >
> > Here is the output of gdalinfo TRMMLast1day.tif
> >
> > Origin = (18.250,-33.500)
> > Pixel Size = (0.250,-0.250)
> >
> > 
> > coordinates
> > Corner Coordinates:
> > Upper Left  (  18.250, -33.500)
> > Lower Left  (  18.250, -33.750)
> > Upper Right (  19.000, -33.500)
> > Lower Right (  19.000, -33.750)
> > Center  (  18.625, 

[GRASS-user] gdal_translate

2010-07-06 Thread Sandile Gumede
Hi

Below is a step-by-step of what I have done but I'm getting an error when
running v.rast.stats vector=catchments raster=rainfall layer=1
colprefix=area.


GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
in=/home/tgumede1/grassdata/Cape_Town/TRMMLast1day.tif out=rainfall

Projection of input dataset and current location appear to match
 100%
r.in.gdal complete. Raster map  created.
GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=rainfall -p
projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  33:30S
south:  33:45S
west:   18:15E
east:   19E
nsres:  0:15
ewres:  0:15
rows:   1
cols:   3
cells:  3
GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.in.gdal
in=/home/tgumede1/grassdata/Cape_Town/Dem_CF.tif out=dem target=SRTMDEM


Projection of input dataset and current location appear to match
 100%
r.in.gdal complete. Raster map  created.
GRASS 6.4.0RC5+39438 (SRTMDEM):~ > g.region rast=dem -p
projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  33:40:46.499215S
south:  34:00:52.499215S
west:   18:17:55.500436E
east:   19:10:16.500436E
nsres:  0:00:03
ewres:  0:00:03
rows:   402
cols:   1047
cells:  420894
GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.watershed elevation=dem
accumulation=acc drainage=direction basin=catch stream=str threshold=200


SECTION 1a (of 5): Initiating Memory.
SECTION 1b (of 5): Determining Offmap Flow.
 100%
SECTION 2: A * Search.
 100%
SECTION 3: Accumulating Surface Flow.
 100%
SECTION 4: Watershed determination.
 100%
SECTION 5: Closing Maps.
 100%
GRASS 6.4.0RC5+39438 (SRTMDEM):~ > r.to.vect -s in=catch out=catchments
feature=area
Extracting areas...
 100%
 100%
Building topology for vector map ...
Registering primitives...
60653 primitives registered
314051 vertices registered
Building areas...
 100%
19885 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 40769
Number of primitives: 60653
Number of points: 0
Number of lines: 0
Number of boundaries: 40768
Number of centroids: 19885
Number of areas: 19885
Number of isles: 1
r.to.vect complete.

GRASS 6.4.0RC5+39438 (SRTMDEM):~ > v.rast.stats vector=catchments
raster=rainfall layer=1 colprefix=precip

DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NULL_VALUE processing 'NULL'
in statement:
UPDATE catchments SET precip_min=-NULL WHERE cat=10163
Error in db_execute_immediate()

ERROR: Error while executing: 'UPDATE catchments SET precip_min=-NULL WHERE
   cat=10163'



Here is the output of gdalinfo TRMMLast1day.tif

Origin = (18.250,-33.500)
Pixel Size = (0.250,-0.250)

 coordinates
Corner Coordinates:
Upper Left  (  18.250, -33.500)
Lower Left  (  18.250, -33.750)
Upper Right (  19.000, -33.500)
Lower Right (  19.000, -33.750)
Center  (  18.625, -33.625)


Here is what I did to clip the region of interest.

gdal_translate -a_srs EPSG:4326 -projwin 18.2987501 -33.6795831 19.1712501
-34.0141665 3B42RT.2010032900.1day.tif TRMMLast1day.tif


Is there something I have done wrong in these steps or there is something
wrong with my coordinates?



2010/7/6 

> > Hi
> >
> > Is it wrong to use  -a_ullr option in gdal_translate to clip a small
> > portion
> > of the region from the big geotiff file region?
> >
>
> The option -a_ullr will change the georeference of the resulting file, so
> you could say it's "wrong" if you want to keep the original referencing.
> The way to clip a portion of the original and still maintain
> geo-referencing is with the -projwin option.
>
> --
> Micha
>
> > --
> > Kind Regards
> > TS Gumede
> > CSIR, Meraka Institute
> > 072 258 1650
> >
> > This mail was received via Mail-SeCure System.
> >
> >
> >
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] gdal_translate

2010-07-06 Thread Sandile Gumede
Hi

Is it wrong to use  -a_ullr option in gdal_translate to clip a small portion
of the region from the big geotiff file region?

-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] shell script

2010-06-28 Thread Sandile Gumede
Hi,

How do I set $LOCATION_NAME and $MAPSET, I've tried but still saying
LOCATION_NAME and MAPSET not set?

On Mon, Jun 28, 2010 at 11:51 AM, Paul Kelly
wrote:

> Sandile Gumede wrote:
>
>> 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
>> GISDBASE=/home/tgumede1/grassdata
>>  LOCATION_NAME=Floods
>>  MAPSET=PERMANENT
>>  GISBASE=/usr/lib/grass64
>>
>
GSIDBASE= 'g.gisenv GISDBASE'
LOCATION_NAME='g.gisenv LOCATION_NAME'
MAPSET='g.gisenv MAPSET'

LOCATION="${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}"


> # 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
>>
>
>
> Where are the variables $LOCATION_NAME and $MAPSET being set? As far as I
> can see they seem to be empty - could that be the problem?
>
> Paul
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] shell script

2010-06-28 Thread Sandile Gumede
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
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] bash script

2010-06-24 Thread Sandile Gumede
Thanks, The only problem I have now when I'm running the script, it gives me
an error saying LOCATION_NAME not set. See below:

#!/bin/sh

#variable to customize:
# path to GRASS software main directory
export GISBASE=/usr/lib/grass64
# path to GRASS database
GISDBASE=$HOME/grassdata

# nothing to change below
MAP=$1
LOCATION=$2


# generate temporal LOCATION:
TEMPDIR=tmp
mkdir -p $GISDBASE/$TEMPDIR/temp

# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi

 echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
 echo "MAPSET:tmp" >> $HOME/.grassrc6
 echo "DIGITIZER: none" >> $HOME/.grassrc6
 echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6



# path to GRASS settings file:
export GISRC=$TEMPDIR/.grassrc6

# first our GRASS, then the rest
export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH

# first have our private libraries:
export LD_LIBRARY_PATH=$GISBASE/lib:$LD_LIBRARY_PATH
export GRASS_LD_LIBRARY_PATH=$LD_LIBRARY_PATH

# settings for graphical output
PNGOUTPUTDIR=$TEMPDIR
# current date
DATE=`LC_ALL=C date -R | tr -s ' ' ' ' | cut -d' ' -f2,3,4 | tr -s ' ' '_'`
export GRASS_PNGFILE=$PNGOUTPUTDIR/grass6_recent_floods_${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
}


# import DEM data set.
cd /home/tgumede1/grassdata
r.in.gdal input=TRMMLast1day.tif output=rainfall
# set region to default settings
g.region rast=rainfall

# import DEM data set.
r.in.gdal input=Dem_CF.tif output=dem
# set region to default settings
g.region rast=dem





On Thu, Jun 24, 2010 at 10:55 AM, Paul Kelly
wrote:

> Sandile Gumede wrote:
>
>> I'm using ubuntu, I installed grass from the synaptic. So the script to
>> start grass is in /usr/bin then the file name is grass64
>> (/usr/bin/grass64) and the scripts are in /usr/lib/grass64 then inside
>> grass64 folder you get other folder like scripts and so on. That is why
>> in my script I wrote:
>>
>
> Then your GISBASE should be /usr/lib/grass64
>
> The location of /usr/bin/grass64 is irrelevant - it is only a startup
> script to set appropriate environment variables, etc. You are doing all this
> in your script so you don't need to use the grass64 script at all (and GRASS
> doesn't need it for anything else).
>
> Hopefully that makes it clearer?
>
> Paul
>



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] bash script

2010-06-24 Thread Sandile Gumede
I'm using ubuntu, I installed grass from the synaptic. So the script to
start grass is in /usr/bin then the file name is grass64 (/usr/bin/grass64)
and the scripts are in /usr/lib/grass64 then inside grass64 folder you get
other folder like scripts and so on. That is why in my script I wrote:

# start GRASS
GISBASE=/usr/bin/grass64

# path to the scripts
GISBASELIB=/usr/lib/grass64

But I tried to export the PATH you gave me, still giving me an error of
r.in.gdal not found

On Thu, Jun 24, 2010 at 9:16 AM, Markus Metz <
markus.metz.gisw...@googlemail.com> wrote:

> Sandile Gumede wrote:
> >
> > [snip]
> >
> >
> > # first our GRASS, then the rest
> > export PATH=$GISBASE:$GISBASELIB/scripts:$PATH
>
> Try
> export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH"
>
> See also etc/init.sh for inspiration
>
> Markus M
>



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] bash script

2010-06-23 Thread Sandile Gumede
Hi

I'm trying to run GRASS and import raster map using a bash script but I'm
getting an error saying r.in.gdal not found.

What have I done wrong? see the script below.

#!/bin/sh

#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/bin/grass64
# path to GRASS database
GISDBASE=$HOME/grassdem

GISBASELIB=/usr/lib/grass64

# nothing to change below
MAP=SRTMDEM.tiff
LOCATION=/home/tgumede1/
grassdem


# generate temporal LOCATION:
TEMPDIR=Floods
mkdir -p $GISDBASE/$TEMPDIR/tmp

# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi

echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
echo "MAPSET:tmp" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
export GISBASE=$GISBASE

# first our GRASS, then the rest
export PATH=$GISBASE:$GISBASELIB/scripts:$PATH

# first have our private libraries:
export LD_LIBRARY_PATH=$GISDBASE/lib:$GISBASELIB/lib:$LD_LIBRARY_PATH

# import raster map into new location:
r.in.gdal -eo in=$MAP out=dem location=$LOCATION
if [$? -eq 1] ; then
echo "An error occured. Stop."
exit 1
fi

# restore saved $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] bash script

2010-06-23 Thread Sandile Gumede
Hi

I'm trying to run GRASS and import raster map using a bash script but I'm
getting an error saying r.in.gdal not found.

What have I done wrong? see the script below.

#!/bin/sh

#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/bin/grass64
# path to GRASS database
GISDBASE=$HOME/grassdem

GISBASELIB=/usr/lib/grass64

# nothing to change below
MAP=SRTMDEM.tiff
LOCATION=/home/tgumede1/grassdem


# generate temporal LOCATION:
TEMPDIR=Floods
mkdir -p $GISDBASE/$TEMPDIR/tmp

# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi

echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
echo "MAPSET:tmp" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
export GISBASE=$GISBASE

# first our GRASS, then the rest
export PATH=$GISBASE:$GISBASELIB/scripts:$PATH

# first have our private libraries:
export LD_LIBRARY_PATH=$GISDBASE/lib:$GISBASELIB/lib:$LD_LIBRARY_PATH

# import raster map into new location:
r.in.gdal -eo in=$MAP out=dem location=$LOCATION
if [$? -eq 1] ; then
echo "An error occured. Stop."
exit 1
fi

# restore saved $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Re: v.rast.stats

2010-06-22 Thread Sandile Gumede
It's in mm/hr.

Are these values normal, to me it seems like big values because they are
ranging from 2000-4500, see below I just copied a few:

120795|4076||1|4076|4076|0|4076|0|0|0|4076
120796|4080||1|4080|4080|0|4080|0|0|0|4080
120797|4084||1|4084|4084|0|4084|0|0|0|4084
120798|4088||1|4088|4088|0|4088|0|0|0|4088
120799|4092||1|4092|4092|0|4092|0|0|0|4092
120800|4096||1|4096|4096|0|4096|0|0|0|4096
120801|4100||1|4100|4100|0|4100|0|0|0|4100
120802|4104||1|4104|4104|0|4104|0|0|0|4104
120803|4108||1|4108|4108|0|4108|0|0|0|4108
120804|4112||1|4112|4112|0|4112|0|0|0|4112
120805|4116||1|4116|4116|0|4116|0|0|0|4116
120806|4120||1|4120|4120|0|4120|0|0|0|4120
120807|4124||1|4124|4124|0|4124|0|0|0|4124
120808|4128||1|4128|4128|0|4128|0|0|0|4128
120809|4144||1|4144|4144|0|4144|0|0|0|4144
120810|4148||1|4148|4148|0|4148|0|0|0|4148
120811|4152||1|4152|4152|0|4152|0|0|0|4152
120812|4156||1|4156|4156|0|4156|0|0|0|4156


2010/6/22 Micha Silver 

>  On 22/06/2010 13:08, Sandile Gumede wrote:
>
> Thanks, I finally got the results.
>
> That's good to hear.
>
>
> Now the question I would like to ask is that, from these columns I got the
> values but which unit are these values are measured? Is it (mm) or ?
>
> Well, that depends on the units of the raster. If the raster values are mm.
> then each column represents mm per *raster cell*.  So if you have a rainfall
> raster with values in mm., and resolution of 10 meters, then the numbers in
> the columns are mm/100sq.m.
> --
> Micha
>
>
>
> On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:
>
>>  Hello Sandile:
>> I tried to duplicate your steps and it seems to work for me.
>> Here's what I did:
>>
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>>  gdalinfo 3B42RT.2010032900.1day.tif
>> Driver: GTiff/GeoTIFF
>> Files: 3B42RT.2010032900.1day.tif
>>3B42RT.2010032900.1day.tfw
>> Size is 1440, 480
>> Coordinate System is `'
>> Origin = (-180.000,60.000)
>> Pixel Size = (0.250,-0.250)
>> 
>>
>>  Note: no projection info above 
>>
>>  Now I use the -projwin option of gdal_translate to select a small
>> window
>> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
>> 3B42RT.2010032900.1day.tif rainfall_il.tif
>>
>>  GEOGCS entry now shows 4326 
>>
>> g.mapset map=ASTER_DEM loc=WGS84
>> - A location setup as EPSG:4326
>>
>> r.in.gdal israel.tif out=rainfall_il
>>
>> r.univar rainfall_il
>>  100%
>> total null and non-null cells: 7776
>>
>> total null cells: 0
>>
>> Of the non-null cells:
>> --
>>  n: 7776
>> minimum: 0
>> maximum: 34
>> range: 34
>> mean: 0.364583
>> mean of absolute values: 0.364583
>> standard deviation: 3.45241
>> variance: 11.9192
>> variation coefficient: 946.948 %
>> sum: 2835
>>
>>
>> - Now using an existing catchment vector map 
>> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
>> v.info -c arava_wsheds
>> Displaying column types/names for database connection of layer 1:
>> INTEGER|cat
>> CHARACTER|label
>> DOUBLE PRECISION|area_km
>> INTEGER|precip_n
>> DOUBLE PRECISION|precip_min
>> DOUBLE PRECISION|precip_max
>> DOUBLE PRECISION|precip_range
>> DOUBLE PRECISION|precip_mean
>> DOUBLE PRECISION|precip_stddev
>> DOUBLE PRECISION|precip_variance
>> DOUBLE PRECISION|precip_cf_var
>> DOUBLE PRECISION|precip_sum
>>
>>  and some values 
>>
>> v.db.select arava_wsheds
>>
>> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
>> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
>> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
>> 28|Og|124.122969|
>> 36|Zarqa|273.606213|
>> 24|Kidron|122.460114|
>> 9|Darga|289.012122|
>> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
>> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>>
>>  (Many catchments have 0 or no value because of the small region I
>> chose. The global data is 1/4 degree resolution and my region is only 2 deg
>> E-W.)
>>
>> HTH...
>> --
>> Micha
>>
>>
>>
>> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I 

[GRASS-user] v.rast.stats

2010-06-22 Thread Sandile Gumede
Thanks, I finally got the results.

Now the question I would like to ask is that, from these columns I got the
values but which unit are these values are measured? Is it (mm) or ?




On Tue, Jun 22, 2010 at 12:08 PM, Sandile Gumede wrote:

> Thanks, I finally got the results.
>
> Now the question I would like to ask is that, from these columns I got the
> values but which unit are these values are measured? Is it (mm) or ?
>
>
> On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:
>
>>  Hello Sandile:
>> I tried to duplicate your steps and it seems to work for me.
>> Here's what I did:
>>
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdalinfo 3B42RT.2010032900.1day.tif
>> Driver: GTiff/GeoTIFF
>> Files: 3B42RT.2010032900.1day.tif
>>3B42RT.2010032900.1day.tfw
>> Size is 1440, 480
>> Coordinate System is `'
>> Origin = (-180.000,60.000)
>> Pixel Size = (0.250,-0.250)
>> 
>>
>>  Note: no projection info above 
>>
>>  Now I use the -projwin option of gdal_translate to select a small
>> window
>> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
>> 3B42RT.2010032900.1day.tif rainfall_il.tif
>>
>>  GEOGCS entry now shows 4326 
>>
>> g.mapset map=ASTER_DEM loc=WGS84
>> - A location setup as EPSG:4326
>>
>> r.in.gdal israel.tif out=rainfall_il
>>
>> r.univar rainfall_il
>>  100%
>> total null and non-null cells: 7776
>>
>> total null cells: 0
>>
>> Of the non-null cells:
>> --
>> n: 7776
>> minimum: 0
>> maximum: 34
>> range: 34
>> mean: 0.364583
>> mean of absolute values: 0.364583
>> standard deviation: 3.45241
>> variance: 11.9192
>> variation coefficient: 946.948 %
>> sum: 2835
>>
>>
>> - Now using an existing catchment vector map 
>> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
>> v.info -c arava_wsheds
>> Displaying column types/names for database connection of layer 1:
>> INTEGER|cat
>> CHARACTER|label
>> DOUBLE PRECISION|area_km
>> INTEGER|precip_n
>> DOUBLE PRECISION|precip_min
>> DOUBLE PRECISION|precip_max
>> DOUBLE PRECISION|precip_range
>> DOUBLE PRECISION|precip_mean
>> DOUBLE PRECISION|precip_stddev
>> DOUBLE PRECISION|precip_variance
>> DOUBLE PRECISION|precip_cf_var
>> DOUBLE PRECISION|precip_sum
>>
>>  and some values 
>>
>> v.db.select arava_wsheds
>>
>> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
>> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
>> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
>> 28|Og|124.122969|
>> 36|Zarqa|273.606213|
>> 24|Kidron|122.460114|
>> 9|Darga|289.012122|
>> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
>> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>>
>>  (Many catchments have 0 or no value because of the small region I
>> chose. The global data is 1/4 degree resolution and my region is only 2 deg
>> E-W.)
>>
>> HTH...
>> --
>> Micha
>>
>>
>>
>> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
>> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
>> TRMMLast1day.tif
>>
>>
>>
>>
>> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>>
>>> Hi
>>>
>>> It is still giving me -NULL value error.
>>>
>>> Do you thin

[GRASS-user] Re: v.rast.stats

2010-06-22 Thread Sandile Gumede
Thanks, I finally got the results.

Now the question I would like to ask is that, from these columns I got the
values but which unit are these values are measured? Is it (mm) or ?

On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver  wrote:

>  Hello Sandile:
> I tried to duplicate your steps and it seems to work for me.
> Here's what I did:
>
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdalinfo 3B42RT.2010032900.1day.tif
> Driver: GTiff/GeoTIFF
> Files: 3B42RT.2010032900.1day.tif
>3B42RT.2010032900.1day.tfw
> Size is 1440, 480
> Coordinate System is `'
> Origin = (-180.000,60.000)
> Pixel Size = (0.250,-0.250)
> 
>
>  Note: no projection info above 
>
>  Now I use the -projwin option of gdal_translate to select a small
> window
> gdal_translate -a_srs EPSG:4326 -projwin 34.0 33.0 36.0 29.0
> 3B42RT.2010032900.1day.tif rainfall_il.tif
>
>  GEOGCS entry now shows 4326 
>
> g.mapset map=ASTER_DEM loc=WGS84
> - A location setup as EPSG:4326
>
> r.in.gdal israel.tif out=rainfall_il
>
> r.univar rainfall_il
>  100%
> total null and non-null cells: 7776
>
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 7776
> minimum: 0
> maximum: 34
> range: 34
> mean: 0.364583
> mean of absolute values: 0.364583
> standard deviation: 3.45241
> variance: 11.9192
> variation coefficient: 946.948 %
> sum: 2835
>
>
> - Now using an existing catchment vector map 
> v.rast.stats vect=arava_wsheds rast=rainfall_il colpre=precip
> v.info -c arava_wsheds
> Displaying column types/names for database connection of layer 1:
> INTEGER|cat
> CHARACTER|label
> DOUBLE PRECISION|area_km
> INTEGER|precip_n
> DOUBLE PRECISION|precip_min
> DOUBLE PRECISION|precip_max
> DOUBLE PRECISION|precip_range
> DOUBLE PRECISION|precip_mean
> DOUBLE PRECISION|precip_stddev
> DOUBLE PRECISION|precip_variance
> DOUBLE PRECISION|precip_cf_var
> DOUBLE PRECISION|precip_sum
>
>  and some values 
>
> v.db.select arava_wsheds
>
> cat|label|area_km|precip_n|precip_min|precip_max|precip_range|precip_mean|precip_stddev|precip_variance|precip_cf_var|precip_sum
> 21|Jordan|1055.231692|2|0|0|0|0|0|0||0
> 19|Hidan|987.811979|2|0|0|0|0|0|0||0
> 28|Og|124.122969|
> 36|Zarqa|273.606213|
> 24|Kidron|122.460114|
> 9|Darga|289.012122|
> 6|Arugot|236.365116|1|0|0|0|0|0|0||0
> 26|Mujib|1277.546513|2|0|0|0|0|0|0||0
>
>  (Many catchments have 0 or no value because of the small region I
> chose. The global data is 1/4 degree resolution and my region is only 2 deg
> E-W.)
>
> HTH...
> --
> Micha
>
>
>
> On 06/17/2010 12:50 PM, Sandile Gumede wrote:
>
> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
>
> On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:
>
>> Hi
>>
>> It is still giving me -NULL value error.
>>
>> Do you think maybe its the way I downloaded my rainfall data? This is the
>> site where I downloaded my data sets*
>> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
>> world, the only thing I did was to clip a specific region (using
>> coordinates) that is in South Africa to do my analysis. I used a bash script
>> to download and project the data, see below:
>>
>>
>> #!/bin/bash
>>
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
>> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>>
>> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
>> "COMPRESS=LZW" -co "TILED=YES" -a_srs 

[GRASS-user] scripts

2010-06-17 Thread Sandile Gumede
Hi

I'm not familiar with bash scripting, I want to write a script that starts
GRASS and create a new LOCATION and a MAPSET, specify the coordinate system
for my database, specify a geodetic datum for the LOCATION, import datasets
into the GRASS, do watershed analysis on the DEM data set, convert DEM
raster into vector, and then calculate univariate statistics from a GRASS
raster map.

Can you guys help me with this? I tried to write a script and I got stucked,
see below:

#!/bin/sh

#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/bin/grass64
# path to GRASS database
GISDBASE=$HOME/grassdem

# nothing to change below
#MAP=PERMANENT
#LOCATION=SRTMDEM


# generate temporal LOCATION:
LOCATION=srtmdem
mkdir -p $GISDBASE/$LOCATION/PERMANENT

# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$HOME/grassdem/$LOCATION.grassrc6
fi

echo "LOCATION_NAME: $LOCATION" > $HOME/.grassrc6
echo "MAPSET:tmp" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
export GISBASE=$GISBASE





-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-06-17 Thread Sandile Gumede
Hi

It is still giving me -NULL value error.

Do you think maybe its the way I downloaded my rainfall data? This is the
site where I downloaded my data sets* ftp://trmmopen.gsfc.nasa.gov/pub/gis/
*and this data covers the whole world, the only thing I did was to clip a
specific region (using coordinates) that is in South Africa to do my
analysis. I used a bash script to download and project the data, see below:


#!/bin/bash

wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw

gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
"COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
-33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
TRMMLast1day.tif




On Thu, Jun 17, 2010 at 8:41 AM, Sandile Gumede wrote:

> Hi
>
> It is still giving me -NULL value error.
>
> Do you think maybe its the way I downloaded my rainfall data? This is the
> site where I downloaded my data sets*
> ftp://trmmopen.gsfc.nasa.gov/pub/gis/ *and this data covers the whole
> world, the only thing I did was to clip a specific region (using
> coordinates) that is in South Africa to do my analysis. I used a bash script
> to download and project the data, see below:
>
>
> #!/bin/bash
>
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
> wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw
>
> gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
> "COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
> -33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
> TRMMLast1day.tif
>
>
>
> 2010/6/15 Micha Silver 
>
>>  On 15/06/2010 14:35, Sandile Gumede wrote:
>>
>> Hi
>> If I run g.region rast=rainfall -p, I get:
>>
>> OK, what you've done here is change the current region to match the raster
>> "rainfall".
>> Can you now try:
>> v.rast.stats -c vect=catchments rast=rainfall pref=precip
>>
>>
>>
>>
>> projection: 3 (Latitude-Longitude)
>> zone:   0
>> datum:  wgs84
>> ellipsoid:  wgs84
>> north:  33:40:46.49916S
>> south:  34:20:55.49928S
>> west:   18:17:55.50036E
>> east:   19:10:16.50036E
>> nsres:  0:00:05.01875
>> ewres:  0:00:02.18125
>> rows:   480
>> cols:   1440
>> cells:  691200
>>
>> and If I run r.univar rainfall, I get the following output:
>>
>>  100%
>> total null and non-null cells: 691200
>> total null cells: 0
>>
>> Of the non-null cells:
>> --
>> n: 691200
>> minimum: 0
>> maximum: 3094
>> range: 3094
>> mean: 22.0228
>> mean of absolute values: 22.0228
>> standard deviation: 76.1639
>> variance: 5800.94
>> variation coefficient: 345.841 %
>> sum: 15222164
>>
>>
>>
>> On Tue, Jun 15, 2010 at 12:22 PM, Hamish  wrote:
>>
>>> Micha wrote:
>>> > The only unusual thing I notice above is that the resolution settings
>>> > for the raster are different N-S and E-W. This came from the original
>>> > tiff (see below) which also has rectangular pixels,
>>>
>>>  that is perfectly normal for a lat/lon map away from the equator.
>>> longitude scales a cos(lat).
>>>
>>>
>>> > (the v.rast.stats module creates a temp raster at the *current region's
>>> > resolution* settings, which might be different from this rainfall
>>> > raster's rectangular resolution...)
>>>
>>>  the results of:
>>>
>>> g.region -p rast=mapname
>>> r.univar mapname
>>>
>>>
>>> could help.
>>>
>>>
>>> Hamish
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Kind Regards
>> TS Gumede
>> CSIR, Meraka Institute
>> 072 258 1650
>>
>>
>> This mail was received via Mail-SeCure System.
>>
>>
>>
>> --
>> Micha Silverhttp://www.surfaces.co.il/
>> Arava Development Co.  +972-52-3665918
>>
>>
>
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-06-16 Thread Sandile Gumede
Hi

It is still giving me -NULL value error.

Do you think maybe its the way I downloaded my rainfall data? This is the
site where I downloaded my data sets* ftp://trmmopen.gsfc.nasa.gov/pub/gis/
*and this data covers the whole world, the only thing I did was to clip a
specific region (using coordinates) that is in South Africa to do my
analysis. I used a bash script to download and project the data, see below:


#!/bin/bash

wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tif
wget ftp://trmmopen.gsfc.nasa.gov/pub/gis/3B42RT.2010032900.1day.tfw

gdal_translate -of GTiff -co "PROFILE=GeoTIFF" -co "INTERLEAVE=PIXEL" -co
"COMPRESS=LZW" -co "TILED=YES" -a_srs EPSG:4326 -a_ullr 18.2987501
-33.6795831 19.1712501 -34.3487498 3B42RT.2010032900.1day.tif
TRMMLast1day.tif



2010/6/15 Micha Silver 

>  On 15/06/2010 14:35, Sandile Gumede wrote:
>
> Hi
> If I run g.region rast=rainfall -p, I get:
>
> OK, what you've done here is change the current region to match the raster
> "rainfall".
> Can you now try:
> v.rast.stats -c vect=catchments rast=rainfall pref=precip
>
>
>
>
> projection: 3 (Latitude-Longitude)
> zone:   0
> datum:  wgs84
> ellipsoid:  wgs84
> north:  33:40:46.49916S
> south:  34:20:55.49928S
> west:   18:17:55.50036E
> east:   19:10:16.50036E
> nsres:  0:00:05.01875
> ewres:  0:00:02.18125
> rows:   480
> cols:   1440
> cells:  691200
>
> and If I run r.univar rainfall, I get the following output:
>
>  100%
> total null and non-null cells: 691200
> total null cells: 0
>
> Of the non-null cells:
> --
> n: 691200
> minimum: 0
> maximum: 3094
> range: 3094
> mean: 22.0228
> mean of absolute values: 22.0228
> standard deviation: 76.1639
> variance: 5800.94
> variation coefficient: 345.841 %
> sum: 15222164
>
>
>
> On Tue, Jun 15, 2010 at 12:22 PM, Hamish  wrote:
>
>> Micha wrote:
>> > The only unusual thing I notice above is that the resolution settings
>> > for the raster are different N-S and E-W. This came from the original
>> > tiff (see below) which also has rectangular pixels,
>>
>>  that is perfectly normal for a lat/lon map away from the equator.
>> longitude scales a cos(lat).
>>
>>
>> > (the v.rast.stats module creates a temp raster at the *current region's
>> > resolution* settings, which might be different from this rainfall
>> > raster's rectangular resolution...)
>>
>>  the results of:
>>
>> g.region -p rast=mapname
>> r.univar mapname
>>
>>
>> could help.
>>
>>
>> Hamish
>>
>>
>>
>>
>
>
> --
> Kind Regards
> TS Gumede
> CSIR, Meraka Institute
> 072 258 1650
>
>
> This mail was received via Mail-SeCure System.
>
>
>
> --
> Micha Silverhttp://www.surfaces.co.il/
> Arava Development Co.  +972-52-3665918
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: v.rast.stats

2010-06-15 Thread Sandile Gumede
Hi
If I run g.region rast=rainfall -p, I get:

projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  33:40:46.49916S
south:  34:20:55.49928S
west:   18:17:55.50036E
east:   19:10:16.50036E
nsres:  0:00:05.01875
ewres:  0:00:02.18125
rows:   480
cols:   1440
cells:  691200

and If I run r.univar rainfall, I get the following output:

 100%
total null and non-null cells: 691200
total null cells: 0

Of the non-null cells:
--
n: 691200
minimum: 0
maximum: 3094
range: 3094
mean: 22.0228
mean of absolute values: 22.0228
standard deviation: 76.1639
variance: 5800.94
variation coefficient: 345.841 %
sum: 15222164



On Tue, Jun 15, 2010 at 12:22 PM, Hamish  wrote:

> Micha wrote:
> > The only unusual thing I notice above is that the resolution settings
> > for the raster are different N-S and E-W. This came from the original
> > tiff (see below) which also has rectangular pixels,
>
> that is perfectly normal for a lat/lon map away from the equator.
> longitude scales a cos(lat).
>
>
> > (the v.rast.stats module creates a temp raster at the *current region's
> > resolution* settings, which might be different from this rainfall
> > raster's rectangular resolution...)
>
> the results of:
>
> g.region -p rast=mapname
> r.univar mapname
>
>
> could help.
>
>
> Hamish
>
>
>
>


-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-06-08 Thread Sandile Gumede
Hi,

After running *v.rast.stats vect=catchments rast=rainfall colprefix=precip*,
I ran *v.info -c catchments* and I got 9 new columns:
precip_min, precip_max, precip_ran, precip_mean, precip_std, precip_var,
precip_cf_, precip_sum,.,precip_per.

How do I then be able to see how much rain has fallen in each
catchment(polygon), and which direction is the water flowing?

-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] gdal_translate

2010-06-06 Thread Sandile Gumede
Hi

I've got these coordinates
upper-right-corner: 33 degrees, 40 minutes, 31.28 seconds S
   18 degrees, 17 minutes, 32.52 seconds E


 lower-left-corner: 33 degrees, 40 minutes, 31.28 seconds S
  18 degrees, 38 minutes, 55.37 seconds E

I want to clip a portion of Cape Flats using these coordinates from a
GeoTiff that covers the whole South Africa. I tried to convert these
coordinates into decimal degrees but when I'm trying to run   gdal_translate
-projwin -33.67536 18.29237 -33.94925 18.64871 srtmgdem.tif cape_flats.tif
its giving me an error message:

Input file size is 36001 , 24001
Computed -srcwin -52409 -39950 -328 -427 from projected window.
Computed -srcwin falls outside raster size of 36001X24001
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] gdal

2010-06-04 Thread Sandile Gumede
Hi

I've got a geotiff file which covers the area of South Africa, from that tif
file I want to take a portion of Cape Flats (Western Cape) and run it on
GRASS. Which command should I use to do this?

-- 
Kind Regards
TS Gumede
Student Researcher
Meraka Institute, CSIR
office   :  012 841 2606
mobile :  072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] v.rast.stats

2010-06-03 Thread Sandile Gumede
Hi

When I'm running the command below I'm getting some errors, I pasted them
   below
   v.rast.stats -ec vector=catchments raster=rainfall colprefix=rain_cols
percentile=90

   DBMI-DBF driver error: SQL parser error: syntax error, unexpected
NULL_VALUE
   processing 'NULL'
   in statement: UPDATE catchments SET rain_cols_=-NULL WHERE cat=1
   Error in db_execute_immediate
   ERROR: Error while executing: 'UPDATE catchments SET rain_cols_=-NULL
WHERE
   cat=1'


-- 
Kind Regards
TS Gumede
Student Researcher
Meraka Institute, CSIR
office   :  012 841 2606
mobile :  072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] projecting

2010-05-31 Thread Sandile Gumede
Hi,

I'm trying to import two .tif raster data in the same LOCATION, I imported
the first one fine but when I import the second raster image it gives me an
error.

1 Over-riding projection check
2 Illegal latitude for North.

-- 
Kind Regards
TS Gumede
Student Researcher
Meraka Institute, CSIR
office   :  012 841 2606
mobile :  072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] rainfall data and a DEM

2010-05-28 Thread Sandile Gumede
Hi,

Is there a way of merging rainfall data and SRTM DEM (both in GEOTIFF format
) together?

The reason I'm asking this is because SRTM DEM (elevation layer) is just a
terrain, on top of that terrain I want to measure how much rainfall has
fallen to the DEM and which direction is it flowing to.


-- 
Kind Regards
TS Gumede
Student Researcher
Meraka Institute, CSIR
office   :  012 841 2606
mobile :  072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] rainfall data

2010-05-05 Thread Sandile Gumede
which command do I use to model rainfall data in GRASS6?

-- 
Kind Regards
TS Gumede
Candidate Researcher
Meraka Institute, CSIR
office   :  012 841 2606
mobile :  072 258 1650
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user