Project

General

Profile

« Previous | Next » 

Revision a462ee65

Added by Benoit Parmentier over 11 years ago

initial commit, script for grass set to access python in R

View differences:

climate/research/oregon/interpolation/grass-setup.R
1
######################################## Access  GRASS In Python #######################################
2

  
3
#This script configures the system shell to allow access to GRASS in python through a system call in R.
4
#AUTHOR: Jim Regetz                                                                      
5
#DATE: 05/15/2013                                                                                
6
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#491--                                  
7

  
8
#-------------------------------------------------------------
9
# set necessary environment variables
10
# see: http://grass.osgeo.org/grass64/manuals/variables.html
11

  
12
GISBASE <- "/usr/lib/grass64"
13
PATH <- Sys.getenv("PATH")
14
PATH <- paste(PATH, file.path(GISBASE, "bin"), file.path(GISBASE,
15
                                                         "scripts"), sep=":")
16
LD_LIBRARY_PATH <- Sys.getenv("LD_LIBRARY_PATH")
17
LD_LIBRARY_PATH <- paste(LD_LIBRARY_PATH, file.path(GISBASE, "/lib"),
18
                         sep=":")
19
GISRC <- file.path(path.expand("~"), ".grassrc6")
20
GIS_LOCK <- Sys.getpid()
21
PYTHONPATH <- file.path(GISBASE, "etc/python/")
22

  
23
Sys.setenv(PATH=PATH)
24
Sys.setenv(LD_LIBRARY_PATH=LD_LIBRARY_PATH)
25
Sys.setenv(GIS_LOCK=GIS_LOCK)
26
Sys.setenv(GISRC=GISRC)
27
Sys.setenv(GISBASE=GISBASE)
28
Sys.setenv(PYTHONPATH=PYTHONPATH)
29
#-------------------------------------------------------------

Also available in: Unified diff