Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAC: An Overview. SAC ( “Seismic Analysis Code” ) was originally developed at Lawrence Livermore National Laboratory It is an interactive program for.

Similar presentations


Presentation on theme: "SAC: An Overview. SAC ( “Seismic Analysis Code” ) was originally developed at Lawrence Livermore National Laboratory It is an interactive program for."— Presentation transcript:

1 SAC: An Overview

2 SAC ( “Seismic Analysis Code” ) was originally developed at Lawrence Livermore National Laboratory It is an interactive program for analyzing time-series data with emphasis placed on tools used to study seismic events. The most common uses for SAC include: Seismic phase picking Fourier transforms Filtering Signal stacking Particle motion (hodograms) SAC is a large program. It is comparatively user-hostile but not too difficult to get started The user manual is not particularly useful but the online manual is ok. Like a lot of freeware, once you have a feel for what you are doing, it gets much easier. Don't worry. Start simple, learn more complex tools only as you need them. Let's get started!

3 What is a SAC file? It consists of a “header” followed by a series of numbers (a vector of floats). Most commonly the series of numbers represents a single function, usually a time series of ground motion as recorded by a seismometer. This is not always the case but we will talk about other SAC file content later. Header Sequence of numbers (e.g., a trace) SAC is one of several “common” data formats used in seismology, and most seismologists have tools at their disposal to convert from one format to another. Other common formats include SEG-Y, SEED, SUDS, AH, SEISAN. Different formats are targeted at different anticipated uses. For instance, SEG-Y is most usually anticipated in exploration-type seismology (oil company reflection /refraction studies). AH is seldom used, being a rather 'niche' format developed in two different flavors at the Lamont-Doherty Earth Observatory and the U.S. Geological Society. But you may come across it when dealing with legacy data. The nice thing about SAC is that the header format is of a consistent, fixed length and is well-defined; it contains no surprises. Everyone “speaks” it.

4 What is a SAC header? A SAC header is simply a sequence of values of particular types and particular sizes, stored in a fixed order. The header stores information about the time, sampling, etc. of the data and on the location of the station and event. If you want to use a SAC file, you read the header, followed by the data vector (often called the “trace.”) Here is the layout of part of the header in a SAC file. We see here that each variable is spe- cified with its location. We see a lot of “float” type header variables, followed by a few of type “int.” SAC headers also contain variables that are character strings so we can store the name of a station, for instance. Many of these variables you will not need to know about, but some will be important in your work.

5 So let's start up SAC OK that was pretty easy. Let's look for a SAC file in the directory we are sitting in. IMPORTANT POINT TO REMEMBER: Some of the Unix/Linux commands you have learned can actually be invoked from within SAC. Like “ls” to make a directory listing. We now have the file in memory. We can look at it graphically, we can look at its header, or we can do something to it (filter, FFT, chop it into pieces, save it to disk after messing with it....)

6 Let's look at our header: Note the command “lh” is an ab- breviation for “list header.” Many SAC commands can be spelled out but most of them also have a short- hand that saves typing. Important header variables include NPTS (the number of points, or samples, in the file), DELTA (sample rate – here it is 100 samples per second, or delta of 1/100). Hmmm. KZDATE, that's pretty self-explanatory. Then KCMPNM (component name) EHZ. That tells me it's a vertical sensor. Oh, look, STLA, STLO, STEL: station lat, long and elevation. NETWORK = UW. Probably St. Helens.

7 Shall we take a look to see if it looks like a seismogram?

8 Let's examine the plot: * Horizontal axis (time) is reported in seconds. Is this correct, consid- ering the NPTS and DELTA? * Look at the information in the upper right hand of the box. SAC reports the station name and com- ponent and the time of the trace start. Does this look correct? The Y-axis is usually reported in “points,” which is the digitized voltage output by the seismometer. This is related to vertical ground velocity for this instrument (always a good guess but the header actually told us this). If we wanted to see ground displacement we could integrate (SAC will do this) or differentiate to see accelereation (SAC will also do this).

9

10 In other words, many things you might want to do to your data, you could do in SAC. You can Type “help” followed by a guess at the com- mand and you might get lucky. More useful would be to refer to the SAC user manual, which can be found online by Googling.

