[GRASS-dev] [GRASS GIS] #2121: v.rast.stats: allow choice of statistics

GRASS GIS trac at osgeo.org
Wed Jan 15 06:10:55 PST 2014


#2121: v.rast.stats: allow choice of statistics
--------------------------+-------------------------------------------------
 Reporter:  mlennert      |       Owner:  grass-dev@…              
     Type:  enhancement   |      Status:  new                      
 Priority:  normal        |   Milestone:  7.0.0                    
Component:  Vector        |     Version:  svn-trunk                
 Keywords:  v.rast.stats  |    Platform:  Unspecified              
      Cpu:  Unspecified   |  
--------------------------+-------------------------------------------------

Comment(by mlennert):

 Replying to [comment:5 lucadelu]:
 > Replying to [comment:4 mlennert]:
 >
 > >
 > > This is great, thanks ! Just one problem: it fails at lines 255-256
 with the dbf driver as colnames get truncated, but your variable names are
 full, and so
 > >
 > >
 > > {{{
 > > variable = colname.replace("%s_" % colprefix, '')
 > > i = variables[variable]
 > > }}}
 > >
 > > leads to a key error since 'variable' does not exist in 'variables'. A
 solution might be to use a dictionary linking variable names to colnames ?
 > >
 >
 > Yes I fixed it using dictionary, try r58728

 Yup, works great now.

 > (it also solve another problem with DBF driver).

 Great, I had just stumbled upon that while testing !

 Now, one more issue: since recently (r57999), there is the possibility to
 abbreviate option values, but this does not seem to work here:


 {{{
 v.rast.stats blks raster=elevation column=elev
 method=mini,maxi,mean,stddev -c
 Processing data (2535 categories)...
 Traceback (most recent call last):
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-unknown-
 linux-gnu/scripts/v.rast.stats", line 295, in <module>
     main()
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-unknown-
 linux-gnu/scripts/v.rast.stats", line 261, in main
     i = variables[variable]
 KeyError: 'mini'
 }}}

 I don't know exactly what's needed to make this work, but it would be nice
 if it did.

 Moritz

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2121#comment:6>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list