Installing RHESSys and associated programs
Below are instructions for installing the GRASS 6.4 binary, RHESSys, and R on Mac OS X. (There may be differences on Linux or a virtual machine, but hopefully the procedures will be the same/similar, or users of these other platforms can find the installation information to aid them. At this time we don not provide support for PC users, not all RHESSys/GRASS interface programs are PC compatible). In order to install certain RHESSys programs (g2w and CF), GRASS libraries and header files must first be installed, therefore, you must first install GRASS.
Contents
Installing GRASS GIS
Frameworks of various Unix image format and GIS libraries are the base requirements for GRASS on Mac OS X. GRASS requires that the frameworks packages be installed prior to installation of GRASS.
You can download the frameworks packages for Mac OS X at: http://www.kyngchaos.com/software/frameworks
After installing the frameworks packages, install the GRASS 6.4 binary. You can download GRASS 6.4 for Mac OS X at: http://www.kyngchaos.com/software/grass
You can download GRASS for other platforms at: http://grass.fbk.eu/download/software.php (unknown if these downloads include the frameworks packages.) You may want to look here for additional assistance: http://grass.fbk.eu/grass64/source/REQUIREMENTS.html
Locating GRASS GISBASE
OS X
Some RHESSys programs will look for certain GRASS libraries and headers. You must set some environmental variables by pointing the GISBASE to where the libraries and headers are installed. On Mac OS X this should be /Applications/GRASS-6.4.app/Contents/MacOS (assuming you downloaded version 6.4; if you download a different version, then edit the command for the version you installed).
If you are running GRASS from the application folder, your GISBASE will be /Applications/<GRASS application name>/Contents/MacOS. For example, if your GRASS application is named GRASS-6.4, you would type the command (Open a terminal window, and at the terminal window command prompt, type) :
$> export GISBASE=/Applications/GRASS-6.4.app/Contents/MacOS
If you are working on a platform other than Mac OS X, then point the GISBASE to wherever the GRASS libraries and headers are located.
Building RHESSys
The RHESSys source tree contains three separate tools: RHESSys, CF (create flowpaths), and g2w (GrassToWorld). Note that default values
are specified in the makefiles. This means if you choose to override them you must specify the
-e
option when running make
.
As a convenience there is a makefile at the trunk of the source tree that will build and install all RHESSys programs in a global install (this will require root access to the machine - see further down for instructions on how to install locally). Before running that file, make sure that you have set all necessary environment variables as listed below.
rhessys
Dependencies
- None
Build Instructions
from the RHESSys/trunk directory containing the makefile
$> make; make install
Environmental Variables
Name | Description | Default |
RHESSYS_BIN | The path of the RHESSys installation location | /usr/local/bin |
PGM | Name of the RHESSys binary prodouced | rhessys<version> |
CC | C Compiler to use | gcc |
cf
Dependencies
- GRASS version 6.x
Build Instructions
$> make; make install
Environmental Variables
Name | Description | Default |
RHESSYS_BIN | The path of the RHESSys installation location | /usr/local/bin |
PGM | Name of the create flowpaths executable | cf |
GISBASE | Base GRASS install | none, this variable must be set |
CC | C Compiler to use | gcc |
g2w
Dependencies
- GRASS version 6.x
Build Instructions
$> make; make install
Environmental Variables
Name | Description | Default |
RHESSYS_BIN | The path of the RHESSys installation location | /usr/local/bin |
PGM | Name of the grass2world executable | g2w |
GISBASE | Base GRASS install | none, this variable must be set |
CC | C Compiler to use | gcc |
Local Installation of RHESSys
These are instructions for installing RHESSys programs locally on a machine. If you wish to install globally (i.e. executables residing in /usr/local/bin directory), you will need to do so as root. Open a terminal window and navigate to the directory where you will store the RHESSys files (i.e. you may want to make a RHESSys directory on the hard drive). For example, create a RHESSys directory on the hard drive, create a subdirectory within the RHESSys directory called bin.
1. Download the RHESSys files from the Sourceforge website. Do this in a terminal window (and within the directory you want to store the files, i.e. the newly created RHESSys directory on the hard drive) by typing the following at the terminal window command prompt: > svn co https://rhessys.svn.sourceforge.net/svnroot/rhessys/trunk/
This will download a directory called ‘trunk’ that contains the latest version of RHESSys (rhessys5.X.X), the files for Grass2World (g2w), Create Flowpaths (CF), Lairead, and a directory called util. It is worth noting the number of the revision checked out. You may want to use this as a label to distinguish from future revisions.
2. Go into each of the trunk directories to compile the programs individually. (If you are choosing to attempt a global installation, you may be able to use the makefile within the main trunk directory). Move into (change directories - cd), each directory, and type make at the terminal window command prompt:
> cd trunk/rhessys
> make
This will create an executable called rhessys5.15.rXXX
Go into each of the following directories and type make at the terminal window command prompt:
trunk/g2w/grass2world (creates the executable g2w)
trunk/g2w/AverageTables_Unix (creates the executable rat)
trunk/cf (creates the executable cf9.1)
trunk/lairead (creates the executable lairead)
3. For organizational purposes, I suggest that you create a new directory to store the executables. I suggest creating a new directory called bin within the RHESSys directory, i.e. /RHESSys/bin. Move all of the executables from the trunk directories into this new ‘bin’ directory (rhessys5.X.X, g2w, rat, cf9.1, lairead). However you choose to organize the files, make sure that the executables g2w and rat are in the same directory, side by side.
4. As this is a ‘local’ install, each user needs to set some environmental variables that are read and executed when the bash shell (terminal window) is invoked. This is a text file (.bash_profile) that will include instructions on where the system can find these new executables when you call them. Create a .bash_profile (that is dot bash_profile) text file in your user home directory (i.e. /users/your_user_name). In this file, include a pointer to the directory containing the executables by including the full path to the directory. For example, if you have organized per my suggestion and put the executables in a directory /RHESSys/bin, then include in the .bash_profile:
export PATH=.:$RHESSYSENV/bin:$PATH:/RHESSys/bin
export RHESSYS_BIN=/RHESSys/bin
once you have created/edited the .bash_profile text file, execute it with the source command:
> source .bash_profile
(To test, at the terminal window command prompt, type the RHESSys executable name (i.e. rhessys5.15.r325). If you get the following error: FATAL ERROR: Cannot open world file then the program is successfully being called by the commands included in the .bash_profile text file, but errors as no input information has been provided.)
R Statistical Program
R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and Mac OS X. You can download R at http://www.r-project.org/
Choose the preferred CRAN mirror, download and install. You will need to add a particular R package that handles dates and times. To add this package, start R, under the menu item Packages & Data - open package installer, click get list - select a CRAN mirror, search for chron, when it comes up in the list, highlight chron and click install selected. To load the library into the current R workspace, at the R window prompt, type: > library(chron)
It is useful to create an initialization file that will automatically load any frequently used R packages each time you start a new R session (RHESSys R package coming soon!). Create a .Rprofile (that is dot Rprofile) text file in your user home directory (i.e. /users/your_user_name), and include the command to load a package:
load(chron)
Each time you start R, it will then automatically load the chron package. Later, once the RHESSys package is ready, you can include the command to automatically load it as well.