SAC Tutorial One

1.1 What is SAC?

SAC stands for Seismic Analysis Code. SAC is a general purpose interactive program designed for the study of sequential data, especially time-series data. Emphasis has been placed on analysis tools needed by research seismologists in the detailed study of seismic events. As such, it is used for quick preliminary analyses, for routine processing, for testing new techniques, for detailed research, and for creating publication quality graphics. It is used by both computer novices and experts. In order to make SAC quick to learn and easy to use, default values for all operational parameters were carefully chosen. At the same time, almost all of these parameters are under direct user control. This design combines ease of use with significant flexibility.

Mode of Operation

Each signal is stored in a separate data file. Each data file contains a header that describes the contents of that file. See the section on Data File Format for details. Signals are read from disk into memory using the READ command. SAC can process up to 200 signals of arbitrary size at a time. Once data is in memory other commands are typed at the terminal (or read from a macro file) to perform operations on these signals. All operations work concurrently on all signals in memory. You can look at the results at any time using the plot commands. There are several plot formats to choose from. You have control over titles and labels, plot limits, file identifications, axes and tick mark locations, etc. You can also save the results of these operations at any time. All of the commands are described briefly in the sections on Analysis Capabilities and Graphics Capabilities of the User's Manual and documented in detail in the Commands Reference Manual.

This tutorial will show you by example how the basic SAC commands work. If you want to learn more about a particular command, see the Command Reference Manual . For general information on how SAC works, how to create and use SAC macros, on the structure of SAC data files, and how to interface other programs to SAC see the User's Manual.

Note: SAC is a large program with many capabilities and options. It can be confusing at first. Don't despair. The most important commands are discussed in this guide. You need to learn about the rest of the commands only as you need them. Common sense defaults exist for most options. SAC does a lot of error checking so you can't get into too much trouble.

To be able to use SAC, we will need to access a different computer than we have been using for the Linux tutorials. Please read this info about how to access SAC.

1.2 Using SAC

Once you have read about how to login to Linux computer that can access SAC, let's make a new directory where we can store output from sac. Then once inside that directory you can simply type "sac" at the command prompt.

[username@linux ~] mkdir sac
[username@linux ~] cd sac
[username@linux ~] sac

SAC will then print a short headline including the number and date of the version you have on your system. It may also print a bulletin giving some current information. SAC will then ask you for input by sending the prompt to type commands at:

SAC>

SAC is an interactive command driven program. This means that you must type a command to get SAC to do something. It does not prompt you for input. Commands may be typed at the terminal or placed in a macro file. Symbols within a command are separated by spaces and commands within a given line may be separated by a semicolon.

SAC commands fall into three main categories: parameter-setting, action-producing and data-set manipulation. The parameter-setting commands change values of internal SAC parameters. Action-producing commands perform some operation on the signals currently in selected memory based upon the values of these parameters. Data-set commands determine which files are in active (selected) memory and therefore will be acted upon (data-set commands are not currently operational). The effect of a parameter-setting command remains in effect until it is reset. The effect of an action-producing command is immediate and transitory. Action-producing commands also have options which normally remain in effect until reset. These options, however, apply only to that particular command. The underlying assumption is that you are more likely than not to want to use the same values the next time you execute the same command. When you start up SAC, default values are defined for all of these parameters. SAC can be reinitialized to this default state at any time by executing the INICM command.

1.3 A Simple Example

We'll start by creating a simple function:

SAC> FUNCGEN IMPULSE

This command generates an impulse function and stores it in SAC's memory. To see what this function looks like on your screen type:

SAC> BEGINDEVICES XWINDOWS

SAC> PLOT

In this example XWINDOWS is the name of the graphics device you are using, which should make the plot appear on your screen. This is also the default device for SAC, so you don't have to type the BEGINDEVICES command before typing the PLOT command.

Exercise S1.1

How long (in seconds) is the time series FUNCGEN generated? At what time is the peak? Store your answers in a file called intro.txt.

1.4 Abbreviations

There are abbreviations for the most used SAC commands. For example, FG, BD, and P are the abbreviations for FUNCGEN, BEGINDEVICE, and PLOT respectively. Most options also have abbreviations: X for XWINDOWS. There is a graphics device for generating hardcopy plots called SGF (stands for SAC Graphics File). Let's change the device:

SAC> BD SGF

SAC> P

SAC> LS

The ls command is the same one you use on the UNIX command line to list files in the current directory. It should show you a file named f001.sgf that was generated when you ran PLOT after changing the device to SGF. It is often useful to keep a copy of plots made with SAC, just remember to change the device back to XWINDOWS to see plots on your screen:

SAC> BD X

SAC> P

1.5 More Functions

The FUNCGEN command can generate a number of different functions. This is very useful when first learning how to use SAC because you can see how the other SAC operations work on these functions. For example, type:

SAC> FG SEISMOGRAM

SAC> P

This generates a sample seismic signal in SAC's memory. It also deletes the impulse generated earlier. The PLOT command allows you to see this seismogram on your screen. Now for another function:

SAC> FG SINE 2 NPTS 200 DELTA 0.01

SAC> P

This is an example of a more complicated SAC command. This example generates a sine wave with a 2 Hz frequency in SAC's memory. The function will contain 200 data points and have a sampling interval of 0.01 seconds.

SAC Commands

There are several general points to be made at this point about SAC commands. All input is space delimited. The decimal point is optional wherever numeric input is needed. When you specify a value for a particular option, this value becomes the new current value. This means you don't have to keep entering values for options that you don't want to change. For example, you can now generate this same 2 Hz sine wave using the same sampling interval but with 400 data points by simply typing:

SAC> FG NPTS 400

SAC commands fall into two main categories: parameter-setting and action-producing. The parameter-setting commands basically change values of internal SAC parameters. Action-producing commands perform some operation on the data files currently in memory based upon the values of these same parameters. The effect of a parameter-setting command remains in effect until it is reset. The effect of an action-producing command, however, is immediate and transitory. For example, the parameter-setting command, YLOG, tells SAC to use logarithmic interpolation for the y axis in subsequent plots. The action-producing command, PLOT, does the actual plotting. Options to action-producing commands also remain in effect until reset just like parameter-setting commands. The underlying assumption is that you are likely to want to use the same values the next time you execute the same command.

Summary

sac Seismic Analysis Code, interactive program for studying time-series data
FUNCGEN Generates a function and stores it in memory.
BEGINDEVICES Begins plotting to one or more graphics devices.
PLOT Generates a single-trace single-window plot.

 

brudzimr@muohio.edu, 19th June 2007