Sie sind auf Seite 1von 5

Seismic Analysis Code (SAC) Tutorial-1

SAC is an analysis tools for the seismologists in the detailed study of seismic events. To start SAC,
type “sac” in your terminal
[kajal@KAJAL ~]& sac

SEISMIC ANALYSIS CODE [09/04/2008 (Version 101.2)]

Copyright 1995 Regents of the University of California

fg (Generates a function and stores it in memory)

SAC>fg sine (generate SINE function)
SAC>w Sine.sac (Save as Sine.sac, w→ write)
SAC>r Sine.sac (r→ read sac file)
SAC>lh (List Header)
SAC>p (plot sac file)
SAC>q (Quite from SAC)
Check all the header values, like NPTS, B, E, DELTA etc.
To save the output in .pdf, do the followings
SAC>bd sgf (Begins plotting to one or more graphics devices, sgf→ SAC Graphics File)
SAC>r Sine.sac
SAC>sgftops f001.sgf 3 (Convert .sgf to .ps format, line thickness 3, change 3 by 1 and 5
and check the output)
ps → PostScript, eps→ Encapsulated PostScript
In terminal type
[kajal@KAJAL]& gs (View the ps file using gs (ghostscript) or gv (ghosview))
[kajal@KAJAL]& ps2epsi Sine2.eps (convert ps to eps)
[kajal@KAJAL]& epstopdf Sine2.eps (convert eps to pdf)
[kajal@KAJAL]& evince Sine.pdf (To view the pdf file)
In SAC check the commands
xlim, ylim, p1, p2, ppk (Pick and write phase information, eg. P, S phase)

SAC> fg seismogram (Generate Seismogram)

SAC> w Seism.sac
SAC> r Seism.sac
SAC> p

From the Seism.sac remove AMARKER and FMARKER using

SAC>r Seism.sac
SAC>ch a (ch→ Change Header)
SAC>ch f
SAC>wh (wh→ Write header)
SAC>w over
Mark “P” using T Marker (T0) and add 1, 2 and 3 to the seismogram, and save the plot of 4
seismograms as pdf file (Try the Followings in SAC)
SAC> bd sgf
SAC> r Seism.sac
SAC> add 1
SAC> w Add1-Seism.sac
SAC> r Seism.sac
SAC> add 2
SAC> w Add2-Seism.sac
SAC> r Seism.sac
SAC> w Add3-Seism.sac
SAC> r Seism.sac Add1-Seism.sac Add2-Seism.sac Add3-Seism.sac
SAC> color on inc on (color on the graphs)
SAC> fileid t n (File Type Name, plot file name in graphs)
SAC> p1 (what happens if you change p1 by p2)
SAC> sgftops f001.sgf 3
Than convert .ps to eps and .eps to .pdf

Check also the commands SUB, MUL, DIV, SQR, SQRT, EXP, LOG
MACRO→ A SAC macro is a file that contains a set of commands that can be executed as a group.
Type the above lines in a file Run.m (.m for macro) using Text Editor “gedit” and save the file. In your
terminal type sac and run macro using m Run.m
SAC>m Run.m
The above SAC commands can also be executed using shell scripting. Create using gedit and
type the followings in the file
bd sgf
r Seism.sac
add 1
w Add1-Seism.sac
r Seism.sac
add 2
w Add2-Seism.sac
r Seism.sac
w Add3-Seism.sac
r Seism.sac Add1-Seism.sac Add2-Seism.sac Add3-Seism.sac
color on inc on
fileid t n
sgftops f001.sgf 3
ps2epsi All-Seism.eps
epstopdf All-Seism.eps
evince All-Seism.pdf
Save the file and execute it by typing sh in the terminal.

Cut waveform “Seism.sac”, 0.1 s before and 2 s after the T0 Marker and save both the files as pdf
(Original and cut SAC file)
SAC> bd sgf
SAC> r Seism.sac
SAC> cut T0 -.1 2
SAC> r (Don’t forget to read the file after cut)
SAC> cut off (Don’t forget to cut off)
SAC> w Seism.sac-Cut
SAC> r Seism.sac Seism.sac-Cut
SAC> color on inc on
SAC> fileid t n
SAC> p1
SAC> sgftops f001.sgf 3

Download the files
AMT_2009. Vertical component
AMT_2009. N-S component
AMT_2009. E-W component

Make a script to do the followings (Save your script and the figure)

1) Mark P (T0 marker) in the SAC files (*.z,*. n, *.e).

2) Cut all the components (z, n, e) 30 s before and 120 s after P (T0 marker) (Save them as *.z.Cut,
*.n.Cut, *.e.Cut)
3) Make a single pdf containing all the files *.z, *.n, *.e, *.z.Cut, *.n.Cut, *.e.Cut from top to bottom,
i.e., I want the figure as below (put fileid and color in each waveform)

Waveform (*.z)
Waveform (*.n)
Waveform (*.e)
Waveform (*.z.Cut)
Waveform (*.n.Cut)
Waveform (*.e.Cut)