Anda di halaman 1dari 8

Seismic Unix installation under Cygwin

Julien Fiore (julienfiore@gmail.com), Universit de Genve 3 mars 2006

The CWP/SU (Seismic Unix) package is an seismic processing and research environment developed at the Center for Wave Phenomena (CWP) at the Colorado School of Mines. The package is distributed freely, with full source code. SeismicUnix (SU) should be installed on a Unix-compatible operating system (e.g. Linux). However, installation on Microsoft Windows is possible if you have previously installed Cygwin/X, also freely available on internet. Cygwin/X consists of two parts. The first part, Cygwin, is a port of the GNU tools to Win32 and provides a UNIX-like environment in Windows without graphical interface. The second, Cygwin/X, is a port of the X Window System to Win32 and allows the display of Cygwin programs in standard Windows windows (Hunt, 2000). The two first sections of this chapter present the installation of Cygwin/X and SeismicUnix. The third section provides information and tips on how to use SU. The last section lists useful internet links.

Cygwin/X Installation

Packages installation
Go to http://x.cygwin.com and start the cygwin/X setup by clicking on "Install Cygwin/X now". Go through the first install steps keeping the default options. When asked for a download site, choose one located near your location (e.g. mirror.switch.ch in Switzerland). At the Select Packages screen, you have to select the Unix components to install. Leave the default selection and add the components listed in table 1. To select an entire category, click on Skip or Default until Install appears. For packages, click on skip until the version number appears. Since Cygwin setup program automatically selects dependencies, do not unselect any dependent packages.

Category Admin Base

Packages to install All packages All packages gcc-core

Devel

gcc-g++ gcc-g77 make cygwin-doc

Doc

cygwin-x-doc man

Shells

bash

Text Utils

less more bc lesstif

X11

xorg-x11-base xstart menu icons xterm

PostInstallLast _obsolete (also called ZZZRemovedPackages in recent Cygwin versions)

All packages

xfree86-prog

Table 1. Cygwin packages required to install SeismicUnix

When you have selected the appropriate packages, click next to continue the installation. If download fails, you can try again with a different server without having to reselect the components. When Install is complete, press Finish. Put a shortcut to C:\cygwin\usr\X11R6\bin\startxwin.bat on the desktop. You will click on this shortcut every time you want to start Cygwin/X.

Modify/Add Windows environment variables


Windows NT/2000/XP
To complete the installation, you have to modify/add variables. 1. Right click My Computer and select Properties > Advanced > Environment Variables. 2. Select the Path variable and click the Edit button. Add the line below to the end of the variable value:
;C:\cygwin\bin;C:\cygwin\usr\X11R6\lib

3. Create a new variable called DISPLAY and give it the value 127.0.0.1:0.0

Windows 95/98
In Windows 95/98, it is necessary to manually edit the file AUTOEXEC.BAT in a text editor to add or change the value of an environment variable. To add the DISPLAY variable, add the following line:
set DISPLAY=127.0.0.1:0.0

To update the PATH variable, you have to add the following string the end of the PATH line:
;C:\cygwin\bin;C:\cygwin\usr\X11R6\lib

Reboot your computer to for these changes to take effect

Swiss-French keyboard installation


1. Go to http://home.imf.au.dk/hellmund/xmodmap/ and download the file Put it in the folder C:\cygwin\etc\X11\
xmodmap.ch_fr.

2. Edit the file C:\cygwin\usr\X11R6\bin\startxwin.bat and add the following line at the end of the file :
xmodmap /etc/X11/Xmodmap.ch_fr

3. Double-click the Cygwin icon on the desktop to open a cygwin terminal. Enter the following command:
cp /etc/X11/Xmodmap.ch_fr ~/.Xmodmap

Test the installation


On the desktop, double-click the shortcut to C:\cygwin\usr\X11R6\bin\startxwin.bat. If installation is correct, an X icon should appear in the Windows System Tray and a Cygwin/X terminal should pop up. The X icon means that an X server is running and that Cygwin/X programs can use it to display any graphical information in a window. If you have problems to connect to the X server, make sure that the internet TCP/IP protocol is installed, even if you dont plan to use Internet. Go to Control Panel > Network and if TCP/IP is not listed, choose Add > Protocol Add > Microsoft > TCP/IP > Ok. On Windows 95/98, you may also have to change the initial memory allowed to the DOS environment. Open a DOS window, right-click at the top of the window, click Properties > Memory, set the conventional memory initial environment to the maximum (4096) and reboot.

