[GRASS-user] Problem running v.rast.stats - caused by calculating coefficient of variance when mean=0?

Tim Holland timothyholland at gmail.com
Mon Aug 24 05:48:25 EDT 2009


Hello, 

I am trying to use v.rast.stats in GRASS 6.4, but cannot get it to work with
the vector file I am using.  Vector data I am using is administrative
boundaries (provinces of Vietnam) with the raster being forest cover data at
500m x 500m pixel size.  

Interestingly, it works fine when I use certain subsets of my vector file
(various sets of provinces selected at random), just not when I use the
whole file (i.e. all provinces).  When I use the complete provinces file, it
finishes with errors (copied below).  When I check the attribute table, it
has created the 9 columns it is supposed to, but they are all blank.  

Because of the error message ("TrChng_cf_=inf WHERE cat=3", I think the
issue may have to do with calculating the coefficient of variation when the
mean of an area is equal to zero.  The precision of this data is not
particularly high, and pixels with value zero are common, so with many small
islands, the likelihood of a couple of them having a mean of zero is quite
high.  

If v.rast.stats (which performs its calculations by calling r.univar, I
believe) is unable to calculate the coefficient of variation in one category
because of a mean of zero, does that cause the rest of the run to be
unsuccessful?  Is that what is happening here?  If so, is there any way
around this?  I am not even interested in the coefficient of variation, as I
am only looking for very basic stats (n, mean, max, min).  Is there any way
to tell it to skip the CV, or is there another work-around anyone can think
of?  Or is this some other problem entirely?  

Any advice would be greatly appreciated.  

Thanks, 
Tim


GRASS 6.4.0RC4 (MODIS_TreeCover):~ > v.rast.stats vector=VN_province
raster=MODIS_VCF_TreeCoverChange_2000_2005_indochine colprefix=TrChng
Raster MASK found, temporarily disabled
WARNING: raster <MASK> not found
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)
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)
WARNING: Area without centroid (may be OK for island)
Adding columns < TrChng_n INTEGER, TrChng_min DOUBLE PRECISION, TrChng_max
DOUBLE PRECISION, TrChng_ran DOUBLE PRECISION, TrChng_mea DOUBLE PRECISION,
TrChng_std DOUBLE PRECISION, TrChng_var DOUBLE PRECISION, TrChng_cf_ DOUBLE
PRECISION, TrChng_sum DOUBLE PRECISION>
Processing data ...
Updating the database ...
ERROR: This should not happen: wrong return type in parsing.
dbmi: Protocol error
ERROR: Error while executing: 'UPDATE NorthEast_NoIslands SET
       TrChng_cf_=inf WHERE cat=3'
Restoring previous MASK...
WARNING: raster <63570.0_origmask> not found

-- 
View this message in context: http://n2.nabble.com/Problem-running-v-rast-stats-caused-by-calculating-coefficient-of-variance-when-mean-0-tp3502369p3502369.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list