INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.
30
Computer Programs in Seismology
Version 3.30
Installation Guide
R. B. Herrmann
28 November 2004
Updated 22 April 2013
(typos June 5, 2020)
1/30
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Installation of Computer Programs in
Seismology Version 3.30
R. B. Herrmann, rbh@eas.slu.edu
Table of Contents
1 Introduction.................................................................................3
1.1 CDROM distribution..........................................................3
1.2 FTP install 3
2 Installation on UNIX/Linux/MacOS–X..........................................4
2.1 Compilers 4
2.2 Getting the Programs........................................................5
2.3 Installation of the Programs..............................................5
2.4 Compiling 6
2.5 Changing PATH 8
2.6 Documentation 9
2.7 Updates 9
3 Installation on Windows using Cygwin.......................................10
3.1 Getting Cygwin 10
3.2 Cygwin installation 11
3.3 Modify the Cygwin environment......................................19
3.4 CYGWIN and VISTA and XP..........................................20
3.5 Modify some Cygwin files...............................................21
3.6 Cygwin Help 25
3.7 Cygwin X11 Help 25
3.8 Installation of Computer Programs in Seismology..........27
3.9 Documentation 27
3.10 Updates 28
3.11 Tutorials 28
3.12 SHELL scripts 28
3.13 Printing and Graphics for Documents and the Web......28
3.14 Cleanup 30
3.15 Cygwin and LINUX.......................................................30
2/30
1 Introduction
This document describes the installation of Version 3.30 of the Computer Programs in
Seismology package created by R. B. Herrmann of Saint Louis University. This
installation has been tested for the Solaris operating system running on a Sun Sparc, on
Linux and Windows on PC platforms and on Apple’s MacOS–X system.
There are two ways of distributing this software – a special CDROM or Internet
download using ftp.
1.1 CDROM distribution
The CDROM contains the source code documentation for the software and the
complete CYGWIN package for use with Windows. The installation of the software under
UNIX/LINUX and MacOS-X is described in Section 2 of this document. The installation
of CYGWIN and the compilation of Computer Programs in Seismology for Windows is
discussed in detail in Section 3
1.2 FTP install
The distribution is available for download after completing a registration form
http://www.eas.slu.edu/People/RBHerrmann/ComputerPrograms.html
This will lead you to the ftp area for download. You will be able to get the following
CPSInstall.pdf - PDF form of this document
NP330.DATE.tgz - Computer Programs in Seismology distribution
[The DATE indicates when the package was updated. At
present the file is NP330.Feb-23-2009.tgz]
Send email to me at rbh@eas.slu.edu if you to try the binary distribution.
2 Installation on UNIX/Linux/MacOS–X
2.1 Compilers
Solaris
Either the Sun cc/f77 suite is required or the freely available gcc/g77 compilers.
Precompiled gcc/g77 binary executables of these compilers are available for free at the
site:
http://sunfreeware.com
Just select the version corresponding to your operating system and architecture. There
are also other interesting software packages there too.
Linux
You will need the gcc/g77 compilers and the X11 programming support files and the
termcap libraries.
MacOS–X
You will require the gcc/g77 compilers. You will have to search the web for them. You
may have to do a Web search for the pattern ‘g77 Mac OSX’. One such link is
http://hpc.sourceforge.net
for high performance computing using Mac OS–X on the Power PC platform. Go to
http://hpc.sourceforge.net
for the Intel platform.
NOTE: You must ensure that the C and FORTRAN compilers are compatible: Create a
simple C program –
t.c
#include <stdio.h>
main()
{
printf(“hello world\n”);
}
gcc t.c –o tc
t.f:
write(6,*)’Hello world’
end
g77 t.f –o tf
4/30
Then execute the command
file tc
file tf
If the compilers are compatible the details of the file command will say that they are both
for a PowerPC or an Intel platform. To know what you machine is, enter the command
uname –a
You must also have the X11 support files, e.g., the entries in /usr/X11r6/include and the
termcap/terminfo libraries.
2.2 Getting the Programs
FTP
The most recent version of the Computer Programs in Seismology package will always
be available for ftp download from the site:
ftp://ftp.eas.slu.edu/pub/rbh/PROGRAMS.330
In this directory you will find files ending in “.tgz” which are compressed “tar” files in
“gzip” format. The gzip’d files are smaller. Also download the CPSInstall.pdf (this
document).
CDROM
This is the distribution on this CDROM. The are stored in the directory/folder “/usr” in
the file “NP330.DATE.tgz”
2.3 Installation of the Programs
The programs will be installed in a directory of your choosing. For example, if I place the
downloaded “.tgz” files in “/home/rbh”, then I would do the following:
“.tgz” gzipped files: Using sh, bash or csh shells:
sh or bash csh
for i in *.tgz foreach i ( *.tgz)
do gunzip –c $i | tar xf –
gunzip –c $i | tar xf – end
done
5/30
Eventually you may remove the “.tgz” file to save space. You will not require these
any more.
2.4 Compiling
Note that in the example below “rbh>” is the shell prompt indicating that you are in the
“rbh” directory. If your directory name is different, the prompt will be different.
Commands for you to type are indicated in bold, such as “cd”.
First, go to the PROGRAMS.330 directory.
rbh> cd PROGRAMS.330 (go to the Programs directory)
Then run the Setup program:
rbh> ./Setup (get correct syntax)
Checking for existence of bin and lib directories
Directory bin exists
Directory lib exists
Usage: Setup SOL WIN32 SOL-EGCS LINUX LINUX64 CYGWIN OSX
SOL SUN Solaris Compilers
SOL-GNU SUN Solaris with gcc/g77 compilers
CYGWIN CYGWIN 98/NT/2K/XP gcc/g77 Compilers
CYGWIN40 CYGWIN 98/NT/2K/XP gcc/gfortran Compilers
LINUX Linux with gcc/g77 compilers
LINUX40 Linux with gcc/gfortran compilers
LINUX64 Linux 64 bit with gcc/g77 compilers
LINUX6440 Linux 64 bit with gcc/gfortran compilers
OSX Apple with gcc/g77 compilers
OSX40 Apple with gcc/gfortran compilers
OSF DEC/Compaq ALPHA cc/f77
To determine which to use on you system, first determine the architecture with the
uname -a command. If you something like
32-bit Intel/AMD processor with GNU 4.X compilers:
Linux crust 2.6.22.19-0.2-bigsmp #1 SMP 2008-12-18 10:17:03 +0100 i686 i686 i386 GNU/Linux
you would use LINUX or LINUX40. The key is the i686 and Linux. Now we check the
compilers.
rbh> which gcc g77 gfortran
/usr/bin/gcc
which: no g77 in (:/usr/local/bin:/usr/bin:/bin:)
/usr/bin/gfortran
Since gfortran is present, we verify the compiler version as follows:
rbh> gcc –version
gcc (GCC) 4.2.1 (SUSE Linux)
rbh> gfortran –version
GNU Fortran (GCC) 4.2.1 (SUSE Linux)
Since the compiler versions are 4.x.y, and since we have a 32-bit system, we would run
./Setup LINUX40
6/30
64-bit Intel/AMD processor:
Linux yarn 2.6.11.4-21.7-default #1 Thu Jun 2 14:23:14 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux
you will use LINUX64 or LINUX6440 since this is a 64 bit processor. We now check the
installed compilers:
rbh@yarn:~> which gcc g77 gfortran
/usr/bin/gcc
/usr/bin/g77
For this system we would use ./Setup LINUX64
Solaris:
SunOS wilip 5.8 Generic_117350-45 sun4u sparc SUNW,Sun-Blade-100
you will use SOL or SOL-GNU since you have a Solaris operating system.
To test the compilers, I can issue the command
which cc f77 gcc g77
/opt/SUNWspro/bin/cc
/opt/SUNWspro/bin/f77
/usr/local/bin/gcc
no g77 in /opt/SUNWspro/bin /opt/bin /usr/ccs/bin /usr/local /usr/local/bin /usr/
ucb /usr/bin .
For this system , we would use ./Setup SOL
In the future I may try to use the configure command to simplify this
process.
Assuming that we have the gcc/g77 compilers under LINUX, we now enter
rbh> ./Setup LINUX (for my LINUX system – you will
use your system type. This command will define the Makefile to use for
the system)
Copying VOLI/src/Makefile.LNX VOLI/src/Makefile
Copying VOLII/src/Makefile.LNX VOLII/src/Makefile
Copying VOLIII/src/Makefile.LNX VOLIII/src/Makefile
Copying VOLIV/src/Makefile.LNX VOLIV/src/Makefile
Copying VOLV/src/Makefile.LNX VOLV/src/Makefile
Copying VOLVI/src/Makefile.LNX VOLVI/src/Makefile
Copying VOLVII/src/Makefile.LNX VOLVII/src/Makefile
Copying VOLVIII/src/Makefile.LNX VOLVIII/src/Makefile
Copying VOLVIII/gsac.src/Makefile.LNX VOLVIII/gsac.src/Makefile
Copying VOLIX/src/Makefile.LNX VOLIX/src/Makefile
Copying CALPLOT/src/cmd.unx/Makefile.LNX CALPLOT/src/cmd.unx/Makefile
Copying CALPLOT/src/clib.unx/Makefile.LNX CALPLOT/src/clib.unx/Makefile
Copying CALPLOT/src/flib.unx/Makefile.LNX CALPLOT/src/flib.unx/Makefile
Copying CALPLOT/src/util/Makefile.LNX CALPLOT/src/util/Makefile
Copying IRIS/rdseed4.5/Makefile.LNX IRIS/rdseed4.5/Makefile
Copying IRIS/DOCOMPILE.LNX IRIS/DOCOMPILE
Copying CALPLOT/src/XVIG/src/Makefile.LNX CALPLOT/src/XVIG/src/Makefile
Copying CALPLOT/testf/Makefile.LNX CALPLOT/testf/Makefile
7/30
Copying CALPLOT/testc/Makefile.LNX CALPLOT/testc/Makefile
Copying CALPLOT/Utility/Makefile.LNX CALPLOT/Utility/Makefile
The proper Makefiles have been installed for your Operating System
Verify that these are correct with respect to compilers, flags
and libraries
If everything is correct, enter the command
./C for the complete distribution or
./Ccal for just CALPLOT
to make everything after you have GUARANTEED THE CORRECT PATH
Documentation is in the directory DOC in PDF format
If everything is correct, enter the command
./C (for the complete distribution or)
./Ccal (for just CALPLOT)
to “make” everything.
When the compilation is done, the executables will be in the “/bin” directory and the
libraries in “/lib”.
2.5 Changing PATH
In order to use the programs you must change the PATH environment parameter. First
determine the name of the SHELL that you are using.
rbh> echo $SHELL
You will see something like “/bin/sh”, “/bin/bash” or “/bin/csh”. To change the PATH we
must edit a file in your login directory. For discussion, let the login directory be
“/home/rbh”. In the bash or C-shell, the tilde, “~”, is an alias to indicate this login
directory. Do the following for the appropriate shell. Recall that the Programs are
installed in “/home/rbh/PROGRAMS.330” (where “/home/rbh” will be different for your
computer).
/bin/sh
Edit “/home/rbh/.profile” to add the following lines after the last reference to PATH.
PATH=$PATH:/home/rbh/PROGRAMS.330/bin
export PATH
/bin/bash
Edit “/home/rbh/.bash_profile” or equivalently “~/.bash_profile” to add the
following lines after the last reference to PATH.
PATH=$PATH:/home/rbh/PROGRAMS.330/bin
export PATH
/bin/csh
8/30
Edit “/home/rbh/.cshrc” or equivalently “~/.cshrc” to add the following lines after the
last reference to PATH.
set path = ( ~/PROGRAMS.330/bin $path)
When you log onto the computer the next time, the PATH will be reset. You can see the
new PATH with the command
rbh> echo $PATH
You should now see “PROGRAMS.330/bin” in the PATH listing. As an added check, you
can ask the system to find a program, as in
rbh> which calxvig plotxvig surf96
~/PROGRAMS.330/bin/calxvig
~/PROGRAMS.330/bin/plotxvig
~/PROGRAMS.330/bin/surf96
2.6 Documentation
Documentation is in the directory DOC in both PDF format.
You are now ready to use Computer Programs in Seismology! Have Fun
To assist in using these programs, refer often to
http://www.eas.slu.edu/eqc/eqc_cps/TUTORIAL/
for tutorials with data sets.
2.7 Updates
Because Computer Programs in Seismology is a dynamic collection of research code,
check the link
http://www.eas.slu.edu/eqc/eqc_cps/cpsbug.html
often to determine new additions, new capabilities or fixes that have been applied to the
code.
9/30
3 Installation on Windows using Cygwin
The Windows distribution can be made directly from the CDROM. There are three steps
for a successful installation:
1. Installation of the Cygwin package
2. Modification of the Cygwin environment for the user
3. Installation of Computer Programs in Seismology
3.1 Getting Cygwin
WEB
Use the browser to go to the Cygwin website at http://www.cygwin.com.
Get the current version of setup.exe.
Start setup.exe from the control panel or from the run option of windows.
CDROM
Cygwin is on the CDROM in the “usr” folder.
When you insert the CDROM you will see the following:
You have two options: drag the entire folder to your hard disk or install from the
CDROM. Placing everything on the hard disk will make the installation faster and
perhaps more robust, although you will use about 700 Mb of disk space. If you drag,
drag the usr folder into C:\ , which you can see in My Computer, so that you will now
have a folder C:\usr.
10/30
For example if the CDROM drive is “D:”, then you will want to run the program D:\usr\
setup.exe. If you placed everything in the C: drive, click on the icon C:\usr\
setup.exe.
3.2 Cygwin installation
Cygwin is a Linux-like environment for Windows. This set of instructions explains how to
use the provided Cygwin installation CD to install the software package Cygwin on your
Windows XP computer.
11/30
1. The first thing to do is to start the Cygwin Setup.
If you install from the internet, this Setup will be on your desktop.
If you install from the CDROM/DVD, open that in “My Computer”, go to the use folder,
and then click on “setup.” After doing this, you will see the following:
2. We now indicate the source of the installation: For the distribution CD, we will use
“Install from Local Directory”.
12/30
3. Now define where cygwin will be installed on your computer. The default of “C:\
cygwin” is OK to use.
4. The program asks for the locaiton of the cygwin install package. If you install
directly form the internet, I recommend that you use the location “C:\usr\
cygwin.dist”
If you are installing from the CDROM/DVD on the “D:” drive, then modify the next
screen to use “D:\usr\cygwin.dist”.
In the figure below, the package is in the usr folder on the C: drive.
13/30
The installation program will first spend some time checking the integrity of the
distribution.
5. Cygwin will now provide a menu from which you can install everything or just part of
the distribution. To modify a selection, just click on the Default entry. If you click on
the Default entry under the upper level category All, then you will get the entire
distribution. This is the simplest way to install but also takes the longest to isntall
and requires more disk space. If you do not have enough disk space for the entire
distribution, follow instructions below to select the minimum necessary files. The window
list of categories looks like this.
If you click the “Default” to the right of “All” all “Default” will be changed to “Install” to
indicate that everything will be installed.
14/30
For a faster installation, and to use less disk space, we can install just the required
minimum with the following steps:
Make sure that the “All” is “Default”
Open “Archive” and install (by clicking on the line): zip, unzip, sharutils
Open “Base” and install: everything
Open “Devel” and install: binutils, ddd, gcc, gcc-g77, gdb, libncurses, make,
readline
Open “Editors” and install: ed, vim, nedit, mined
Open “Graphics” and install: GraphicsMagick, ImageMagick, epstool,ghostscript,
gnuplot, gv, xfig
Open “Libs” and install: openssl, ncurses, sunrpc, termcap
Open “Math” and install: xcalc
Open “Net” and install: openssh, openssl
Open “Publishing” and install: tetex if you require latex – this is not necessary for
running the Computer Programs in Seismology packages.
Open “Shells” and install: xterm [note bash and ash are already selected – you
need these]
Open “Text” and install” a2ps, groff
Open “Util” and install: units
Open “Web” and install: wget
Open “X11” and install: Click on the “Default” to change it to “Install” since we
need everything.
NOW CLICK “Next”
Examples: You will see displays such as shown in the next figures. Note that your
distribution will have newer versions of the programs.
15/30
16/30
17/30
Once you see “Install” next to “X11”, then you are finished selecting packages
Press “Next” to actually start the installation.
If there are any routines still required, you will see a page like this:
this is just a warning. When you go to the next step, the system is smart enough to find
the missing routines. So click on “Next”. When the installation has finished, select
“Finish” to exit the setup program after ensuring that both boxes are checked.
18/30
The installation is now complete. Click “OK” to acknowledge.
A Cygwin icon will appear on the Desktop and in the Start menu Programs tab.
Note: The entire Cygwin package is available from the official Cygwin web page
http://www.cygwin.com. If you wish to add more programs or to update from the
internet, if you have a high speed connection, repeat the “setup” procedure.
3.3 Modify the Cygwin environment
Start Cygwin
At this point you should have a Cygwin icon on your desktop. Click this icon. A terminal
window will appear.
19/30
3.4 CYGWIN and VISTA and XP
This advice is from http://inst.eecs.berkeley.edu/~cs61c/sp08/assignments/proj/04/
which addressed the issue of using the X11 graphics successfully.
1. Since ash and rebaseall are installed, we will do the following steps to get around
some Windows problems with multitasking.
2. exit cygwin completely by entering
$ exit
3. From windows, Start → All Programs → Accessories → Command Prompt to
bring up a command window
4. cd c:\cygwin\bin
assuming that the CYGWIN was installed into c:\cygwin
5. C:\cygwin\bin> ash
$ ./rebaseall
$ exit
6. Close the window by clicking on the 'X'
Other useful links addressing this problem are
http://www.urlfan.com/local/cygwin_tuning_guide/79162282.html
20/30
http://inst.eecs.berkeley.edu/~cs61c/sp08/assignments/proj/04/
From the initial command window, determine if the program “ash” was installed with the
following commands. Note that my prompt is Bob@DGS36W81 where Bob is the user
name on windows and DGS36W81 is the name of the computer.
$ which ash
/usr/bin/ash
$ which rebaseall
/usr/bin/rebaseall
3.5 Modify some Cygwin files
We need to modify some startup information for Cygwin to allow it to find all the
programs we want to use.
We must do this before we can start the X11 graphics. We also must get around some
differences between Windows and Cygwin.
If you are not familiar with the UNIX/LINUX/Cygwin vi editor, you can use the Windows
Notepad – however if I say you want to edit the /etc/passwd, you will open the file C:\
cygwin\etc\profile!
First start Cygwin by clicking on the Cygwin shortcut on you Desktop.
Modify the “/etc/passwd”
Windows will typically attempt to place one in a named folder under
C:\Documents and Settings\Owner
If you log in as user “Owner”. The problem here are the spaces in the folder name. One
must be very careful with these spaces under the bash shell because spaces can only
be used if they are quoted. There are two ways to handle this.
The simplest is to edit the file /etc/passwd. Look for the entry for your user name, e.g.,
mkh:unused_by_nt/2000/xp:1009:513:mkh,U-FARLEY\mkh,S-1-5-21-632854848-
2332866997-1805960406-1009:/cygdrive/c/Documents and Settings/mkh:/bin/bash
or something like this. Then enclose the PATH by double quotes:
mkh:unused_by_nt/2000/xp:1009:513:mkh,U-FARLEY\mkh,S-1-5-21-632854848-
2332866997-1805960406-1009:/cygdrive/c/”Documents and Settings”/mkh:/bin/bash
The other, preferred approach is to keep all CYGWIN stuff away from the normal
WINDOWS files by placing the user login directly under the CYGWIN tree. This is done
by ensuring that the user HOME directory is located directly under the CYGWIN
installation, specifically that there be a
/home/Owner
21/30
directory. If /home or /home/Owner do not exist when you log in, create it using the
command
mkdir /home
mkdir /home/Owner
Now modify the Owner entry in /etc/passwd to read as
SYSTEM:*:18:544:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Admin:unused_by_nt/2000/xp:1007:513:Admin,U-DGS36W81\Admin,S-1-5-21-
524513049-1333336688-1930612807-1007:/home/Admin:/bin/bash
Administrator:unused_by_nt/2000/xp:500:513:U-DGS36W81\Administrator,S-1-
5-21-524513049-1333336688-1930612807-500:/home/Administrator:/bin/bash
Bob:unused_by_nt/2000/xp:1005:513:U-DGS36W81\Bob,S-1-5-21-524513049-
1333336688-1930612807-1005:/home/Bob:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-DGS36W81\Guest,S-1-5-21-524513049-
1333336688-1930612807-501:/home/Guest:/bin/bash
HelpAssistant:unused_by_nt/2000/xp:1004:513:Remote Desktop Help
Assistant Account,U-DGS36W81\HelpAssistant,S-1-5-21-524513049-
1333336688-1930612807-1004:/home/HelpAssistant:/bin/bash
SUPPORT_388945a0:unused_by_nt/2000/xp:1002:513:CN=Microsoft
Corporation,L=Redmond,S=Washington,C=US,U-DGS36W81\SUPPORT_388945a0,S-1-
5-21-524513049-1333336688-19
You only have to worry about the bold faced name of the login directory. Note that there
are no spaces.
Now exit by typing exit and then restart the CYGWIN program so that your
environment recognizes these changes.
Modify your “.bash_profile”
You will need a way to find the programs that is independent of the system’s idea.
Change directory to your login directory by entering the command “cd” to get to your
login directory.
cd
If this does not work, edit the “.bash_profile” file there so that it looks like the following
at the end:
export PATH=$PATH:/cygdrive/c/usr/PROGRAMS.330/bin:
In this example, the COMPUTER PROGRAMS IN SEISMOLOGY are installed on the C:
drive in a folder called “usr”. Cygwin defines the Windows C: drive in a UNIX-like
manner through the file path “/cygdrive/c”. To see the Cygwin view of the file system,
enter the command “df”.
Note July 31, 2007: This is now included in the unpacking shown in the next step.
So if you unpack the rbhenv.tgz you will not have to do this.
22/30
Set up your X11 environment
Now copy the archive rbhenv.tgz from the distribution CDROM or from the C drive as
cd (the cd gets you to your home directory)
cp /cygdrive/d/usr/rbhenv.tgz .
or
cd
cp /cygdrive/c/usr/rbhenv.tgz .
and unpack it using the command:
gunzip –c rbhenv.tgz | tar xf -
This unpacks a modified .bashrc startup file, which has an alias C=’cd /cygdrive/c’ and
and alias CPS=’cd /cygdrive/c/usr/PROGRAMS.330’ and also the .bash_profile
discussed above.
In addition the GNUstep directory are put in the home directory.
Now close the window.
Now start Cygwin again from the Desktop shortcut.
At the prompt enter the command xinit as follows:
$ xinit &
When you do this the first time, Windows will display a warning:
23/30
Just Click “Unblock” The reason for that is under security patches to Windows XP, any
communication between the PC and the outside world is severely limited by default. This
security concern affects the initial operation of X11 programs, both those distributed as
part of CYGWIN and the Computer Programs in Seismology programs plotxvig, calxvig,
do_mft and do_pom. When these programs are run the first time, an XP interface
appears. Select the option that permits the use of these programs through DNS. This is
necessary because X11 components inter-communicate using networking protocols.
You will now see a window like the following. There will be two xterm's terminals and the
preferences have been set to have windows autoraise as you pass the mouse over
them.
If you click on the background a menu will appear that will permit you to create more
Xterms. Just click a while – you can change the background and all of the other color
schemes.
An advantage of this window manager is that you can copy text in an xterm window by
pushing down on the left mouse button and then dragging. This placed the information in
the clipboard. If you start Word or OpenOffice under Windows, you can paste this
information into a document.
You can also “ssh” to other computers if you have access to them. You can start other
programs from within the X11 environment:
24/30
This X11 environment is required so that you can run the CPS programs, including
gsac.
3.6 Cygwin Help
Much information is provided with the distribution. From within a Cygwin terminal
window enter the command
cd /usr/share/doc
To answer specific questions go to the Cygwin website http://www.cygwin.com at which
you will find a link to a User's Guide under documentation.
Since the commands are those of Linux systems, a book on Linux or the bash shell
would be useful.
3.7 Cygwin X11 Help
The fine tuning of X11 is not simple because of the fact that the X11 distribution tries to
be as independent of Windows as possible. Many details of the installation are given at
the Cygwin/X home at http://x.cygwin.com.
25/30
The frequently asked questions (FAQ) at http://x.cygwin.com/docs/faq will be able to
assist you. The documentation is available in HTML, PDF, PS, RTF and TXT formats.
There are several important issues that must be addressed.
Keyboard
The bash shell uses certain characters: # ` ~ & % / \ { } | that may not be directly
available on non-US keyboards. Windows knows about your keyboard, but X11 does
not. This means that a symbol typed under Windows may not appear the same under
X11.
Copy/Paste
There may be times that you wish to copy text between Windows and X11. You will not
be able to copy graphics images though. Text copying can be done as follows:
You copy text to the clipboard in Windows with Ctrl+C. You then paste that in X11 with
either a middle mouse button click or via a menu in the current application (if it has a
Paste menu item).
You copy text in X11 by highlighting it and, optionally, clicking the Copy button in a menu
(if the application has a Copy menu item). Leave the text highlighted just to be sure. To
paste that text in Windows, press Ctrl+V.
The difficulty with this is that the lines of text files in Windows are terminated by a
carriage return (CR) and a line feed (LF), but by just a line feed (LF) in UNIX and the
way that we set up Cygwin. It is better to do the following:
On Windows, save the text as a text file under SAVE AS. Then from within Cygwin run
the command “dos2unix textfile”. This program replaces the CR LF combination by
just a LF.
On X11, save the text as a textfile and then run the command “unix2dos textfile”.
Graphics
The ImageMagick package (which requires GhostScript) permits conversion of graphics
formats. For example, the Computer Programs in Seismology package graphics
consists of a binary graphics metafile, which can be converted to Encapsulated
PostScript. If this CALPLOT file is called SHWMOD96.PLT, then I can create a portable
network graphics file (PNG) for insertion into MS Office documents or web pages using
the commands:
plotnps –F7 –W10 –EPS –K < SHWMOD96.PLT > SHWMOD96.eps
convert –trim SHWMOD96.eps SHWMOD96.png
The “–trim” flag eliminates any unnecessary white space.
There are also utilities to convert to PDF, e.g., ps2pdf and eps2pdf. I prefer to convert to
PDF and then use the latest version of the Adobe Acrobat Reader on the Windows side
to print the information and also to send information to others.
26/30
3.8 Installation of Computer Programs in Seismology
If you did not copy the usr folder from the CDROM to the C: drive, you must perform the
following steps. First, create a folder called “usr” on one of your drives or partitions. You
can do this from the Windows Control Panel or from within Cygwin. Do the following to
place everything on the C: drive
cd /cygdrive/c
mkdir usr
Now copy the distribution from the CD and unpack it. If the CDROM is on the D: drive
just drag or copy/paste “D:/usr/NP330.tgz” to the “usr” folder. NOTE since 2008, the
name of this tarball now reflected the date it was created, e.g.,
NP330.Feb-23-2009.tgz
From the Cygwin terminal window,
cd /cygdrive/c/usr
gunzip –c NP330.Feb-23-2009.tgz | tar xf –
This will create the folder PROGRAMS.330. To compile and install the programs we follow
the procedure similar to that for the UNIX/Linux/MacOS–X systems:
cd PROGRAMS.330
./Setup CYGWIN
./C
If your SHELL path is properly set, you will be able to do the following:
which plotxvig
To test the distribution, I would do the following.
cd PROGRAMS.330/CALPLOT/testc
plotxvig < PLTTST.1
This will draw a set of colored circles. Now try
make new
new
This test program uses the cursor and tests some of the CALPLOT library calls.
3.9 Documentation
Documentation is in the directory DOC in both PDF format.
You are now ready to use Computer Programs in Seismology! Have Fun
27/30
3.10 Updates
Because Computer Programs in Seismology is a dynamic collection of research code,
check the link
http://www.eas.slu.edu/People/RBHerrmann/CPS/cpsbug.html
often to determine new additions, new capabilities or repairs that have been applied to
the code. If the changes made are useful, then get the latest distribution and reinstall.
You can just replace the current version on your system.
3.11 Tutorials
The codes are modified more often than the documentation. To really determine the
capabilities of the package, a set of tutorials has been created, which can be found on
the web at
http://www.eas.slu.edu/eqc/eqc_cps/TUTORIAL/
3.12 SHELL scripts
This comment applies primarily to user written shell scripts black under CYGWIN, but
may also apply to other operating systems.
In sh or bash shell scripts, it is often convenient to indicate the relative location of an
executable directory through the following sequence:
export PATH=:../bin:$PATH
On Windows machines, it is permissible to have a path component that looks like
:/cygdrive/c/Program Files/Common Files/Adaptec Shared/System
Note the blanks between Command and Files and between Adaptec and Shared. These
will cause the export command to fail. The remedy is to use the following in SHELL
scripts:
export PATH=:../bin:”$PATH”
The double quotes permit the original PATH variable to be used in its entirety. However
we will set up the CYGWIN environment so that this will never happen.
3.13 Printing and Graphics for Documents and the Web
Single page graphics plots in Computer Programs in Seismology can be converted to
encapsulated postscript using the command
plotnps -F7 -W10 -EPS < calplot_binary_plot_file > plot.eps
28/30
The plot.eps can be converted to a png using the commands
convert -trim plot.eps plot.png
if using the ImageMagick package, or
gm convert -trim plot.eps plot.png
if using the GraphicsMagick package. (If you do not have these, you can just use the
plotgif command of the package to create a GIF image.)
The PNG file plot.png can then be included in PowerPoint of MS Word files.
If it is necessary to print something, I would do the following. First create a PostScript file
using plotnps for CALPLOT graphics or a2ps for text files. Then use the Cygwin
command ps2pdf to convert the file to an Adobe Portable Document File:
ps2pdf plot.eps
or
ps2pdf text.ps
which by default creates the files plot.pdf or text.pdf. Now go to the Windows menu and
open the Adobe Acrobat Reader (which you most likely already have on your computer.
You can download this free from the Adobe site). Ou can also use the Windows version
of GhostScript and Ghostview ( http://pages.cs.wisc.edu/~ghost/ ). If you were working in
your home directory, then the file would be in a windows location such as
C:\cygwin\home\rbh\text.pdf
Or if you were working in the /cygdrive/c/usr area, the Windows location would be
C:\usr\plot.pdf
The reason for using this mechanism, is that Windows software knows everything about
the connected printers and the Cygwin environment does not.
The example given for converting the plot.eps to a Portable Networks Graphics format
plot.png is adequate for placing a figure in PowerPoint or in a web document. If you wish
to use the figure for a large poster presentation at a scientific meeting or in a Word
document, then you will require more resolution so that the printed version looks good.
I created the following SHELL script called EPSTOPNG. I also told the system that it
should be an executable by the command
rbh> chmod +x EPSTOPNG
and I placed it in my ${HOME}/bin directory so that my PATH can find it. The contents of
this file are:
#!/bin/sh
EPS=$1
29/30
BASE=`basename ${EPS} .eps`
convert -trim -density 150x150 -resize 1000x1000 ${BASE}.eps $
{BASE}.png
This command strips the .eps from the file name, converts the EPS to a PNG using 150
dots/inch (about 60 dot/cm) and permits the image to have originally been 9 inches x 9
inches (or 22.5 cm x 22.5 cm). If you want a better looking image, change the 150x150
to a 300x300, realizing of course that the size of the file increases significantly.
You can learn more about the convert command by doing a
man convert
Note that we reset the PATH above so that entering convert gets the ImageMagick
version and not the internal Windows version. There is also a program display which has
some image editing commands and the ability to convert to many, many graphics file
formats.
Additional information on commands is /usr/share/doc
3.14 Cleanup
If you wish to update the Cygwin distribution or add more programs from the many on
the disk, leave the C:\usr\Cygwin.dist folder alone. Otherwise you can remove it. You will
always have the CD-ROM to get these programs. I usually leave the programs on disk.
3.15 Cygwin and LINUX
Command line processing is used. Please get any book on LINUX. The commands,
editors and many other items are the same. You must know some LINUX commands in
order to begin using Computer Programs in Seismology
30/30