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

Micha Silver micha at arava.co.il
Sat Jun 19 15:57:48 EDT 2010


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 at gmail.com 
> <mailto:akasandile at 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 at arava.co.il <mailto:micha at 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 at yahoo.com
>>         <mailto:hamish_b at 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/
>         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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100619/eeeec584/attachment-0001.html


More information about the grass-user mailing list