[GRASSLIST:7566] Re: Synergy between Grass/Python/GMT
David Finlayson
david.p.finlayson at gmail.com
Sat Jul 16 01:39:02 EDT 2005
I'd be happy to share it, but frankly it's pretty crude. I'd be
embarrassed to foist this off as a good example of either Grass or
Python (though maybe it is a good example of how flexible this
combination is, even for light-weight programmers). The class simply
wraps an interface around a few standard GRASS commands and captures
the results (r.region for example). My dream is to write a real Python
interface to the Grass programming interface, but that project is on
hold until I finish my PhD.
Is there a good place on the wiki for sharing scripts? When I get this
GMT thing polished up I think it will be quite useful for folks who
use GMT.
David
On 7/15/05, Stephan Holl <holl at gdf-hannover.de> wrote:
> Hello David,
>
> On Fri, 15 Jul 2005 16:27:18 -0700 David Finlayson
> <david.p.finlayson at gmail.com> wrote:
>
> > 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.
>
> Would you like to share the python class which you wrote for
> raster-maps?
> It would be nice having the class in CVS to make it possible for others
> too?
>
> Thanks for your comment
>
> Stephan
>
> --
> ::ACHTUNG:: Neue Adresse und Telefonnummer ::ACHTUNG::
>
> GDF Hannover - Solutions for spatial data analysis and remote sensing
> Hannover Office - Mengendamm 16d - D-30177 Hannover
> Internet: www.gdf-hannover.de - Email: holl at gdf-hannover.de
> Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508
>
--
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