Seismic Waveform Tool (SWFT) Tutorial
Seismic Waveform Tool (SWFT) Tutorial
                                                                     Doyeoun Kim
                                                                    Cornell University
LLNL-SM-754520
Table of Contents
Introduction .......................................................................................................................... 5
Getting Started...................................................................................................................... 5
1.      SWFT Seismic Data Processor ......................................................................................... 7
     1.1.        Loading Data Files ..............................................................................................................7
     1.2.        Data Correlation ................................................................................................................8
     1.3.        Plotting............................................................................................................................ 11
     1.4.        Utilities ............................................................................................................................ 12
        1.4.1.      Metadata and Headers ........................................................................................................................12
        1.4.2.      Trace Segmentation .............................................................................................................................14
        1.4.3.      Merge seismograms into longer segments ..........................................................................................15
        1.4.4.      Display/Write Headers .........................................................................................................................16
        1.4.5.      Sort data ..............................................................................................................................................17
Getting Started
The SWFT code is written in Java and will work on any system with Java version 1.7.0 or higher.
SWFT has been tested at LLNL on Windows, OS-X, and SUN systems. The SWFT .jar file may be
executed by:
where “x.x” is a generic version number. If memory allocations for your platform are
insufficient, you may need to execute by adding flags:
This will open up a GUI interface from which you can read, plot and filter SAC data files.
The SWFT GUI initially contains three windows: One for plotting waveforms, a data table and a
console for typing commands.
The data table will be automatically filled. The waveforms will not be plotted on first read but
will appear once any subsequent commands are entered. (This is to prevent the program from
hanging if a very large number of files is opened.)
Commands can be typed into the bottom of the console window. "Help" will give a list of
commands that can be entered for trace processing.
These 3 windows are intended for interactive processing and visualization of data. SWFT also
has several additional tools that are intended for batch processing of data. These can be found
under the Tools dropdown list. These are listed below and described in the following sections.
                                            SWFT Tools
Each of these options will open a file selection GUI. Note that any non-SAC formatted files in these lists
will be ignored.
When data are organized in discreet subdirectories, users can create individual file lists using a recursive
search procedure.
File > Open > Create Recursive File List : will create a list of all files below the chosen directory.
File > Open > Create Recursive File List Processed subset: will look for files in subdirectories named
“Processed”, which are typically created during the seismic data processing stage.
File > Open > Create Recursive File List 1.XCOR subset: will look for files in cross-correlation
subdirectories named “1.XCOR”
EXAMPLE
 Load data using multiple file lists
 Figure 1.1-1. Load Multiple file lists (left) and the user will be prompted to select a text file (right).
 Figure 1.1-2. Sample of a list of data groups (left) and a file list (right).
 Note “filelist_hour0.txt” can be found at the first row of “masterlist.txt” and has the path information
 on each SAC files.
Figure 1.2-1. Load data and left-click either “Correlate processed data” or “Correlate multiple data
groups” depending on the input data structure
DESCRIPTION
 This utility allows the user to cross-correlate seismic data.
 SWFT supports three different modules:
       1) Common Events (ANC): Ambient-noise style cross-correlation. Only seismograms with
          identical evids are correlated.
       2) Common Station (VSM): Virtual seismometer style cross-correlation. Only seismograms with
          identical stations are correlated.
       3) Autocorrelation: each trace is correlated with itself.
RELATED UTILITY
 Separately Stack Multiple Data Groups
 Jointly Stack Multiple Data Groups
 Stack
EXAMPLE
 How to estimate the Green functions with ambient noise correlation.
 Note each data below were already cut into equal length timeseries SAC files.
 Example data processed below were hour-long SAC files from three 3-component seismic stations (6
hours total with KS.BUS2.BH*sac, KS.NAWB.BH*sac, and KS.SEO2.BH*sac).
 Step1. Preprocessing
 Figure 1.2-2. An example of preprocessing data (left). SWFT supports a batch process in Seismic Data
 Processor. The user can type desired SWFT commands line-by-line from the top of the red box as
 shown in the figure. Note: “signum” command is used to normalize every trace to 1. Hit “Process the
 data” to continue. The resulting traces will be saved under the automatically created folder named
 “Processed” under the data directory (right).
IMPORTANT: Batch process in SWFT using the command box does not support multiple data groups.
 Figure 1.2-3. An example of 3-component hour-long raw data (left: KS.*.BHE*sac) and after
 preprocessing (right).
Step2. Correlating with respect to common events
                  1                               3
                                                                                                2
1.Select the desired correlation method. In this example, common events and autocorrelation are
selected for ambient noise correlation
2. Select a time window for correlation. The values in the left and right boxes represent positive and
negative time-lag in seconds, respectively. In this example, full correlation was made using hour-long
traces.
3. Select either “Correlate processed data” or “Correlate multiple data groups” depending on the
required data structure.
Figure 1.2-5. The correlated traces in lag time (left). The bottom trace is an auto-correlated trace.
These resulting traces can be found under an automatically created folder name “1.XCOR” (right).
Depending on the input data structure the user can select different ways to create stacked
seismograms.
 Figure 1.2-7. Final stacked SAC files (left) and 6-hour stacks of correlated recording in Figure 1.2-5.
 Note a naming structure of the output (e.g., stacked SAC file):
 [Station].[Station].[Channel].[Channel].[num of stacks].stacked.sac
1.3. Plotting
The Plot tool under Seismic Data Processor allows the user to plot a geometric representation of
sources and receivers. “Plot Stations” and “Plot Events” will display the locations of the stations and
events from the header SAC variables in the loaded data. Note a yellow star and a black triangle indicate
a station and a recorded event, respectively.
Figure 1.3-1. Plotting stations and events to the map (left) and viewing them in zoomed-in mode (right)
Selecting “Map” from the plot displays a world map interface in a new window.
Figure 1.3-2. Using plot tools under Seismic Data Processor (left) and its display (right)
The map allows zooming-in (left-click), zooming-out (right-click) or tilting (shift + left-click).
1.4. Utilities
DESCRIPTION
 This utility allows the user to insert the source header information on latitude, longitude, elevation,
and depth with a text file.
 Input text file formats are the following:
         1) Insert site information: station, latitude, longitude, depth, elevation
         2) Insert source information: evid, latitude, longitude, depth, elevation
RELATED UTILITY
 Insert site information
 Insert reference point information
EXAMPLE
 How to insert the source header information with a text file
 lh
 :
 evdp: 0.0
 evel: 0.0
 evla: 0.0
 evlo: 0.0
 nevid: 1603710
 :
 edit sample_srinsert.txt
 Figure 1.4.1-2. The user will be prompted to open a text file (left) and an example text file of the
 source header information is shown (right). Note the “null” column (i.e., elevation) is typically
 undefined in case of inserting source information.
 lh
 :
 evdp: 0.8
 evel: 0.0
 evla: 43.727667
 evlo: -121.307667
 nevid: 1603710
 :
 Console> lh 
 Console> edit event.lonlatdepth.txt 
 Console> lh 