Add cygwin to folder context menu


When you start Cygwin/X, you are always in the home folder (i.e. C:\cygwin\home\username). To work directly in the folder where you have your seismic data, you can add in the folder context menu a Cygwin here option to start a Cygwin terminal within this folder. To do so, save the following lines to a file with a .reg extension (e.g. cygwin.reg). Run the file by double-clicking on it to write these new commands in Windows registry. If necessary, change the path to bash.exe.
REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\BashHere] @="&Cygwin here" [HKEY_CLASSES_ROOT\Directory\shell\BashHere\command] @="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash rcfile ~/.bashrc\"" [HKEY_CLASSES_ROOT\Drive\shell\BashHere] @="&Cygwin here" [HKEY_CLASSES_ROOT\Drive\shell\BashHere\command] @="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash rcfile ~/.bashrc\""

Seismic Unix installation

Download
Go to http://www.cwp.mines.edu/cwpcodes/ and download the latest version of Seismic Unix. It is distributed as a compressed file called cwp.su.all.XX.tar.gz where XX corresponds to the version number. Create the folder C:\cygwin\cwp and download the file into this emplacement.

Decompression
When the download is finished, right-click on the C:\cygwin\cwp folder and choose Cygwin here in the context menu to run a Cygwin terminal. In this terminal, type the two following commands to decompress the file (replace XX by the version number):
zcat cwp.su.all.XX.tgz | tar -xvf

Environment variables
To add environment variables, open the file the following lines:
CWPROOT="/cwp" export CWPROOT
C:\cygwin\etc\profile

in a text editor and add

Then, find the line


PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH

and add :/cwp/bin (without quotes) at the end, in order to get:


PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH:/cwp/bin"

On Windows NT/2000/XP, right click My Computer and select Properties > Advanced > Environment Variables. In the System variable part, click New... to create a new variable. Name the new variable CWPROOT and give it the following value: C:\cygwin\cwp (without quotes). If you are on Windows 95/98, you have to edit AUTOEXEC.BAT in a text editor to add the line below (and then reboot):
set CWPROOT= C:\cygwin\cwp

Compilation
In order to run Seismic Unix, you must compile the source code. Edit the file C:\cygwin\cwp\src\Makefile.config in a text editor. Makefile.config permits to set the options for the installation on your PC. Read carefully the comments and modify the file to correspond to a PC Cygwin installation. If you need help, look at my makefile or the makefile of Lee (2004), but they may be outdated for your current version of SU. Once you have done the necessary changes to the makefile, you can compile the source codes. Open a Cygwin terminal and change the current location via:

cd /cwp/src

Then, type the following commands to compile:


make install make xtinstall make finstall make mglinstall make xminstall make sfinstall

(to install the basic set of codes, answer y to any question) (to install the X-toolkit codes, see note below) (to install the Fortran codes) (to install Mesa/Open GL codes, optional) (to install X-Motif codes , optional) (to install SFIO materials and SEGDREAD)

