[GRASS-user] Output parsing in python

Markus Neteler neteler at osgeo.org
Thu Apr 8 16:39:41 EDT 2010


On Wed, Apr 7, 2010 at 2:16 PM, thedok78 <thedoktor78 at gmail.com> wrote:
>
> Hello everybody,
> I am porting a bash script to python and for it I need to know the number of
> cells of a certain category. Right now I use this syntax:
> grass.parse_command('r.stats',flags='c',input='map'), but the output is
> something like this: {'112 525': None.. }.
> Is there a way to have {'112':525..} so that I can easy get the number of
> cells ?

I have added Glynn's answer and some more stuff from the list to

http://grass.osgeo.org/wiki/GRASS_and_Python

Don't hesitate to expand the page.

Markus


More information about the grass-user mailing list