Difference between revisions of "Install GMT"

From assela Pathirana
Jump to navigationJump to search
m (Text replace - '<pre>' to ' <pre>')
 
(8 intermediate revisions by the same user not shown)
Line 4: Line 4:
While it is perfectly possible to run Cygwin using the dos shell, it is much less painfull to first install [[Cygwin]] -- a free, open-source, UNIX-like shell environment for Windows and then use that environment to get going as if you are on a UNIX computer.  
While it is perfectly possible to run Cygwin using the dos shell, it is much less painfull to first install [[Cygwin]] -- a free, open-source, UNIX-like shell environment for Windows and then use that environment to get going as if you are on a UNIX computer.  


Assuming that you either are on a UNIX computer or have [[Cygwin]] installed on Windows with all the basic stuff like compilers ([[mediawiki:gcc|gcc]], [[mediawiki:g77|g77]]), utilities ([[mediawiki:awk|awk]], [[mediawiki:sed|sed]]), etc., do the following to install GMT.  
Assuming that you either are on a UNIX computer or have [[Cygwin]] installed on Windows with all the basic stuff like compilers ([[wikipedia:gcc|gcc]], [[wikipedia:g77|g77]]), utilities ([[wikipedia:awk|awk]], [[wikipedia:sed|sed]]), etc., do the following to install GMT.  
==Installation==
==Installation==
* Check whether you can acces ftp sites. If you are behind a firwall, there may be problems. Then the following method will NOT work.  
* Check whether you can acces ftp sites. If you are behind a firwall, there may be problems. Then the following method will NOT work.  
Line 23: Line 23:
* Submit the form and save the result as gmt_install.txt
* Submit the form and save the result as gmt_install.txt
* Go to the place where you have install_gmt script and the above file. Do the following<nowiki>
* Go to the place where you have install_gmt script and the above file. Do the following<nowiki>
</nowiki><pre><nowiki>sh install_gmt gmt_install</nowiki></pre>
</nowiki>
* If everything is successful, the script will suggest some environment settings just before exiting. I use bash shell (as opposed to csh shell). It is also the default shell in Cygwin or Linux.  In case of bash, set them in eigher .bashrc file in your home directory (affects only you) or at /etc/bashrc file (better). My settings are like this: <nowiki>
<pre><nowiki>sh install_gmt gmt_install</nowiki></pre>
</nowiki><pre><nowiki>
* If everything is successful, the script will suggest some environment settings just before exiting. I use [[wikipedia:bash|bash]] [[wikipedia:bash|shell]] (as opposed to csh shell). It is also the default shell in Cygwin or Linux.  In case of [[mediawiki:bash|bash]] , set them in eigher .bashrc file in your home directory (affects only you) or at /etc/bashrc file (better). My settings are like this: <nowiki>
</nowiki>
<pre><nowiki>
#GMT settings  
#GMT settings  
export NETCDFHOME=/usr/local/NetCDF
export NETCDFHOME=/usr/local/NetCDF
Line 33: Line 35:
#GMT settings end
#GMT settings end
</nowiki></pre>
</nowiki></pre>
:*csh settings are different.
:*For [[wikipedia:csh|csh]] settings are different.
 
==Testing==
Remember to exit the shell and open a new one (for the settings above to take effect). Then the command
 
<pre>
printenv |grep GMT
</pre>
should output lines containing
 
<pre>
MANPATH= ...
GMTHOME= ...
PATH= ...
</pre> (dots ... were added by me!)
 
Then run an extremely simple GMT operation as follows:
 
<pre>
minmax << EOF
> 5 10 15
> -1 -25 35
> 100 0 1
> EOF
</pre>
This should produce the following output.
 
<pre>
<stdin>: N = 3  <-1/100>        <-25/10>        <1/35>
</pre>
 
Then you may like to attempt some [[GMT Scatterplot|simple plotting script]].
 
[[Category:GMT]]

Latest revision as of 19:11, 2 October 2009

Preamble

GMT installation is explained in detail in the GMT Homepge. I recommend the following to windows users.

While it is perfectly possible to run Cygwin using the dos shell, it is much less painfull to first install Cygwin -- a free, open-source, UNIX-like shell environment for Windows and then use that environment to get going as if you are on a UNIX computer.

Assuming that you either are on a UNIX computer or have Cygwin installed on Windows with all the basic stuff like compilers (gcc, g77), utilities (awk, sed), etc., do the following to install GMT.

Installation

  • Check whether you can acces ftp sites. If you are behind a firwall, there may be problems. Then the following method will NOT work.
  • Access the install form on GMT homepage. (Last time I checked, it was here.
  • There is a link on the form to download the script called install_gmt. Download and save it now.
  • Fill in the form. Keep the following in mind.
    NetCDF Setup
    • Select "Please get and install netCDF ..." option
    • Give /usr/local/netCDF/ as the path
    High and Full resolutions coastline data
    • Click to get them unless your network is very very slow (Default is not to get).
    Select the C compiler you want to use
    • gcc
    Select default GMTHOME directory
    • /usr/local/GMT
    Select supplemental packages to install
    Unclick this unless you have Matlab: *MEX: Matlab interface for reading/writing GMT grdfiles
  • Submit the form and save the result as gmt_install.txt
  • Go to the place where you have install_gmt script and the above file. Do the following
sh install_gmt gmt_install
  • If everything is successful, the script will suggest some environment settings just before exiting. I use bash shell (as opposed to csh shell). It is also the default shell in Cygwin or Linux. In case of bash , set them in eigher .bashrc file in your home directory (affects only you) or at /etc/bashrc file (better). My settings are like this:
#GMT settings 
export NETCDFHOME=/usr/local/NetCDF
export GMTHOME=/usr/local/GMT/GMT4.1.1
export PATH=/usr/local/GMT/GMT4.1.1/bin:$PATH
export MANPATH=$MANPATH:/usr/local/GMT/GMT4.1.1/man to MANPATH
#GMT settings end
  • For csh settings are different.

Testing

Remember to exit the shell and open a new one (for the settings above to take effect). Then the command

printenv |grep GMT

should output lines containing

MANPATH= ...
GMTHOME= ...
PATH= ...

(dots ... were added by me!)

Then run an extremely simple GMT operation as follows:

minmax << EOF
> 5 10 15
> -1 -25 35
> 100 0 1
> EOF

This should produce the following output.

 
<stdin>: N = 3  <-1/100>        <-25/10>        <1/35>

Then you may like to attempt some simple plotting script.