note: if you get a Nothing to be done for `xtinstall message when trying to compile the xtinstall package, you can compile xtinstall via the following command lines:
cd $CWPROOT/src/ cd ./Xtcwp; make; cd .. cd ./xplot; make; cd ..

If problems occur during compilation, you can recompile the codes via:
make remake make xtremake make fremake make mglremake make xmremake make sfremake

To test the installation, start Cygwin/X by double-clicking enter: suplane | suxwigb & A synthetic profile should appear (Fig. 1).

startxwin.bat.

In the terminal,

Fig. 1. Screenshot of a Cygwin terminal and a SU synthetic profile on the Windows desktop

Seismic Unix Beginner Guide

This section presents to the new user basic informations about SU in association to Cygwin/X, particularly the way of displaying SU profiles. For more complete documentation on SU, you can download a clear and detailed SU manual (Stockwell and Cohen, 2002) from the CWP/SU website. To get information about a specific SU module (e.g. sufilter for frequency filtering), just enter the module name at the command prompt. To get a description of a header field, type sukeyword followed by the header field name (e.g. sukeyword dt). When you enter commands within a Cygwin window, be careful of the case (lowercase or uppercase) because Cygwin is case-sensitive. Note also that paths in Cygwin are expressed with a slash (/) and not a backslash (\) and that the root of the Cygwin file system corresponds to C:/cygwin/. If you want to access locations outside this root folder, you have to use the word cygdrive, which corresponds to My Computer under Windows. Table 2 presents examples of equivalences between Windows and Cygwin paths.

Windows path
C:\Cygwin D:\seismic\Data C:\Cygwin\Home\user

Cygwin path
/ /cygdrive/d/seismic/Data
~

Table 2

Basic Unix commands


ls cd clear exit &

lists the current directory content. changes directory. Example: cd clears the terminal screen. closes the terminal. at the end of a command, runs the command in the background in order to use the same terminal to enter another command. is the piping symbol and allows you to redirect the output of a first operation as an input for the following one. The symbol also works. Example:
suplane | suxwigb & /cygdrive/d/seismic/Data

cat sh toto.sh

files concatenation. Example:

cat data1.su data2.su > data3.su

executes the shell script toto.sh. A shell script is a text file containing a sequence of commands, useful for writing a seismic processing flow. Equivalent to a batch script in MS-DOS.

Special keys
up/down arrows browse through the past command lines you entered to avoid retyping them. Right-click copy the highlighted text or paste the clipboard content. To enable copy/paste in Windows XP, you have to turn on the 'quick edit' mode for the command shell: Right-click on the window title bar, choose Properties, select Quick Edit, click OK, right-click again on the tiltle bar and choose default. completes the filename. Example: to open the file a01_neuchatel, just type a01 and press tab, the filename will complete automatically if there is no other file in that folder starting with the same characters. when reading online help, goes to the following screen. quits the online help.

tab

space q

Display a SU seismic section


To start working on your seismic data, you must first get a Cygwin command prompt in your data directory. First, run the desktop shortcut to startxwin.bat. Then, close the Cygwin terminal window and open a new one using the Cygwin here command that you added to the Windows context menu (section x.x.x): in Windows Explorer, right-click on the directory (not the file!) containing your seismic data and select Cygwin here. A terminal appears and you are ready to work with your data. To display a profile with the amplitude expressed in grayscale, type in the following line (remember that Cygwin is case-sensitive):
suximage < ProfileName.su perc=97 &

If you prefer a wiggle display, enter :


suxwigb < input.su perc=97 &

To avoid typing the entire filename, you can enter the first letters and press the Tab key to auto-complete it. The perc parameter is optional and its default value is 100. By lowering this value, you increase the contrast of the profile. To zoom-in, draw a rectangle with the mouse while pressing the left button. To zoom-out, left-click once on the profile. When viewing seismic lines with suximage, you can browse through RGB colorscales pressing r (next one) or R (previous one). If you want to label the traces according to a particular header word, use suxwigb and the key parameter. The following example labels the traces according to the field record number (header word fldr):
suxwigb < input.su perc=97 key=fldr &

The suximage aud suxwigb commands can be combined to other commands by piping ( | )to suit your needs. Examples: Display the first 500 traces:
suwind min=0 count=1000 < input.su | suximage perc=97

Display a pre-stack SU file and sort the traces by channel to track the bad channels :
susort < input.su tracf fldr | suximage perc=97

Combining the two previous command lines, you can display the 500 first traces, sorted by channel :
suwind min=0 count=1000 < input.su | susort tracf fldr | suximage perc=97

Useful Links

Cygwin/X http://x.cygwin.com Bash shortcuts to enter command lines more easily http://hajek.stat.ubc.ca/~harry/local/bash.html SeismicUnix http://www.cwp.mines.edu/cwpcodes/ Tips for SeismicUnix installation under Cygwin http://www.geocities.jp/kyotoalien/seismicunix.html Add Cygwin to Windows context menu http://www.mindview.net/Etc/Cygwin/BashHere Using Seismic Unix to Teach Seismic Processing http://www.geo.mtu.edu/spot/Teaching_Seismic/TBenz_Seismic.htm

Anda mungkin juga menyukai