[GRASS-user] v.rast.stats (r.category) fail?

Hi all,
I’m experiencing some problems with v.rast.stats and (I suppose) v.category.
I have a lines vector file and I want to obtain some statistics on each feature.
I try to use the module but it soon exits with the message:

v.rast.stats vector=ord1_pl_3d_cat raster=dem colprefix=stats percentile=90 --verbose -c
ERROR: No categories found in raster map

evenif I have some feature (with categories and “cat” column too on associated dbf) in my file.

Then I tried r.category by itself and I discovered that sometimes it works but sometimes not.
Align region on input raster map doesn’t affect the result.

Any hint?

Best regards, Annalisa

Hi Annalisa,

On Fri, Dec 9, 2011 at 6:22 PM, Annalisa Minelli <annagrass6@gmail.com> wrote:

Hi all,
I'm experiencing some problems with v.rast.stats and (I suppose) v.category.
I have a lines vector file and I want to obtain some statistics on each
feature.
I try to use the module but it soon exits with the message:

v.rast.stats vector=ord1_pl_3d_cat raster=dem colprefix=stats percentile=90
--verbose -c
ERROR: No categories found in raster map

evenif I have some feature (with categories and "cat" column too on
associated dbf) in my file.

could you please tell us
- which operating system
- which GRASS version

Then I tried r.category by itself and I discovered that sometimes it works
but sometimes not.
Align region on input raster map doesn't affect the result.

Any hint?

If possible, please send a North Carolina data set example for easy
replication.

cheers
Markus

Hi Markus,
I’m usgin GRASS65 (compiled from source) on an Ubuntu 11.10machine, but I tried with GRASS64 (compiled too) and the result is the same.

I made an attempt with the NC spm dataset: I took the elevation@PERMANENT map and the streams@PERMANENT (vector), I copied the streams in user1 mapset, set DEBUG at “2” and obtained:

GRASS 6.5.svn (nc_spm_08):~ > v.rast.stats vector=streams@user1 layer=1 raster=elevation@PERMANENT colprefix=stats percentile=90 --verbose
D2/2: filename = /usr/local/grass-6.5.svn/scripts/v.rast.stats
D2/2: set GIS_FLAG_C=0
D2/2: set GIS_FLAG_E=0
D2/2: set GIS_OPT_VECTOR=streams@user1
D2/2: set GIS_OPT_LAYER=1
D2/2: set GIS_OPT_RASTER=elevation@PERMANENT
D2/2: set GIS_OPT_COLPREFIX=stats
D2/2: set GIS_OPT_PERCENTILE=90
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D1/2: Vect_open_old(): name = streams@user1 mapset= user1 update = 0
D1/2: Vect_set_thresh(): thresh = 0.000000
D1/2: dig_spidx_init()
D1/2: open format file: ‘user1/vector/streams/frmt’
D1/2: Vector format: 0 (native)
D1/2: Vect_set_thresh(): thresh = 0.000000
D1/2: Vect__read_head(): vector = streams@user1
D1/2: Vect_set_thresh(): thresh = 0.000000
D1/2: Level request = 2
D1/2: Vect_open_topo(): name = streams mapset= user1
D1/2: get coor info: /home/annalisa/DATAGRASS/nc_spm_08/user1/vector/streams/coor
D1/2: Info->size = 2747992, Info->mtime = 1323518807
D2/2: Topo header: file version 5.0 , supported from GRASS version 5.0
D2/2: byte order 0
D2/2: header size 142
D2/2: with_z 0
D2/2: coor size 2747992
D1/2: Topo head: coor size = 2747992, coor mtime = 140732276991781
D1/2: dig_load_plus()
D1/2: dig_spidx_init()
D2/2: Topo header: file version 5.0 , supported from GRASS version 5.0
D2/2: byte order 0
D2/2: header size 142
D2/2: with_z 0
D2/2: coor size 2747992
D2/2: Vect_cidx_open(): name = streams mapset= user1
D1/2: V1_open_old_nat(): name = streams mapset = user1
D2/2: Coor header: file version 5.1 , supported from GRASS version 5.1
D2/2: byte order 0
D2/2: header size 14
D2/2: with_z 0
D2/2: coor size 2747992
D1/2: get coor info: /home/annalisa/DATAGRASS/nc_spm_08/user1/vector/streams/coor
D1/2: Info->size = 2747992, Info->mtime = 1323518807
D1/2: coor size in head = 2747992, real coor file size= 2747992
D2/2: dig_file_load ()
D2/2: requested mode = 2
D2/2: size = 2747992
D2/2: file was not loaded to the memory
D1/2: Vect_open_old(): vector opened on level 2
D1/2: Vect_read_dblinks(): map = streams, mapset = user1
D1/2: dbln file: /home/annalisa/DATAGRASS/nc_spm_08/user1/vector/streams/dbln
D1/2: dbln: 1 streams cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/2: field = 1 name = (null), table = streams, key = cat, database = $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/, driver = dbf
D1/2: Dblinks read
D1/2: Vect_Rewind(): name = streams
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D1/2: 0 areas sorted
D1/2: Vect_close(): name = streams, mapset = user1, format = 0, level = 2
D1/2: close history file
D1/2: V1_close_nat(): name = streams mapset= user1
D1/2: close streams_3353.0 compressed
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
ERROR: No categories found in raster map
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array
D2/2: G__read_Cell_head
D2/2: G__read_Cell_head_array

(sorry for long email)

hope it helpes…

Thanks, Annalisa

2011/12/9 Markus Neteler <neteler@osgeo.org>

Hi Annalisa,

On Fri, Dec 9, 2011 at 6:22 PM, Annalisa Minelli <annagrass6@gmail.com> wrote:

Hi all,
I’m experiencing some problems with v.rast.stats and (I suppose) v.category.
I have a lines vector file and I want to obtain some statistics on each
feature.
I try to use the module but it soon exits with the message:

v.rast.stats vector=ord1_pl_3d_cat raster=dem colprefix=stats percentile=90
–verbose -c
ERROR: No categories found in raster map

evenif I have some feature (with categories and “cat” column too on
associated dbf) in my file.

could you please tell us

  • which operating system
  • which GRASS version

Then I tried r.category by itself and I discovered that sometimes it works
but sometimes not.
Align region on input raster map doesn’t affect the result.

Any hint?

If possible, please send a North Carolina data set example for easy
replication.

cheers
Markus