[GRASS-user] Retrieve list of values in Python

Greetings

I would like to know how can I retrieve the list of available values in a Raster map in a Python Script?
Thanks
Best regards,
Jenny Turner

In order to get a list, here is just one approach:
vals = os.popen(“r.stats –Nn your_map”).readlines()

Christian.

From: Jenny Turner
Sent: Tuesday, March 29, 2011 11:55 PM
To: GRASS user list
Subject: [GRASS-user] Retrieve list of values in Python

Greetings

I would like to know how can I retrieve the list of available values in a Raster map in a Python Script?
Thanks
Best regards,
Jenny Turner



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

Hi,

2011/3/30 Christian Schwartze <christian.schwartze@uni-jena.de>:

In order to get a list, here is just one approach:
vals = os.popen(“r.stats –Nn your_map”).readlines()

use GRASS Scripting Library [1]

grass.read_command('r.stats', flags='Nn',input = 'map').splitlines()

Martin

[1] http://grass.osgeo.org/programming7/pythonlib.html

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