Figure 1.4.2-1. Load data (left) then select cut traces to hour-long segments in the drop-down menu
(right)
DESCRIPTION
 This utility allows the user to cut long SAC traces (e.g., a day-long trace) into separate hour-long files.
 The resulting hour-long files are saved under a series of automatically created directories under the
current parent directory.
RELATED UTILITY
 cut very long SAC trace into separate day-long segments
EXAMPLE
 How to cut day-long seismograms into hourly segmented traces
 Figure 1.4.2-2. Directory structures of before (left) and after (right) of cutting a series of day-long SAC
 trace into separate hour-long segments.
 Figure 1.4.2-3. Before (left) and after (right) of cutting a series of day-long SAC trace into separate
 hour-long segments. Note after using this utility in SWFT Seismic Data Processor, the segmented files
 will be saved under the automatically generated directories (e.g., year> day> hour).
Figure 1.4.3-1. Load data (left) then select merge seismograms in the drop-down menu (right).
DESCRIPTION
 This utility allows the user to merge short SAC traces (e.g., an hour-long trace) into a longer segment
 The resulting hour-long files are saved under an automatically created directory named
“MERGED_SEISMOGRAMS” inside the current working directory
RELATED UTILITY
 separately merge multiple data groups into longer segments
EXAMPLE
 How to merge hour-long seismograms into a daily trace
                           1
                           2
                           3
                                       1+2
                     2+3
 Figure 1.4.3-2. Before (red) and after (blue) of merging short SAC traces into longer segments (left).
 Note this utility will only effective when the begin and end time of the short SAC traces correspond to
 one another (e.g., 1+2 vs. 2+3, blue traces). The merged trace will be saved under an automatically
 created folder named “MERGED_SEISMOGRAM”.
Figure 1.4.4-1. Load data (left) then select list station lat, lon, elev, depth in the drop-down menu (right)
DESCRIPTION
 This utility allows the user to write the station header information on latitude, longitude, elevation,
and depth into a separate text file.
RELATED UTILITY
 List event lat, lon, and depth
 List reference point lat, lon, elev, and depth
 List station and event lat, and lon
 List distance and azimuth
EXAMPLE
 How to write the stations header information into a separate text file
 lh
 :
 200603701.IU.INCN.BHE.UNK.sac
 200603701.IU.INCN.BHN.UNK.sac
 200603701.IU.INCN.BHZ.UNK.sac
 station.lonlatdepth.txt
 :
 edit station.lonlatdepth.txt
 Figure 1.4.4-2. The user will be prompted to write the list into a file (left) and once the file has saved,
 use “edit” command to check if correct information is written.
 Console> lh 
 Console> edit station.lonlatdepth.txt 
Figure 1.4.5-1. Load data (left) then select sort data into separate evid subdirectories in the drop-down
menu (right).
DESCRIPTION
 This utility allows the user to organize all of SAC files based on their “evid” and separate them into the
corresponding automatically created subdirectories.
EXAMPLE
 How to sort multiple SAC files with different “evids”
 Figure 2-20. Before (left) and after (right) sorting data. Note newly created directories named after
 the “evids”.
Figure 1.4.6-1. Load data (left) then select cut event segments given a list of evids in the drop-down
menu (right).
DESCRIPTION
 This utility allows the user to cut data into segments given a text file that has list of “evids” and other
header information (e.g., origin time, lat, lon, etc.)
EXAMPLE
 How to cut an hour-long SAC files into five event segment files given a list of “evids”
Figure 1.4.6-3. After inputting the “evid” list the user will be prompted to select or create a directory
to place the segmented data (left). Note the automatically created five directories given a list of five
events (i.e., evid=1~5) (right).
Figure 1.4.6-4. The raw hour-long SAC data (red) and the five segmented events of the given orgintime
(blue).
Console> profile 1 
Console> align b 
2. Regional Body-Wave Amplitude Processor
SWFT supports amplitude measurements of regional phases (e.g., Pn, Pg, Sn, Lg, and Noise) for
given frequency windows. The obtained amplitude measurements can later be used for e.g.,
Magnitude and Distance Amplitude Correction (MDAC). The following example provides step-
by-step instructions.
Step 1. Input data and relevant parameters (e.g., velocity model and frequency bands).
 Figure 2-1. Load data, velocity file, and frequency window file in Amplitude Measurement Tool to
 measure amplitudes for given phases in each frequency band (click on Open Data Files, Open a
 Velocity File, and Open Frequency Window File in red boxes to load each data file) (left).
 Note the five phases and the six different frequency ranges are given for this specific exercise as
 shown in Figure 2-2. When the input files are correctly loaded, those parameters will be populated to
 the corresponding sub-window under its field IDs (e.g., velocity file – Phase, Group Velocity 1, Group
 Velocity 2, Intercept 1, Intercept 2, and Include; frequency window file – Lowpass and Highpass
 frequency) (right, Figure 2-1).
 Figure 2-2. Examples of the velocity (e.g., velmodel.DEFAULT.txt) and frequency window files (e.g.,
 bpFilters.txt).
 IMPORTANT: Check or uncheck “Required Defined Picks” (red box, Figure 5-3).
 1) Checked – amplitudes will be measured based on the time windows of each phase defined by the
 given velocity file (picks shown in gray, right, Figure 2-3)
 2) Unchecked – amplitudes will be measured based on the time windows of each phase defined by the
 user picks (picks shown in red, right, Figure 2-4)
Figure 2-3. Measuring amplitudes based on the input group velocities. After unchecking “Require
Defined Picks”, click on “Measure Amplitudes” (i.e., lower red box) to calculate amplitudes (left).
Note gray lines indicate phase picks based on the input group velocities (right).
Figure 2-4. Measuring amplitudes based on the user’s phase-picks made. After checking “Require
Defined Picks”, click on “Measure Amplitudes” (i.e., lower red box) to calculate amplitudes (left).
Note red lines indicate manual picks made by the user (right).
The result of the measure Amplitudes will be saved under “Measured.amplitude” under the current
working directory. Figure 2-5 shows an example of output file:
Figure 2-5. An example of output file using the SWFT Amplitude Measurement module.
3. Phase picker
 EXAMPLE
 Figure 3-1. Before (left) and after (right) of using the list of commands in Console window.
 Note the list of commands used in this example is optional.
 Console> ch ref o 
 Console> align o 
 Console> picks on
 Console> rmean
 Console> rtrend 
 Console> bp 0.5 5 
 Console> profile 3 
 Console> taper 0.05 
Phase picker allows the user to manually set phase arrival times. On selecting Phase Picker
from the Tools list a new window appears titled "Seismogram Phase Picker" (left, Figure 6-1).
With the mouse, a user can zoom in or out.
Figure 3.1-1. The Seismogram Phase Picker popup window (left) and a P wave pick (type “P” in keyboard
and left click on the mouse) made in the zoom-in of z-component seismogram window (right).
In order to make a pick in the Seismogram Phase Picker, typing the following commands will
switch out of zoom mode into picking mode:
                      Input          Picks
                        P:           P
                        S:           S
                        1:           Pn
                        2:           Pg
                        3:           Sn
                        4:           Lg
                        F:           F
                        A:           A
                     ESC or Z:       Escape picking and return to zoom
