[GRASS-user] passing raster map to Python object

Hamish hamish_b at yahoo.com
Wed Aug 12 01:00:11 EDT 2009


Milton Cezar Ribeiro wrote:
> I am building a simulation python code that read a
> raster maps on grass mapset.
> As my maps is not so large (512x512 pixels) I dump it
> on a text file
> (using r.out.ascii), after I read the text file on
> python, parse it using a function that
> I wrote, and after create a matrix-like object on Python.
>  
> I would like to know if I can read my raster map on python wihout
> save it on external text file. Case yes, a short example are welcome.


you might look at NumPy  http://numpy.scipy.org/ + NumPtr python
extension. NumPtr can be found in the swig/python/ dir in the grass
source code. (also examples/m.distance + rasteraccess.py there)

NumPy is also used by the wxGUI profile tool.


SciPy is another thing to check out.


please post back to the list with what you learn :) & if you succeed
maybe add a page to the grass wiki with steps?


Hamish



      



More information about the grass-user mailing list