[GRASS-user] Python script

Glynn Clements glynn at gclements.plus.com
Tue Jul 2 19:15:31 PDT 2013

Pedro Camargo wrote:

> 	I'm trying to use r.stats via the python shell inside GRASS but I'm
> getting an error that I do not know how to solve.  The code I'm using is
> this:
> grass.run_command('r.stats',input=inp,output='D:\\CropScape\\2012_cdls\\AZ.c
> sv',flags = 'ani')
> I already tried the following variables for input:
> inp=['AZ','COUNTIES']

Either of these should work, provided that you actually have maps with
those names in the PERMANENT mapset.

> inp=['D:\\CropScape\\2012_cdls\\AZ.tif',
> 'D:\\CropScape\\Counties\\COUNTIES.tif']

The inputs must be map names, not filenames.

Have you actually created the maps? You cannot use an image file as a
map without first either importing it (with e.g. r.in.gdal) or linking
it (with r.external).

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list