11 See the “command reference manual” links? If you know what you're looking for, go to “alphabetical.” If you're hunting for something that you want to do but don't know the command, search under “functional.”

12 SAC help: Provides interactive query of the user manual and tutorial.

13 Now, let's try to do something more useful. Let's say we want to look at the spectrum of our event. We can see that it is mostly lower frequencies but at the beginning there is some low-amplitude higher-frequency signal superimposed on the low-frequency (long-period). To look at the frequency, we have to perform a Fourier transform. Ordinarily when taking a FFT one should demean the data to remove any DC offset (which transforms into a huge zero-frequency spike) and taper the window to avoid high-amplitude truncations of the time series (which produces spectral leakage), but this example trace looks like someone has already done this. So let's just look at the spectrum.

14 I ask it to plot the spectrum for me, but only show the amplitude spectrum (no phase). SAC default is a log-log plot of the signal amplitude as a funtion of fre- quency. We can change this to be log-lin or lin-log or lin-lin, as we choose.

15 We can ask for the spectral plot again, but using linear/linear axes. Note this time we did not say “am” for amplitude, because SAC will keep in memory our previous parameter until we change it. Below is the resulting plot. It goes out to 50 Hz in frequency because our data is sampled at DELTA = 0.01 second. This is worth remember- ing – you cannot resolve frequencies higher than HALF your sample rate. This is called the “Nyquist frequency” and it tells you the maximum signal frequency content your data possess.

16 Our data does not seem to report anything useful above about 17 Hz and the signal details are all squashed up against the left-hand part of the plot. Let's limit our X axis to go from 0 to 17 Hz: NOW we can begin to see some details of the spec- trum! It looks like there is quite a lot of energy below 3 Hz and a separate peak above 3 Hz. Let's get rid of everything above 3 Hz by applying a “lowpass” filter and see what's left of the seismogram.

17 Oops! What happened? “Illegal operation on spectral file....” Oh, of course. We don't have our original trace in memory any more, we have a spectrum. The filter operation is done on the seis- mogram itself. So we read it back into memory: Notice I just said “read,” without typing the filename. This is because SAC remem- Bers what it read before. NOW we can perform our filtering operation on the trace. If it were not demeaned and tapered already, we would do this. As it is, we can just lowpass it :

18 Whoops! What happened? Our trace is only 9 seconds long but our axis goes to 17 seconds......oh, right. We asked for xlim of 0 to 17 when we were looking at the spectrum. Leave it to SAC to rem- ember! Well, that's easy: Now let's plot the trace again with the xlimit turned off:

19 That's better! Let's compare the filtered trace (top) to the original one (bottom). It looks like we eliminated the high-frequency signal that appears in the early part of the trace. So now we decide we want to save the filtered version of this waveform. Let's call it exFilt1.SAC just because.... I'd like to compare the two without having to read and plot them separately. There are two ways to do this:

20 If I already have one trace in memory and want to Read another, if I just say “read” it will overwrite the current one. So I can read one in and then say “read more.” Alternatively I can say “read” followed by a list of the desired files. If I ask for “plot” it will plot them one at a time (move to the next plot by hitting the return key). If I want to see them both in a single plot, I need to say “plot1.” (shorthand for plot is p and plot1 is p1 oh, BTW shorthand for read is r and, no surprise, write is w)

21

22 ….and so on. Notice what happened when I said “p2”

23 Just for giggles let's look at the spectra for both: fft; plotsp am linlin; color on list black red; p2 Interesting comparison. But this is the spectrum for the WHOLE traces. We know the high frequencies occur in the eraly part. Can we see a time- varying spectrum? Sure: it's called a spectrogram.

24 “ymax 17” tells it not to plot any frequncies above 17 Hz – we know this from looking at the FFT. And here we have a spectrogram for seismic trace example1.SAC. The spectrogram is only 8 sec- onds long because the default overlap of 100 samples shortens it. We can adjust numerous parameters of the spec- trogram function as ex- plained in the interactive “help.” The spectrogram shows frequencies on the Y axis and time on the X axis, amplitudes are color- coded as per the color bar on the left.