Picks are made by placing the mouse on the trace and left-clicking. A red marker line will appear
with the phase name label included. Picks can be moved by left-click-dragging the marker.
 picking phase: P
 P        34.28782
 :
 kt0: P                            %each picked phase will appear in the header “kt#” (e.g. kt0 – kt5)
 :
 t0: 34.28782                      %the pick time for “kt#” will appear in the header “t#” (e.g. t0 – t5)
 Figure 3.1-2. The data display in the Waveforms window after a P wave pick made by the Seismogram
 Phase Picker in Figure 2. Note a green line indicates the pick made.
 Console> lh 
Phase Picker also supports bandpass filter panels. To use “Filters” in the menu bar, a separate
text file that contains desired bandpass frequencies is required as an input file. An example of
input text file for filters is the following:
bpFilters.txt:
                         0.5           1.0
                         1.0           10.0
                         0.1           5.0
                         1.0           12.0
                         0.5           5.0
                         1.0           2.0
To input the filter list, choose “Open file list” under “File” in the menu bar (Figure 4).
File> Open Filter List will open a popup window for a filter parameters file selection.
Once an input list is loaded into the Seismogram Phase Picker Filters option can be accessed
and the user can simply select each bandpass filter from the drop-down list (Figure 4).
 edit bpFilters.txt            % modify the filter text file using preferred text editor
 Figure 3.1-3. An example of using a filter from the drop-down list.
 Console> edit bpFilters.txt 
To clear all the picks made use the picker menu bar (Figure 3.1-4).
File> Clear> Picks: will clear all of the previous picks made
Note that clearing picks will also clear the picks in the headers.
Figure 3.1-4. Multiple picks made in Seismogram Phase Picker (left) and the usage of clearing picks
(right).
           File> Save> Selected Picks: will save only those picks for traces currently plotted
           File> Save> All Picks: will save the picks made for the data in the data table.
Saving from the picker window will only place the picks in the header. It will not change the
original waveform.
The user can also use the “save” command in the console window after picks are made;
however any modifications to the trace will also be saved.
To export the picks to a text file, use the picker menu bar.
         File> Export> Selected Picks: will write only picks for selected traces.
         File> Export> All Picks: will write all the picks made for the data in the data table.
The user will be prompted to create a file to write the picks into.
Note: It is preferable to use the horizontal components of seismic data for high signal-to-noise
ratio of S-waves. The fundamental procedure for coda amplitude measurement is described in
more detail in Mayeda et al., (2003). The following are the measurement steps:
   1)    Preprocess the data (i.e., remove instrument response, remove bad seismograms)
   2)    Calculate narrow band seismic envelopes
   3)    Stack (or average) the two horizontal components
   4)    Measure spectral amplitudes
   5)    Calculate average Mw
   6)    Display spectra on the map
In coda method, empirical synthetic envelopes are calculated based on a simple analytic
expression that is used to fit the observed narrowband envelopes. The coda amplitude at time t
with a given distance r and a frequency band f is represented by the following:
                                              𝑟          𝑟   −(𝑟)                  𝑟
        𝐴𝑐𝑜𝑑𝑎 (𝑡, 𝑟)𝑓 = 𝑊𝑓 𝑆𝑓 𝑇𝑓 𝑃(𝑟)𝑓 𝐻(𝑡 − 𝑣(𝑟)) (𝑡 − 𝑣(𝑟))        exp [𝑏(𝑟)(𝑡 − 𝑣(𝑟))]    (1)
Step 1 Preprocessing
The first step is to remove the instrument response from the two horizontal component
waveforms.
 Figure 4-1. Load data (e.g., horizontal components) and use SWFT commands in Seismic Data
 Processor for preprocessing (click on Process the data, i.e. red box to batch process each data). Here
 resp file is used for deconvolving instrument response. Note the raw seismic signals are bandpass
 filtered for stable deconvolution for low frequencies.
 IMPORTANT:
 1) Set “plot off” (red box) before loading a large dataset in the main Waveforms window to prevent
 becoming memory intensive. Once all the data is loaded in the Data Table window, the user can
 “deselect all” then manually check a subset of events for quality checking.
 2) The “nevid” and “knetwk” headears are required for coda amplitude measurement.
 e.g.,“ch nevid hour” under Seismic Data Processor will create an event ID for each seismogram based
 on the origin or the reference time with format YYDDDHHMM (Year, Julian day, Hour, Minute).
For each component, the narrow band envelopes are calculated by performing a Hilbert
transform at each frequency band. For example, the seismic envelope for a given frequency
bandwidth, 0.1 – 0.2 Hz, is of the following form:
 Figure 4-2. Load data in Coda Tool and a coda parameter file (click on Open a Coda Param File in red box)
 and in “Mdac Parameters” tab open MDAC PS File (mdac_ps_params.txt) and MDAC FI File
 (mdac_fi_params.txt). They are provided with SWFT package. MDAC files are used to create theoretical
 source spectra to fit to calculate Mw and stress drop. If MDAC is not selected lowest two frequency bands
 will be used to estimate the average Mw.
 In total, the coda parameter file includes 11 parameter (there is no limit in the number of
 frequency bands, user is flexible to use preferred range and pass-band) fields for each
 frequency band (see the first row in Figure 4-2). This file can be used for any frequency range
 and the band-with. First and second column of the coda parameter file are the low and high
 frequency limits of the narrow bands of interest, respectively. With the coda parameter file
 completed, the user can calculate the envelopes by selecting Execute> Calculate Data
 Envelopes in the menu bar.
 Figure 4-3. An example of the coda parameter file. Note red box has low and high frequency limits for the
 coda envelope calculation.
Figure 4-4. Select the desired directory for the envelopes (left) and spectra calculation (right)
In this step, if magnitude is going to be calculated from S-waves two horizontal envelopes (N-S
and E-W) will be stacked then smoothed. Note that SWFT will check headers of SAC files and
parse the envelope file (e.g. kcmpnm, kstnm, nevid)
 To stack and smooth the envelopes select Execute> Stack Horizontal Envelopes from the
 Coda Tool menu bar.
 Figure 4-5. Stacked coda envelopes for each narrow-frequency band.
Prior to proceeding any further, it is recommended to check the window length of each of the
frequency bands. SWFT has a default length for each narrow band however this may need to
change depending on the dataset you are processing. The min and max lengths in Figure 4-6
define a coda window that will be used in case the user wishes to perform automatic picks in
step 4.
 Figure 4-6. Check the Frequency Band Windows under Execute. When the frequency band window is
 selected the user will be prompted with a default window length table. Note any text file can replace
 the default table.
