[GRASSLIST:7564] Synergy between Grass/Python/GMT

David Finlayson david.p.finlayson at gmail.com
Fri Jul 15 19:27:18 EDT 2005


I've been working on a script to convert GRASS rasters directly into
GMT plots in a single command. So far it converts the raster to GMT
format, copies over the colormap and builds a simple graticule and
scale bar. Works well.

In the process of building this script, however, I discovered there is
some great synergy possible between IPython (the interactive python
shell) and GRASS. Here is how it works:

1) Launch ipython from within your grass shell
2) import a simple class designed to work with rasters
3) BINGO! you've got full control of command line grass + full
interactive Python abilities.

The class I wrote for grass rasters contains a bunch of instance
variables that hold basic info about the raster (resolution, bounding
box, etc.) and some methods to ease interaction with Python, like a
get_value(X, Y) method.

There are some really powerful things you can do with this that cannot
be done with any other GIS. Very cool!

David

-- 
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA  98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays




More information about the grass-user mailing list