[GRASS-dev] v.rast.stats Python error

Markus Metz markus.metz.giswork at googlemail.com
Fri Jul 10 10:34:42 EDT 2009


Markus Neteler wrote:
> On Fri, Jul 10, 2009 at 3:50 PM, Martin Landa<landa.martin at gmail.com> wrote:
>   
>> 2009/7/10 Markus Neteler <neteler at osgeo.org>:
>>     
>>> Traceback (most recent call last):
>>>  File "/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/scripts/v.rast.stats",
>>> line 275, in <module>
>>>    main()
>>>  File "/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/scripts/v.rast.stats",
>>> line 164, in main
>>>    table = f[1]
>>> KeyError: 1
>>>       
>> some time ago grass.vector_db() has been changed to return dictionary
>> instead of tuple of values. Fixed in r38349.
>>     
>
> Thanks, Martin, it now works.
>
> I wonder how this script could be made faster (as often requested by users
> including me). I compared the shell script speed in 6.4 to the python script
> speed - almost identical, hence it is a design flaw. Since we are using
> Python now, is there a way to perform masked raster access in a different
> (and faster) way?
>
> Suggestions welcome,
>   
r.univar.zonal in grass-addons :-)
http://grass.osgeo.org/wiki/GRASS_AddOns#r.univar.zonal
See example in man page as alternative to v.rast.stats

Markus M



More information about the grass-dev mailing list