Hi,
running v.rast.stats in GRASS 7 leads to a Python error:
GRASS 7.0.svn (spearfish60):~ > g.copy vect=fields,myfields --o
Copy vector <fields@PERMANENT> to current mapset as <myfields>
WARNING: Vector map <myfields> already exists and will be overwritten
GRASS 7.0.svn (spearfish60):~ > v.rast.stats myfields
raster=elevation.dem colprefix=dem
WARNING: Area without centroid (may be OK for island)
WARNING: Area without centroid (may be OK for island)
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
Not sure how to fix it,
Markus
Hi,
2009/7/10 Markus Neteler <neteler@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.
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
On Fri, Jul 10, 2009 at 3:50 PM, Martin Landa<landa.martin@gmail.com> wrote:
2009/7/10 Markus Neteler <neteler@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,
Markus
Markus Neteler wrote:
On Fri, Jul 10, 2009 at 3:50 PM, Martin Landa<landa.martin@gmail.com> wrote:
2009/7/10 Markus Neteler <neteler@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