emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [babel] Suggestions: GRASS GIS und Lilypond


From: Rainer M Krug
Subject: Re: [Orgmode] [babel] Suggestions: GRASS GIS und Lilypond
Date: Wed, 16 Feb 2011 10:14:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15pre) Gecko/20110207 Lightning/1.0b2 Shredder/3.1.9pre

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/15/2011 07:46 PM, Eric Schulte wrote:
> I am happy to answer questions and provide suggestions for anyone who is
> interested in developing support for these (or any other) additional
> languages.  I would recommend looking at existing languages which are
> similar to the new language for guidance/examples.
> 
> In the case of GRASS, it sounds as though GRASS is a sub[super]-set of
> R?  

No - GRASS can be described as a collection of commands which are
executed in the shell after some environmental variables are set. So
GRASS is rather a super set of a bash shell.
So an implementation of GRASS could easily build on how sh code blocks
are hab=ndled in org.

Interactive GRASS sessions are effectively sh sessions with adapted
$PATH variable and a few environmental variables, to make the GRASS
commands accessible. So really the easiest would be to use the existing
sh support, set the environmental variables, set the $PATH and execute
the commands.
The environmental variables could be defined in :var - so actually that
should not be a problem.

Syntax highlighting could be based on sh with added commands in the
added $PATH - should not be to difficult (theoretically...).

> Would it be possible to simply use the existing R support in babel
> only specify a non-R command to be run to start interactive sessions?

Well - R, like python which is becoming the "official" scripting
language for GRASS, has a set of commands to interface with GRASS - so
using R (or python) would not be a useful approach.

There is an R package (spGRASS6) which is doing exactly what I mentioned
above (setting the $PATH and the environmental variables) to be able to
execute grass commands from within R - (with the syntax

execGRASS( "COMMAND", ... )

So one could look at that command (initGRASS() I think it is called) to
see what is necessary - or just execute grass:

grass -text GISBASE/LOCATION_NAME/MAPSET

##########################################
address@hidden:~/deb$ grass --help
Usage:
  grass64 [-h | -help | --help] [-v | --version] [-c]
          [-text | -gui | -tcltk | -oldtcltk | -wxpython | -wx]
          [[[<GISDBASE>/]<LOCATION_NAME>/]<MAPSET>]

Flags:
  -h or -help or --help          print this help message
  -v or --version                show version information and exit
  -c                             create given mapset if it doesn't exist
  -text                          use text based interface
                                   and set as default
  -gui                           use graphical user interface (wxpython
by default)
                                   and set as default
  -tcltk                         use Tcl/Tk based graphical user interface
                                   and set as default
  -oldtcltk                      use old Tcl/Tk based graphical user
interface
                                   and set as default
  -wxpython or -wx               use wxPython based graphical user interface
                                   and set as default

Parameters:
  GISDBASE                       initial database (path to GIS data)
  LOCATION_NAME                  initial location
  MAPSET                         initial mapset

  GISDBASE/LOCATION_NAME/MAPSET  fully qualified initial mapset directory

Environment variables relevant for startup:
  GRASS_GUI                      select GUI (text, gui, tcltk, oldtcltk,
wxpython)
  GRASS_TCLSH                    set tclsh shell name to override 'tclsh'
  GRASS_WISH                     set wish shell name to override 'wish'
  GRASS_HTML_BROWSER             set html web browser for help pages
  GRASS_ADDON_PATH               set additional path(s) to local GRASS
modules
  GRASS_BATCH_JOB                shell script to be processed as batch job
  GRASS_PYTHON                   set python shell name to override 'python'
address@hidden:~/deb$
##########################################


So it should be doable relatively easily I guess.

So the environmental variables needed would be:

 GISDBASE                    initial database (path to GIS data)
 LOCATION_NAME               initial location
 MAPSET                      initial mapset

So that GRASS can build

 GISDBASE/LOCATION_NAME/MAPSET  fully qualified initial mapset directory

Thinking of it, a GRASS code block

#+begin_src grass
 ...
#+end_src

would be a sh code block, in which as the first command "grass -text" is
executed, i.e.

#+begin_src grass
  grass -text
  ...
#+end_src

For tangling: GRASS scripts are executed usually from within GRASS, so
they are normal sh scripts (same shebang and all)

So implementation should be rather straight forward, I think?

Just a side note: as GRASS installs in addition to the command grass
also a command "grass64" for version 6.4 etc, it would be nice to have
the command "grass" modifiable.


Cheers,

Rainer

> 
> Best -- Eric
> 
> Thorsten  <address@hidden> writes:
> 
>> Hello Babel developers, 
>> just two suggestions for new languages: 
>> 1. GRASS GIS
>> As far as I know there is no grass-mode in emacs, but some expert people are
>> successful running grass processes together with R processes in ESS.
>> Since GRASS and R are natural allies, it would be great to use the GRASS
>> engine in an org-file to retrieve spatial data and then analyse the data
>> with R in the same file - would make Org a kind of emacs-grassmode
>> replacement.  
>> 2. Lilypond
>> A nice to have for all the music lovers in the org community. 
>> Regards
>> Thorsten
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      address@hidden

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1blY4ACgkQoYgNqgF2egouBgCfdJliPegFD+52k6+CF6Zw25bM
hfEAoIo7M1r1TkQbJ1CoeD+kW1jxfQW6
=ezOa
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]