Execute>Calculate Synthetics
5.1. dir
Return to working directory
USAGE
dir
pwd
EXAMPLE
 dir
 /Users/Downloads/Coda_SWFT/Example_data
 Console> dir 
5.2. cd
Change directory
USAGE
cd [directory]
EXAMPLE
 How to change the current working directory to its parent directory.
 How to change the current working directory to a specific directory
 cd ..
 /Users/Downloads/Coda_SWFT
 cd /Users/Downloads/Coda_SWFT/Example_data
 /Users/Downloads/Coda_SWFT/Example_data
 Console> cd .. 
 Console> cd /Users/Downloads/Coda_SWFT/Example_data 
5.3. ls
List directory contents
USAGE
ls
EXAMPLE
 How to see all of data in the current directory
 ls
 AFIF.BHE.1995352034511
 AFIF.BHE.1995362182332
 
 Console> ls 
5.4. find
Find file
USAGE
find [filestring]
 This command is used to find files matching the [filestring] search criteria in or below the working
directory.
 SWFT does not support wildcard characters (e.g. find AFIF.BH?.*).
EXAMPLE
 Find file with the filename AFIF.BHE.1995342034511
  find AFIF.BHE.1995342034511
  /Users/Downloads/Coda_SWFT/Example_data/AFIF.BHE.1995352034511
  Console> find AFIF.BHE.1995342034511 
5.5. edit
Open a text editor with the desired file.
USAGE
edit [filename]
EXAMPLE
 Edit list of bandpass filters
 cd ..
 /Users/Downloads/Coda_SWFT
 edit bpFilters.txt
5.6. help
List SWFT commands with descriptions.
USAGE
help
 SWFT does not support individual help sub-commands (e.g. help [command] or [command] help).
EXAMPLE
 help
 b        usage: b        get the begin time in seconds relative to the SAC reference time
 ch       usage: ch (variable) (value)     change the sac header variables
 date     usage: date     get the date of the origin time
 
 Console> help 
5.7. save
Save seismogram
USAGE
save | save all | save selected
 This command is used to save changes made to seismogram and overwrites to the original file.
 SWFT does not support save command with unselected data (e.g. save unselected).
EXAMPLE
 Save seismogram after several processing commands
 The resulting seismogram will be permanently detrended, band-passed, cosine tapered, and saved to
the original file.
 rtrend
 bp 0.5 5
 taper 0.05
 save
 Console> rtrend 
 Console> bp 0.5 5 
 Console> save 
5.8. writeascii
Write seismograms into an ascii file
USAGE
writeascii [filename]
 This command is used to write all traces to a designated ascii file.
 The resulting ascii file will be saved under current directory.
 SWFT does not support “writeascii” command with selected or unselected data (e.g., plot checkbox
does not work with this command).
EXAMPLE
 writeascii example_data.txt
 /Users/Downloads/Coda_SWFT/Example_data/../example_data.txt written
 Console> writeascii example_data.txt 
5.9. clear
Remove seismogram
USAGE
clear | clear all | clear selected | clear unselected
 This command is used to remove all or selected/unselected seismograms.
EXAMPLE
 Remove the selected seismogram from the group
 Unselected seismograms will be no longer in the Data Table window
 clear unselected
 Console> clear unselected 
5.10. color
Change color display of seismogram
USAGE
color [color] | color [R] [G] [B]
 This command changes the color display of a seismogram in the Waveform window.
 Available color built-in options are:
green, blue, black, cyan, dark, gray, light, magenta, orange, pink, white, yellow, lime, silver, maroon,
purple, teal, navy, brown, crimson, coral, gold, khaki, indigo, midnight, seagreen, palegreen, beige, tan,
sienna, sandybrown.
EXAMPLE
 How to change selected seismograms to red color display
 Same result can be achieved by typing “color red”
 color 255 0 0
 Console> color 255 0 0 
5.11. select
Select data
USAGE
select [all] | select [variable statement] | deselect [all] | deselect [variable statement]
 This command is used to select seismograms from the data list.
 Once selection is made the plot check box will be checked.
EXAMPLE
 How to select seismograms with red color display
 How to select seismograms that have larger offset than 300 km
 select color red
 select distance > 300
 Console> select color red 
 Console> select distance > 300 
Plotting Support Commands
5.12. autoplot
Switch automatic plotting of seismograms “on” or “off”
USAGE
autoplot on | autoplot off
 Note set “autoplot off” before loading a large data set to prevent memory intensive redrawing.
EXAMPLE
 Any changes made to seismogram will in Waveforms window
 autoplot off
 Console> autoplot off 
5.13. plot
Redraw the seismograms. Used when autoplot is switched to “off”
USAGE
plot
5.14. picks
Display picks
USAGE
picks on | pick off
 This command is used to turn the pick display on or off to seismogram in Waveforms window.
 Default in SWFT is picks “off”.
 See “Seismogram Phase Picker” under “Tools” to make picks to seismogram.
EXAMPLE
 How to plot the picks already made to seismogram
 picks
5.15. align
Align seismogram
USAGE
align | align off | align [type]
 This command is used to align the time axis for plots.
 Available [type]s:
b, e, o, ref, 0 or SAC defined header values related to pick times (e.g., t0, t1,  t9).
 Note the default for this command is to put origin at zero sec, equivalent to “align o”. If origin time is
undefined the header lddate values are plotted at zero.
EXAMPLE
 How to align seismogram with respect to the origin time
 Commands below will set SWFT reference time = event origin time
 ch ref o
 align
5.16. profile
Plot seismograms in profile mode
USAGE
profile [value] | profile off | profile distance
 This command is used to plot multiple seismogram in profile mode.
 Note using this command with [value] will scale each trace -1 to 1 and plot [value] units above
previous trace.
 The y-axis in Waveforms windows will change to distance ([value] unit) after using the command.
EXAMPLE
 How to plot multiple traces by source-receiver offset
 ch ref o
 rmean
 rtrend
 bp 0.5 5
 align o
 taper 0.05
 scale 10
 profile distance
 waveform:AFIF.BHE.1996076201833
 ---------
 evlo: 50.985
 Console> lh evlo 
5.18. ch
Change header
USAGE
ch [variable] [variable or value]
 This command is used to change the SAC header variables.
 Use “lh” command to see the precise header names.
EXAMPLE
 1) How to set SWFT referencetime = origintime
IMPORTANT: Most of time-related commands in SWFT are subjected to the SAC reference time
 ch ref o
 Console> ch ref o 
 2) How to set nevid
 ch nevid 12345     %will change event ID to the number 12345
 ch nevid day       %will create event ID for each seismogram based on the origin or the reference time with
                    %format YYYYDDD (year, jdate)
 ch nevid hour      %will create event ID for each seismogram based on the origin or the reference time with
                    %format YYDDDHH (year, jdate, hour)
 Console> ch nevid 12345 
 Console> ch nevid day 
 Console> ch nevid hour 
