[GRASSLIST:7577] Re: Synergy between Grass/Python/GMT

Dylan Beaudette dylan at iici.no-ip.org
Sun Jul 17 20:04:55 EDT 2005


David,

As I alluded to last message, here is the link to the BASH GRASS--GMT 
framework that I have put together to help with my map making:

http://169.237.35.250/~dylan/grass_user_group/

with a sample map :

http://169.237.35.250/~dylan/grass_user_group/map1.html

...however I am looking forward to checking out your python code... 
BASH is a little crufty..

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



On Jul 17, 2005, at 2:17 PM, David Finlayson wrote:

> I have posted my GRASS -> GMT script on my web site (r.out.gmt.py):
>
> http://students.washington.edu/dfinlays/scripts/
>
> If anyone finds this useful, please send me suggestions. I will keep
> working on it until it isn't such a hack.
>
> Currently, it converts a raster, its colormap and optionally an
> intensity raster (such as shaded relief) to GMT format. It then builds
> a skeleton GMT plotting file that includes the raster (optionally
> shaded with the intensity grid), a graticule and map decorations with
> all of the tedious scale calculations already performed.
>
> You need to edit the results to get it to look right, but the time
> savings (for me) is probably close to an hour a plot over doing the
> same steps manually.
>
> David
>
>
>
>
> On 7/16/05, Dylan Beaudette <dylan at iici.no-ip.org> wrote:
>> David,
>>
>> I am extremely interested in any possible ways to streamline the
>> GRASS-GMT workflow.
>>
>> I have started documenting a BASH shell version of the process, but a
>> python interface might be able to provide a tremendous amount of
>> flexibility compared to BASH.
>>
>> The website where this is documented is currently down (power outage
>> while I was out in the field...), but I will try and have it back up 
>> in
>> a couple hours. Please let me know about any future plans with this--
>>
>> Cheers,
>>
>> --
>> Dylan Beaudette
>> Soils and Biogeochemistry Graduate Group
>> University of California at Davis
>> 530.754.7341
>>
>>
>>
>> On Jul 15, 2005, at 10:39 PM, David Finlayson wrote:
>>
>>> 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
>>>
>>>
>>>
>>
>>
>
>
> -- 
> 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