Hello Micha,
Can you please put all the steps including the steps for the DEM because I tried to duplicate your steps and when I get to the step of
v.rast.stats, I get an error saying
No categories found in raster map.
I tried even to match region resolutions of the two raster maps with g.region rast=rainfall res=0:00:03
here is a step-by-step:
r.in.gdal input=$HOME/grassdata/Cape_Town/Dem_CF.tif output=dem
g.region rast=dem -p
Projection of input dataset and current location appear to match
100%
r.in.gdal complete. Raster map created.
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
r.watershed --o elevation=dem@PERMANENT drainage=flow_direction basin=catch accumulation=acc threshold=1 memory=300 stream=str
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.
WARNING: Default driver / database set to:
driver: dbf
database: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
Extracting areas…
100%
100%
r.to.vect in=catch out=catchments feature=area
Building topology for vector map …
Registering primitives…
1259867 primitives registered
2100907 vertices registered
Building areas…
100%
418835 areas built
1 isles built
Attaching islands…
100%
Attaching centroids…
100%
Number of nodes: 841033
Number of primitives: 1259867
Number of points: 0
Number of lines: 0
Number of boundaries: 841032
Number of centroids: 418835
Number of areas: 418835
Number of isles: 1
r.to.vect complete.
r.in.gdal input=$HOME/grassdata/Cape_Town/TRMMLast1day.tif target=SRTMDEM output=rainfall
Projection of input dataset and current location appear to match
100%
r.in.gdal complete. Raster map created.
100%
g.region rast=rainfall res=0:00:03
r.univar rainfall
total null and non-null cells: 270000
total null cells: 0
Of the non-null cells:
n: 270000
minimum: 0
maximum: 232
range: 232
mean: 109.667
mean of absolute values: 109.667
standard deviation: 95.1362
variance: 9050.89
variation coefficient: 86.7503 %
sum: 29610000
v.rast.stats vector=catchments raster=rainfall colpre=precp
ERROR: No categories found in raster map
On Sat, Jun 19, 2010 at 9:57 PM, Micha Silver <micha@arava.co.il> 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.000000000000000,60.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
…
---- 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: 77760000
total null cells: 0
Of the non-null cells:
n: 77760000
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: 28350000
----- 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 <akasandile@gmail.com> 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 <micha@arava.co.il>
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 <hamish_b@yahoo.com> 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 Silver
[http://www.surfaces.co.il/](http://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-3665918
[http://surfaces.co.il](http://surfaces.co.il)
–
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650