5.19. b
Return begin time of seismogram
USAGE
b
 This command is used to get the begin time in seconds relative to the SWFT reference time.
EXAMPLE
 How to return begin time of seismogram
 b
 -75.778999
 Console> b 
5.20. e
Return end time of seismogram
USAGE
e
 This command is used to get the end time in seconds relative to the SWFT reference time.
EXAMPLE
 How to return end time of seismogram
 e
 1031.371001
 Console> e 
5.21. o
Return origin time of an event
USAGE
o
 This command is used to get the origin time of an event in seconds relative to the SWFT reference
time.
EXAMPLE
 How to return origin time of an event from seismogram
 ch ref o
 o
 0.0
5.22. date
Return date of origin time
USAGE
date
EXAMPLE
 How to return date of origin time
 date
 1996    76       20:18:33:90 0.0
 Console> date o 
5.23. gv
Save group velocity picks
USAGE
gv (time-pick variable) (group velocity) | gv (time pick variable) (group velocity) (intercept)
 This command is used to make a time-pick based on a given group velocity and save the pick under a
given time-pick variable.
 Note previous picks made and its corresponding time-pick variable before using.
 Variable = distance / group velocity or Variable = distance / group velocity + intercept.
EXAMPLE
 How to make a pick group velocity of 3.5km/s
 gv t0 3.5
 lh t0
 waveform:AFIF.BHN.1995365115639
 ---------
 t0: 315.19534
 Console> gv t0 3.5 
 Console>lh t0 
5.24. dt
Return sampling rate of seismogram
USAGE
dt
EXAMPLE
 How to return the sampling rate of seismogram
 dt
 0.025
 Console> dt 
5.25. clearpicks
Remove all picks
USAGE
clearpicks
 All of the pick-time variables will be removed.
 Note this command works in both the Waveform and Phase Picker windows.
EXAMPLE
 How to return the sampling rate of seismogram
 clearpicks
 Note: before and after of using clearpicks command in Waveforms and Seismogram Phase Picker
 window (see under Tools> Phase Picker)
 Console> clearpicks 
5.26. reckon
Calculate the point located a certain distance and azimuth from a reference lat, lon
USAGE
reckon [lat] [lon] [distance (km)] [azimuth (deg)]
 This command requires [lat] [lon] for an input location and degrees for distance.
EXAMPLE
 How to return lat/lon of a location in SW Montana from LLNL
 reckon 37.7 -121.7 10 40
 45.0308073076689         -112.61277508635521
 Console> reckon 37.7 -121.7 10 40 
5.27. distaz
Return distance and backazimuth
USAGE
distaz | distaz [lat1] [lon1] [lat2] [lon2]
 “distaz” return the distance and azimuth for each seismogram when event and station latitudes and
longitudes are defined.
 “distaz [lat1] [lon1] [lat2] [lon2]” calculates the distance and azimuth between two input points.
EXAMPLE
 How to return the distance and backazimuth of an event from seismogram
 How to calculate the distance and azimuth of LLNL and SW Montana
 distaz
 distance:         1103.1837 (km) azimuth:        239.38202       baz:    55.19277
 distaz 37.7 -121.7 45 -112.6
 distance: 1110.9195366032247 (km) azimuth: 40.27188713541412
 Console> distaz 
 Console> distaz 37.7 -121.7 45 -112.6 
5.28. refdistaz
Return distance from reference point
USAGE
refdistaz
 Note a reference point location should be already saved under correct SAC header variables.
EXAMPLE
 ch reflat 22.931
 ch relon 42.04
 ch refdepth 0
 refdistaz
 null      AFIF    4759   -12345.0            -12345.0     -12345.0        -12345.0       511.281999
           0.017863101544382996
 Note the last two numeric values are distances from the source and the receiver to the reference point,
 respectively.
 Console> ch reflat 22.931 
 Console> ch reflon 42.04 
 Console> ch refdepth 0 
 Console> refdistaz 
5.29. track
Return distance and backazimuth
USAGE
track [lat1] [lon1] [lat2] [lon2] [npt]
 This command is used to list [npt]-1 points along a path connecting two input locations ((lat1, lon1) to
(lat2, lon2)).
 This command results in equidistant locations along the path.
 Note the last return point is the 2nd input location.
EXAMPLE
 How to return three locations between LLNL and SW Montana
 rack 37.7 -121.7 45 -112.6 4
 point latitude longitude
 0        37.7     -121.7
 1        39.590599345741964         -119.61026132469735
 2        41.44092935374513          -117.40501600217493
 3        43.24595577763569          -115.07244395973075
 4        44.99999999999999          -112.6
5.30. min
Return minimum value of all selected traces
USAGE
min
EXAMPLE
 How to return the minimum counts value from seismogram
 min
 trace(0):        -1470.0771
5.31. max
Return maximum value of all selected traces
USAGE
max
EXAMPLE
 How to return the maximum counts value from seismogram
 max
 trace(0):        1172.9663
5.32. extremum
Return extremum value of all selected traces
USAGE
extremum
 Returns max if abs(max)>abs(min) else min.
EXAMPLE
 How to return the extremum from seismogram
 min
 trace(0):        -1470.0771
 max
 trace(0):        1172.9663
 extremum
 trace(0):        AFIF   null   BHE     -1470.0771
5.35. median
Return median value for each seismogram
USAGE
median
EXAMPLE
 How to return the median counts value of seismogram
 median
 trace(0):       2.6190170319750905E-4
 Console> median 
5.36. variance
Return variance value for each seismogram
USAGE
variance
EXAMPLE
 How to return the variance counts value of seismogram
 variance
 trace(0):        11663.52981048696
 Console> variance 
5.37. rms
Return rms value for each seismogram
USAGE
rms
 This command is used to calculate Root Mean Square (RMS) for each seismogram.
EXAMPLE
 rms
 trace(0):      107.99782317476107
 Console> rms 
5.38. rmsfit
Return rmsfit value for each seismogram
USAGE
rmsfit
 RMS fit =
EXAMPLE
 rms
 trace(0):          107.99782317476107
 trace(1):          49.1000277133784
 rmsfit
 rmsfit trace(0).trace(1): 2.5217784938807757
 Console> rms 
 Console> rms fit 
5.39. p2p
Return maximum-to-minimum difference
USAGE
p2p [period]
 This command is used to calculate the peak to peak amplitude for each seismogram.
 This command requires an input period for peak to peak calculation.
EXAMPLE
 How to calculate maximum-to-minimum difference of T=500 sec signal for seismogram
 p2p 500
 seislist: 1P2P amplitude: 0       8376.283203125
 Note the black, blue, and red traces indicate raw, bp 0.001 0.01, and bp 0.01 0.1 of the same
 seismogram, respectively. “p2p” command was applied to the blue trace.
 Console> p2p 500 
 Console> rms fit 
5.40. skewness
Return skewness
USAGE
skewness
 This command is used to calculate the skewness for each data point to the mean amplitude (e.g., y-
axis) for each seismogram.
 Skewness is one way to measure of the asymmetry of the probability distribution of time series about