25 Let's read in several traces and identify some P-wave picks. SAC's picking fun- ction is called PPK. We enter the PPK mode by simply typing ppk then we interact with mouse and keyboard to put picks on the traces (actually into their headers).

26 Zoom is accomplished by typing “X” for the left-hand limit and clicking the first mouse button for the right-hand limit.

27 Picks are made by positioning the cursor over the part of the trace you want to apply the pick, then typing “p” or “a” on the keyboard. A vertical line will appear on the trace you just picked. Tradi- tionally P-wave picks are assigned to the “a” header variable in SAC. We exit the PPK function by typing “q” with the cursor some where in the graphics window. Picks are stored in memory; if we want to save them with the files, we must overwrite the files (“write”).

28 We can look at the picks as stored in the headers using the “lh” com- mand followed by the assigned header variable (“a”). We can Change them as often as we like before saving the files with “write,”and we can always change Them after we have written them to the files by reading in and going through the pick procedure again. S-wave picks are typically stored in variable T0.

29 Let's look at some multicomponent data. R = radial T = transverse Z = vertical Signals for a nearby shallow explosion. How do we know the Z component was ac- tually recorded upside- down? Let's zoom in:

30 Hint: Explosions can be viewed to first order as radiating a spherical wavefront away from the source, that is compressional in all directions. What is wrong with our vertical component? We would like to look at the particle motion of ground movement at this station in the vertical- radial plane. SAC has a function “ppm” to al- low us to do this.

31 Well, this is a mess. Let's look at a smaller time window.

32 By limiting the length of the time segment, we can see the details of the ground motion starting at the first-arriving P-wave. This capability is very useful for iden- tifying wave types in a seismogram since P and S and surface waves have distinct associated ground motions.

33 You have learned a little bit about UNIX / LINUX commands. You know that if you need to execute the same command over and over again, you can write a script that will do it for you. The same thing is true for SAC commands. We can write a script of SAC commands that will execute without you having to sit there and type over and over and over. We call this a SAC “macro.” We usually create our SAC macros in a shell script and then execute them from within SAC. For example: Say I have ten traces I want to read, one at a time, and I want to pick each one and overwrite it before looking at the next one. My SAC macro will look something like this:

34 I have called this file “pickmacro.” From within SAC I run the macro: And it starts showing me the traces, one at a time, entering PPK, waiting for me to make my pick and quit (“q”) out of PPK, then it writes over the file and reads the next one, and enters PPK for me.

35 SAC macros can be highly complex and sophisticated, performing tasks as varied as making calculations based on header values to producing oil company type shot or receiver gathers, plotting spectral phase functions for surface wave dispersion analysis, and manipulating SAC graphics to produce figures for publication. Using your UNIX/Linux scripting skills you can generate a SAC macro in very short order that addresses long lists of waveforms on which you need to operate, with a minimum of typing. Following is an example of a c-shell script that generates a SAC macro to pick trace MGAT.CHz within each of 236 event directories: #!/bin/tcsh cd /home/char/Montserrat/data /bin/ls |grep 9509 > templist echo "qdp off" > pickmacro foreach tracedir (`cat templist`) echo "read "$tracedir"/MGAT.CHz; ppk; write over;" >> pickmacro end /bin/rm templist

36 foxtrotterlanlgov:data char$ more pickmacro qdp off read /MGAT.CHz; ppk; write over; read /MGAT.CHz; ppk; write over; read /MGAT.CHz; ppk; write over; read /MGAT.CHz; ppk; write over; read /MGAT.CHz; ppk; write over; read /MGAT.CHz; ppk; write over; (etc.) This macro addresses 236 trace files – imagine how much typing it saves! Now we simply start up SAC and type “macro pickmacro” and we’re off SUMMARY: SAC is a seismic data analysis tool that is ubiquitous in the seismological community. If you are dealing with earthquake data you will almost certainly need to understand and use SAC. If you use other analysis tools, you will probably see that the tools invoke SAC capabilities or read SAC format files, so being acquainted with the structure of SAC data will be helpful.


Download ppt "SAC: An Overview. SAC ( “Seismic Analysis Code” ) was originally developed at Lawrence Livermore National Laboratory It is an interactive program for."

Similar presentations


Ads by Google