Difference between revisions of "A Productive Desktop Environment for Scientists and Engineers - Part II"

From assela Pathirana
Jump to navigationJump to search
Line 60: Line 60:
-----------------------------------------------------------------------
-----------------------------------------------------------------------
</nowiki></pre>
</nowiki></pre>
#Now add the required environment variables to <tt>/etc/bashrc</tt> file: <nowiki>
#Now add the required environment variables to <tt>/etc/bashrc</tt> file using [[A Productive Desktop Environment for Scientists and Engineers - Part I#Text Editor|the text editor]]: <nowiki>
  </nowiki><pre><nowiki>
  </nowiki><pre><nowiki>
cat << EOF >> /etc/bashrc # DON't FORGET >>. If you write > instead of that .. disaster!
# GMT environment settings  
# GMT environment settings  
export NETCDFHOME=/usr/local/netCDF
export NETCDFHOME=/usr/local/netCDF
Line 69: Line 68:
export MANPATH=$MANPATH:/usr/local/GMT/GMT4.1.1/man
export MANPATH=$MANPATH:/usr/local/GMT/GMT4.1.1/man
# GMT environment settings end.
# GMT environment settings end.
</nowiki></pre> It is a good idea to open the file c:\cygwin\etc\bashrc using a text editor  and check the content.
EOF
 
</nowiki></pre>  
 
 
 


----
----
[[Category:Computing]][[Category:Learn]]
[[Category:Computing]][[Category:Learn]]

Revision as of 07:09, 27 April 2006

GIS ? ... Not quite!

Recently many have fallen into the the habit of throwing around the term Geographical Information System (or much cooler GIS) as if it is something we eat for our lunch everyday! While these are extremely useful tools for many advanced applications in different fields, often one does not need a full-fledged GIS system to achieve many targets related to processing of spatial data.

Personally I found that more than 50% of the tasks I had to do with spatial datasets could be realized using tools far less complicated than a complete GIS system. There are a number of software products that can be used to draw beautiful maps and also to perform some basic spatial data analysis tasks. We shall learn to use one of them in this chapter.

Note
It is important that we have a basic knowledge on the tools like cygwin, Unix commands, shell scripting, awk, sed, etc. Therefore it is necessary to complete the previous section, before attempting this one.

GMT - The Generic Mapping Tools

GMT is an open source collection of ~60 tools for manipulating geographic and Cartesian data sets (including filtering, trend fitting, gridding, projecting, etc.) and producing Encapsulated PostScript File (EPS) illustrations ranging from simple x-y plots via contour maps to artificially illuminated surfaces and 3-D perspective views. GMT supports ~30 map projections and transformations and comes with support data such as coastlines, rivers, and political boundaries.

(The above description is from the GMT official website. There is no point of writing a mediocre version of an excellent description.)

One of the strong points of the GMT tools is that it has an excellent set of documents, which includes a tutorial, comprehensive manual pages on each command and a cook-book of real-world examples (GMT Documentation). Further, there is a very active GMT mailing list. This should be the forum to ask questions that are beyond the basic set of documents.

The biggest weak point of GMT is that each of its 60 odd commands have extensive list of arguments, that are hard to remember and even harder to use accurately. But, then this is a problem of any advanced computer tool -- there are no simple solutions for complex problems!

In this pages, we shall first explore a simple example or two using the hard way; then learn how to lessen the pain of scripting by taking some shortcuts. Finally we will go through some fairely complicated examples.

Installation

There are numerous ways of arriving at the target of a usable GMT installation. Even, GMT can work on Windows. However, my advice is to use it on a Unix environment. Since we already have a functional Cygwin environment, that's where we start.

There is a page on the GMT site, that explains in detail, the installation procedure. However, for the first time user it can be a bit complicated (particularly due to the general nature). Let's go step by step.

  1. in cygwin

mkdir /usr/local/GMT #create a directory for installation cd /usr/local/GMT

  1. Download the installation script.

wget ftp://ftp.soest.hawaii.edu/gmt/install_gmt

  1. Go to GMT install form.
    • Change only the following values:
      1. Select archive format: bzip2
      2. Select default PostScript output format for GMT: Encapsulated PostScript (EPS)
      3. Select the appropriate netCDF library option: Please get and install netCDF 3.6 (Give full pathname to the netCDF directory: /usr/local/netCDF)
      4. Select the components you want (gzip/bzip2 sizes indicated): <Click all>
      5. Select the C compiler you want to use: gcc
      6. Select supplemental packages to install: unselect MEX
    • Submit the form and save the resulting form as GMTparam.txt at c:

cygwin\usr\local\GMT using the Save As menu of the web browser.

  1. in cygwin

cd /usr/local/GMT bash install_gmt GMTparam.txt

  1. The installation will take a fair amount of time depending on your computer hardware and level of network connectivity. If everything has gone smoothly the sript will exit with a message like the following. (some lines removed.)

GMT installation complete. Remember to set these: ----------------------------------------------------------------------- .. .. For sh or bash users: export NETCDFHOME=/usr/local/netCDF export GMTHOME=/usr/local/GMT/GMT4.1.1 export PATH=/usr/local/GMT/GMT4.1.1/bin:$PATH For all users: Add /usr/local/GMT/GMT4.1.1/man to MANPATH Add /usr/local/GMT/GMT4.1.1/www/gmt/gmt_services.html as browser bookmark -----------------------------------------------------------------------

  1. Now add the required environment variables to /etc/bashrc file using the text editor:
  2. GMT environment 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

  1. GMT environment settings end.

EOF