its mean.
 Skewness =
 If (skewness > 0) then mean > median > mode, else mean < median < mode.
EXAMPLE
 How to calculate skewness of seismogram to its mean amplitude
 skewness
 trace(0):      -0.6233743575451767
 Console> skewness 
5.41. skewness’
Return skewness’
USAGE
skewness’
 This command is used to calculate the skewness for each data point to the reference time (e.g., x-axis)
for each seismogram.
EXAMPLE
 How to calculate skewness of seismogram to its reference time
 skewness'
 trace(0):      -0.5556520965674702
 Console> skewness’ 
5.42. kurtosis
Return the kurtosis for each seismogram
USAGE
kurtosis
 Kurtosis is one way to measure of the asymmetry of the probability distribution of time series about its
mean.
 Kurtosis =
 Normal distribution of kurtosis is 3. In case of excess kurtosis, the distribution is leptokurtic (i.e., larger
tails).
EXAMPLE
 kurtosis
 trace(0):        29.79323086192545
 Console> statistics 
5.43. statistics
Return sample statistics for each seismogram
USAGE
statistics
 Includes mean, median, RMS, variance, skewness, and kurtosis.
EXAMPLE
 statistics
 trace(index):      mean median rms        variance      skewness       kurtosis
 trace(0):          -6.926715797958528E-6 2.6190170319750905E-4 107.99782317476107
            11663.52981048696      -0.6233743575451767   29.79323086192545
 Console> statistics 
5.44. statistics’
Return statistics’
USAGE
statistics’
DESCRIPTION
 This command is used to calculate the sample statistics for each data point to the reference time (e.g.,
x-axis) for each seismogram.
EXAMPLE
 statistics’
 trace(index):     mean median rms      variance       skewness     kurtosis
 trace(0):         72875.70780073998    2.826308310758936E9 2.339711160139277E15
           5.474248312880281E30 0.12686141936789128 14.413337510487963
 Console> statistics’ 
5.45. sum
Return sum counts
USAGE
sum
EXAMPLE
 sum
 trace(0):      -0.35045025886823566
 Console> sum 
5.46. valueatindex
Return value at index
USAGE
valueatindex [int] [int] [int] …
EXAMPLE
 How to return first 3 count values in seismogram
 valueatindex 0 1 2
trace     sta    kevnm chan     0      1     2
trace(0):        AFIF  null     BHE    0.0   8.302611E-5   4.6355612E-4
5.47. abs
Take absolute value of each data point
USAGE
abs
 data[i] = abs(data[i]).
EXAMPLE
 How to take absolute value of each data point in seismogram
 abs
 Before (left) and after (right) of applying “abs” command to the seismogram.
 Console> abs 
5.48. add
Add a constant to each seismogram
USAGE
add [value]
EXAMPLE
 How to add a scalar value of 150 to seismogram
 add 150
 Before (red) and after (blue) of applying “add” command to the seismogram.
 Console> add 150 
5.49. differentiate
Differentiate seismogram
USAGE
differentiate
EXAMPLE
 differentiate
 Before (red) and after (blue) of applying “differentiate” command to the seismogram.
 Console> differentiate 
5.50. integrate
Integrate data
USAGE
integrate
EXAMPLE
integrate
 Before (red) and after (blue) of applying “integrate” command to the seismogram.
 Console> integrate
5.51. dividetrace
Divide one trace by another
USAGE
dividetrace [index]
 This command is used to divide reference trace [index] into each seismogram
EXAMPLE
 How to divide 2nd with 1st t trace
 dividetrace 0
 Before and after of applying “dividetrace” command to the seismogram (Note blue = trace[0], red =
 trace[1]).
 Console> dividetrace 0 
5.52. envelope
Compute envelope using Hilbert transform
USAGE
envelope
 This command is used to replace the seismogram with its envelope function.
 Envelope is calculated using Hilbert transform:
Envelope = where is the original signal and is its Hilbert transform.
EXAMPLE
 How to compute envelope of seismogram in frequency between 0.1 – 0.5Hz
 bp 0.8 1
 envelope
 log10
 smooth 50
5.53. fft
Performs a discrete Fourier transform on the trace
USAGE
fft
EXAMPLE
 How to plot amplitude spectra of seismogram
 rmean
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 fft
 abs
5.54. hilbert
Apply a Hilbert transform
USAGE
hilbert
 This command is used to replace the seismogram with its Hilbert transform.
 The Hilbert transform is a process which converts a real time series into its analytic signal.
 The Hilbert transform is related to the original data by 90 phase shift.
EXAMPLE
 hilbert
 Before (red) and after (blue) of applying “hilbert” command to the seismogram;
 notice the phase shift of the two signals.
 Console> hilbert 
5.55. interpolate
Interpolate to a new sampling rate
USAGE
interpolate [new sampling rate]
EXAMPLE
 How to down-sample seismogram from 40 to 10 Hz
 dt
 0.025
 interpolate 10
 dt
 0.1
 Before (left) and after (right) of applying “interpolate” command to the seismogram.
 Console> dt 
 Console> interpolate 10 
 Console> dt 
5.56. log
Take the natural logarithm of traces
USAGE
log
 data[i] = ln(data[i]).
EXAMPLE
log
 Before (left) and after (right) of applying “log” command to the seismogram.
 Console> log 
5.57. log10
Take the base 10 logarithm of traces
USAGE
log
 data[i] = log10 (data[i]).
EXAMPLE
log10
 Before (left) and after (right) of applying “log” command to the seismogram.
 Console> log10 
5.58. multiply
Multiply traces by a constant
USAGE
multiply [value]
EXAMPLE
 multiply 5
 Before (red) and after (blue) of applying “multiply” command to the seismogram.
 Console> multiply 5 
5.59. raw
Remove all processing
USAGE
raw
 This command is used to re-read the input files from disk; any changes not saved will be replaced.
EXAMPLE
 rmean
 rtrend
 normalize
 bp 0.1 5
 taper 0.05
 align o
 cut 0 1000
 picks
 raw
 Before (left) and after (right) of applying “raw” command to the seismogram.
 Note Plotting Support Commands used in this example (“align”, “cut”, and “picks”) are still applied
 after using raw command.
 Console> rmean 
 Console> rtrend 
 Console> normalize 
 Console> bp 0.1 5 
 Console> taper 0.05 
 Console> align o 
 Console> cut 0 1000 
 Console> picks 
 Console> raw 
5.60. normalize
Normalize data
USAGE
normalize | normalize [value] | normalize extremum | normalize mean | normalize max | normalize min
 This command is used to scale seismograms based on the extremum, mean, min, max or an input
numeric value.
 The default for this command is extremum.
EXAMPLE
 How to normalize the seismogram based on its max
 normalize max
 Before (red) and after (blue) of applying “normalize” command to the seismogram.
 Console> normalize max 
