[GRASS-user] python commands on grass.

Dear all,

is there a way of I know the commands available on python grass library?

Checking the codes available at https://svn.osgeo.org/grass/grass/trunk/script
(thanks Martin) I saw the following commands:

grass.read_command
grass.parse_key_val
grass.run_command
grass.message
grass.fatal

By the way, how can I know the methods / parameters for each command?

Meanwhile, I can run g.list with the command bellow, but I can’t
deal with the name of each of my raster map. In fact I receive the
same output as in gis.m console, but I would like only receive a list of
maps as output.

rasterfiles = grass.read_command(‘g.list’,type=‘rast’)
Cheers

milton

Hi,

2009/5/5 Milton Cezar Ribeiro <miltinho.astronauta@gmail.com>:

is there a way of I know the commands available on python grass library?

grass.py is located in

lib/python

e.g.

https://svn.osgeo.org/grass/grass/trunk/lib/python/

It's best documentation :slight_smile:

Meanwhile, I can run g.list with the command bellow, but I can't
deal with the name of each of my raster map. In fact I receive the
same output as in gis.m console, but I would like only receive a list of
maps as output.

rasterfiles = grass.read_command('g.list',type='rast')

use

grass.mlist_grouped(type = 'rast')

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Try using help() from within the python shell.

python
import grass
help(grass)

-Jamie

On Tue, May 5, 2009 at 11:52 AM, Milton Cezar Ribeiro <miltinho.astronauta@gmail.com> wrote:

Dear all,

is there a way of I know the commands available on python grass library?

Checking the codes available at https://svn.osgeo.org/grass/grass/trunk/script
(thanks Martin) I saw the following commands:

grass.read_command
grass.parse_key_val
grass.run_command
grass.message
grass.fatal

By the way, how can I know the methods / parameters for each command?

Meanwhile, I can run g.list with the command bellow, but I can’t
deal with the name of each of my raster map. In fact I receive the
same output as in gis.m console, but I would like only receive a list of
maps as output.

rasterfiles = grass.read_command(‘g.list’,type=‘rast’)
Cheers

milton


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Tue, May 5, 2009 at 8:57 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2009/5/5 Milton Cezar Ribeiro <miltinho.astronauta@gmail.com>:

is there a way of I know the commands available on python grass library?

grass.py is located in

lib/python

e.g.

https://svn.osgeo.org/grass/grass/trunk/lib/python/

It's best documentation :slight_smile:

and now there is even more (I have doxygenized the docs):

http://download.osgeo.org/grass/grass6_progman/
-> Further libraries
   -> python: GRASS 6 Python library

Improvements to the page are welcome, the file to edit is here:
http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/lib/python/grasspythonlib.dox

cheers
Markus