5.61. scale
For profile plotting purposes – scale the data to a common reference size.
USAGE
scale [value]
 This command is used to scale seismograms in profile plots. It does not change the actual values in the
traces.
5.62. power
Take a power of each data point
USAGE
power [value]
 data[i]=data[i]^[value].
EXAMPLE
 How to raise each data point of seismogram to 2
 power 2
 Before (red) and after (blue) of applying “power” command to the seismogram.
 Console> power 2 
5.63. spower
Take power of each data point and preserve original sign
USAGE
spower [value]
 This command preserves original sign of each data point as opposed to the “power” command.
EXAMPLE
 comparison of spower vs power
 power 2
 spower 2
 Note the sign preservation applying “spower” (blue) to the seismogram as opposed to “power”
 (power) command.
 Console> power 2 
 Console> spower 2 
5.64. mute
Mute data
USAGE
mute [gv1] [gv2] | mute [gv1] [inc1] [gv2] [inc2]
 This command is used to mute the data outside a designated window of group velocities [gv1] and
[gv2] and optionally intercepts [inc1] and [inc2].
 A common convention of using group velocity inputs are [high group velocity] to [low group velocity].
EXAMPLE
 How to mute seismogram outside of a window of 3.5km/s to 8km/s
 mute 8 3.5
 Before (red) and after (blue) of applying “mute” command to the seismogram.
 Console> mute 8 3.5 
5.65. rmean
Remove data mean
USAGE
rmean | removemean
 data = data – mean(data).
EXAMPLE
 How to remove data mean
 raw
 mean
 trace(0):       -6.023067215180917
 rmean
 mean
 trace(0):       -2.6967060756116722E-5
 Note the mean of the trace is close to zero after applying “rmean” command to the seismogram.
 Console> raw 
 Console> mean 
 Console> rmean 
 Console> mean 
5.66. rmedian
Remove data median
USAGE
rmedian | removemedian
 data = data – median(data).
EXAMPLE
 How to remove data median
 raw
 median
 trace(0):       -48.699995040893555
 rmedian
 median
 trace(0):       0.0
 Console> raw 
 Console> median 
 Console> rmedian 
 Console> median 
5.67. rtrend
Remove linear trend
USAGE
rtrend | removetrend
 A straight line with a least-square fit is computed then subtracted from seismogram.
EXAMPLE
 How to detrend the seismogram
 raw
 mean
 trace(0):        -6.023067215180917
 rtrend
 mean
 trace(0):        -8.284340039572914E-8
 Console> raw 
 Console> mean 
 Console> rtrend 
 Console> mean 
5.68. reverse
Reverse time series
USAGE
reverse [time variable]
 When using this command with [time variable], data reverses around defined SAC time header values
(e.g., “reverse o”).
EXAMPLE
 How to reverse seismogram
 valueatindex 0 1 2
 trace     sta     kevnm chan     0       1       2
 trace(0):         AFIF  null     BHE     547.39325      787.0934        548.73816
 reverse
 valueatindex 50593 50592 50591
 trace     sta     kevnm chan     50593   50592 50591
 trace(0):         AFIF  null     BHE     547.39325      787.0934        548.7381
5.69. signum
Perform signbit conversion
USAGE
signum
 This command is used to perform 1-bit or signbit conversion to seismogram:
signum(data[i]) = (1 or 0) to each seismogram.
EXAMPLE
 Converting a seismogram to signbit
 cut 150 200
 signum
 Before (left) and after (right) of applying “signum” command to the seismogram.
 Console> cut 150 200 
 Console> signum 
5.70. sqr
Square each data point
USAGE
sqr
 data[i] = data[i]^2
EXAMPLE
 How to square each data point in seismogram
 rtrend
 normalize
 sqr
 Before (left) and after (right) of applying “sqr” command to the seismogram.
 Console> rtrend 
 Console> normalize 
 Console> sqr 
5.71. sqrt
Take the square root of each data point
USAGE
sqrt
 data[i] = sqrt(data[i])
EXAMPLE
 How to take square root of each data point in seismogram
 rtrend
 normalize
 sqrt
5.72. stack
Perform a linear stack
USAGE
stack
 Replace the first trace with a stack of all the selected traces.
EXAMPLE
 How to perform a brute stack to multiple seismograms
 Stack
 Before (red) and after (blue) of applying “stack” command to the seismogram.
 Console> stack 
5.73. stretch
Stretch data in time
USAGE
stretch [factor]
 This command is used to stretch data by an input factor in time.
 This command is a different command from SAC “stretch” command (i.e., upsampling).
EXAMPLE
 How to stretch seismogram twice as along in time
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 cut 0 500
 stretch 2
 Before (left) and after (right) of applying “stretch” command to the seismogram.
 Console> rtrend 
 Console> normalize 
 Console> bp 0.5 5 
 Console> taper 0.05 
 Console> cut 0 500 
 Console> stretch 2 
Filtering and Basic Processing Commands
5.74. taper
Apply a symmetric taper
USAGE
taper [value]
 This command is used to apply a cosine taper of [value] % (0 – 50) to each end of seismogram.
EXAMPLE
 How to apply a cosine taper of 0.05% to each end of seismogram
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 Before (left) and after (right) of applying “taper” command to the seismogram. Note a spike is
 removed after applying tapering the seismogram.
 Console> rtrend 
 Console> normalize 
 Console> bp 0.5 5 
 Console> taper 0.05 
5.75. bp
Apply an IIR bandpass filter
USAGE
bp [low] [high] | BP [low] [high]
 This command is used to apply a 2nd order bandpass filter to seismogram.
EXAMPLE
 How to apply a bandpass filter of 0.5 – 5Hz to seismogram
 rtrend
 normalize
 bp 0.5 5
 Before and after of applying “bp 0.5 5” (i.e., bandpass 0.5 – 5 Hz) command to the seismogram.
 Console> rtrend 
 Console> normalize 
 Console> bp 0.5 5 
5.76. lp
Apply an IIR lowpass filter
USAGE
lp [pass] [cut] | LP [pass] [cut]
 This command is used to apply a 2nd order low pass filter to seismogram.
EXAMPLE
 How to apply a 0.1 Hz lowpass filter to seismogram
 rtrend
 normalize
 bp 0.01 0.1
 raw
 rtrend
 normalize
 lp 0.01 0.1
 Note the difference between applying “bp” (left) and “lp” command (right) to the same seismogram.
 Console> rtrend 
 Console> normalize 
 Console> bp 0.01 0.1 
 Console> raw 
 Console> rtrend 
 Console> normalize 
 Console> lp 0.01 0.1 
5.77. filter
Apply an IIR filter
USAGE
filter [order] [type] [low] [high]
EXAMPLE
 How to apply a 2nd order bandpass filter of 0.5 – 5Hz to seismogram
 rtrend
 normalize
 filter 2 bp 0.5 5
 Before (left) and after (right) of applying “filter” command to the seismogram.
 Console> rtrend 
 Console> normalize 
 Console> filter 2 bp 0.5 5 
5.78. acor
Compute autocorrelation function of energy
USAGE
acor
 Note the autocorrelation function of energy and the energy spectral density of seismogram are Fourier
transform pairs.
EXAMPLE
 How to compute the autocorrelation function of energy of seismogram
 rtrend
 normalize
 acor
 trace(0) energy: 50593.000024166366
 Note this command will only output the autocorrelation energy at zero-lag time.
 Console> rtrend 
 Console> normalize 
 Console> acor 
5.79. xcor
Compute correlation coefficient
USAGE
xcor [start] [end]
 This command is used to compute the correlation coefficient between the first selected seismogram
and each of the others.
 The computation will take place from [start] to [end] time in seconds.
 Correlation coefficient =
EXAMPLE
 How to compute the correlation coefficient of two seismograms
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 align
 xcor 0 1000
 normalized cross correlation between trace(0) and trace(1): 0.12466966577256697 shift:-4.25 seconds
 Note the resulting correlation coefficient may use for a measure of similarity between the two
 seismograms.
 Console> rtrend 
 Console> normalize 
 Console> bp 0.5 5 
 Console> taper 0.05 
 Console> align 
 Console> xcor 0 1000 
5.80. correlate
Compute the auto and cross correlation functions
USAGE
correlate
 This command is used to correlate all selected seismograms against the 1st seismogram.
 If the two data have different lengths, this command appends zeros at the end of the shorter time
series and commute cross correlation function for  (n-1) time-lags.
EXAMPLE
 How to compute the auto and cross correlation functions for given seismograms
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 correlate
 Before (left) and after (right) of applying “correlate” command to the seismograms.
 Note the 1st and 2nd seismogram are indicated in red and blue, respectively. Thus the resulting traces
 of using correlate command will show the autocorrelation trace of the 1st seismogram and the cross
 correlation trace of 1st vs. 2nd seismograms.
 Console> rtrend 
 Console> normalize 
 Console> filter 2 bp 0.5 5 
5.81. cut
Cut the seismogram relative to the origin time to each seismogram.
USAGE
cut [start] [end]
EXAMPLE
 How to cut the seismogram between the origin time and 500 sec afterwards
 ch ref o
 rtrend
 normalize
 bp 0.5 5
 taper 0.05
 cut 0 500
 Before (left) and after (right) of applying “cut” command to the seismogram.
 Console> ch ref o 
 Console> rtrend 
 Console> normalize 
 Console> bp 0.5 5 
 Console> taper 0.05 
 Console> cut 0 500 
5.82. despike
Despike data
USAGE
despike [threshold]
 This command is used to replace spikes and glitches in the data[i] with mean(data[i-n]).
If (data[i] – mean) > threshold  sqrt (variance), then replace with mean.
EXAMPLE
 How to despike the normalized amplitude above 2 of seismogram
 normalize
 despike 2
 cut 50 250
 Before (red) and after (blue) of applying “despike” command to the seismogram.
 Console> normalize 
 Console> despike 2 
 Console> cut 50 250 
5.83. smooth
Apply a mean smoothing to data
USAGE
smooth [n]
 This command is used to apply a [n] length of moving average window to seismogram:
data[i] = mean(data[i-n] : data[i+n]).
EXAMPLE
 How to smooth seismogram with 20 and 500 sample point moving average window
 smooth 20
 smooth 500
5.84. whiten
Perform spectral whitening on data
USAGE
whiten
 This command adds white noise to the data to flatten the spectra.
EXAMPLE
 How to perform spectral whitening on seismogram
 rtrend
 normalize
 fft
 abs
 raw
 rtrend
 normalize
 whiten
 taper 0.05
 fft
 abs
 Before (left) and after (right) of applying “whiten” command to the seismogram.
 Console> fft 
 Console> abs 
 Console> raw 
 Console> whiten 
 Console> taper 0.05 
 Console> fft 
 Console> abs 
5.85. transfer
Apply transfer function
USAGE
transfer from [resp | polezero] to [displacement | velocity | acceleration] freq [lowcut] [lowpass]
[highpass] [highcut]
 This command is used to remove instrument response from data by applying transfer function.
 This command requires either “resp” or “polezero” file; the user will be prompted to designate a
directory where instrument response file lies.
         IMPORTANT: SAC header variables (e.g. KNETWK, STA, CHN, etc.) should match with the “resp”
         or “polezero” filename
EXAMPLE
 1) How to remove instrument response with a resp file and convert voltage count to velocity
 rmean
 rtrend
 taper 0.05
 transfer from resp to velocity freq 0.01 0.02 9.0 9.5
 taper 0.05
 rtrend
 rmean
 lh
 :
 depvariabletype: velocity
 :
 Before (red in voltage counts) and after (blue in velocity) of applying “transfer” command to the
 seismogram. Note user can check with “lh” command after applying transfer function for verification
 (e.g., header: “depvariabletype”).
 Console> rmean 
 Console> rtrend 
 Console> taper 0.05 
 Console> transfer from resp to velocity freq 0.01 0.02 9.0 9.5 
 Console> taper 0.05 
 Console> rtrend 
 Console> rmean 
 Console> lh 
 2) How to remove instrument response with a “polezero” file and convert voltage count to
displacement
 rmean
 rtrend
 taper 0.05
 transfer from polezero to displacement freq 0.01 0.02 9.0 9.5
 taper 0.05
 rtrend
 rmean
 lh
 :
 depvariabletype: velocity
 :
Before (red in voltage counts) and after (blue in displacement) of applying “transfer” command to the
seismogram. Note user can check with “lh” command after applying transfer function for verification.
Console> rmean 
Console> rtrend 
Console> taper 0.05 
Console> transfer from polezero to displacement freq 0.01 0.02 9.0 9.5 
Console> taper 0.05 
Console> rtrend 
Console> rmean 
Console> lh 
References
Brune, J. N. (1970). Tectonic stress and the spectra of seismic shear waves from earthquakes.
Journal of Geophysical Research, 75(26), 4997-5009.
Mayeda, K. M., Hofstetter, A., O’Boyle, J. L., & Walter, W. R. (2003). Stable and transportable
regional magnitudes based on coda-derived moment-rate spectra. Bulletin of the Seismological
Society of America, 93(1), 224-239.
Mayeda, K. M., Malagnini, L. & Walter, W. R. (2007). A new spectral ratio method using narrow
band coda envelopes: Evidence for non-self-similarity in the Hector Mine sequence,
Geophysical Research Letters, 34, L11303.
Morasca, P., Mayeda, K., Gok, R., Phillips, W. S., & Malagnini, L. (2008). 2D coda and direct-
wave attenuation tomography in northern Italy, Bulletin of the Seismological Society of
America, 98(4), 1936-1946.
Phillips, W. S., Mayeda, K. M., & Malagnini, L. (2014). How to invert multi-band, regional phase
amplitudes for 2-D attenuation and source parameters: Tests using the USArray. Pure and
Applied Geophysics, 171(3-5), 469-484.