Signal processing in SAC - Crystal-to

2-­‐2 i. 
Basic trace opera-ons and resampling ii. 
Trace rota-ons iii.  Frequency domain opera-ons and filtering Pre-­‐processing •  Seismic data is rarely recorded in a form where it is directly (sensibly) analysable •  Instrumental factors, long period noise, temperature varia-ons and electronic interference all leave their mark on seismic data (especially from field deployments) •  Data may be recorded at different sampling rates at different sta-ons in the network, or at unnecessarily high rates (genera-ng unprocessable amounts of data) •  Finally, ALL real data contains noise which masks, to some degree or another, the signal of interest •  This lesson is an overview of SAC’s facili-es with dealing with these annoyances Basic clean-­‐up •  There are several commands which are run as a pre-­‐
processing step before most other processing task •  These are de-­‐meaning and de-­‐trending data, and removing glitches like -ming chirps or tears •  This essen-ally removes noise outside the frequency range of the data •  The commands for these are: rmean, rtrend and rglitches •  They have some op-ons (especially rglitches), but are generally run well with the default for most data Example: SAC> rglitches
SAC> rtrend
Resampling data •  A common processing step is up/down sampling data •  This might be for a variety of reasons (reduce file bloat, match other data) •  Primary command for upsampling is interpolate SAC> help interpolate
SUMMARY:
Interpolates evenly or unevenly spaced data to a new sampling
rate.
SYNTAX:
INTERPOLATE {DELTA v} {EPSILON v} {BEGIN v|OFF} {NPTS n|OFF}
•  This uses ‘Wiggins’ interpola-on (Wiggins, BSSA, 1976) •  Easiest is to specify a new DELTA •  Note that this can turn unevenly spaced data into evenly spaced (thus allowing spectral analysis, for example) Resampling data •  Upsampling SAC> interp delta 2
SAC> interp delta 0.05
•  Note that no new informa-on is gained: an upsampled trace is just a smoother version with more points Downsampling data •  Unlike upsampling, downsampling can introduce ar-facts, through aliasing •  This can be mi-gated by pre-­‐filtering the data to the target bandwidth before resampling (an(-­‐aliasing) •  This is done by the command decimate •  Decimate can reduce the sampling by a factor n between 2-­‐7 •  Other factors can be achieved by chaining decimate commands SAC> help decimate
SUMMARY:
Decimates (downsamples) data, including an optional anti-aliasing FIR filter.
SYNTAX:
DECIMATE {n} {FILTER {ON|OFF}}
Resampling data •  Example: decima-ng data SAC> r example.sac
SAC> lh delta npts b e
FILE: example.sac
----------------delta = 0.10E-01
npts = 4096
b = 0.0
e = 40.950
SAC> decimate 2; decimate 5
SAC> lh delta npts b e
FILE: example.sac
----------------delta = 0.10
npts = 410
b = 0.0
e = 40.90
2-­‐2 i. 
Basic trace opera-ons and resampling ii.  Trace rota-ons iii.  Frequency domain opera-ons and filtering Rota-ons •  Some-mes, seismograms are not recorded in the orienta-on most convenient to a par-cular processing method; either by accident or design •  However, with 3-­‐component sensors we (theore-cally) record full vector displacement •  Any 3 orthogonal components can be rotated to form any other 3 with no loss of informa-on; this is equivalent to a frame of reference rota-on Radial – Transverse reference frame •  A common rota-on in global seismology is to rotate horizontal components to radial-­‐transverse reference frame •  The radial direc-on is in the direc-on of the great circle path between the earthquake and sta-on; transverse (or tangen(al) is perpendicular to that •  This separates the SH wavefield from the (coupled) P-­‐SV wavefield, making interpreta-on of S-­‐phases easier Rota-ons in SAC •  Command to rotate SAC traces is rotate SAC> help rotate
SUMMARY:
Rotates a pair of data components through an angle.
SYNTAX:
ROTATE {TO GCP | TO v | THROUGH v} {NORMAL|REVERSED}
•  Only 2D rota-ons are available in SAC (but these can be chained together) •  Rotate operates on pairs of traces, these must be the same length, and have the same sample rate •  There are two kinds of rota-on … Rotate THROUGH •  With the through op-on, either 2 horizontal traces, or 1 horizontal and 1 ver-cal are rotated through X degrees clockwise from their current orienta-on •  Rota-ons require the cmpinc and cmpaz headers to be set (and modify them) SAC> r SWAV.BHZ SWAV.BHR
SAC> lh cmpinc
FILE: SWAV.BHZ
-------------cmpinc = 0.0
FILE: SWAV.BHR
-------------cmpinc = 90.0
SAC> rotate through 30
SAC> lh cmpinc
FILE: SWAV.BHZ
-------------cmpinc = 30.0
FILE: SWAV.BHR
-------------cmpinc = 120.0
DEMO
Rotate TO •  With the to op-on, horizontal traces (only) are rotated to a specified azimuth (degrees c’wise from North) … SAC> rotate to 45
•  or to the great circle path azimuth SAC> rotate to gcp
•  This generates the radial-­‐transverse components DEMO
2-­‐2 i. 
Basic trace opera-ons and resampling ii. 
Trace rota-ons iii.  Frequency domain opera-ons and filtering Frequency domain for seismology • 
Fourier analysis represents a uniformly sampled signal as a weighted summa-on of sine-­‐
waves of different frequencies and phases (i.e., delays) • 
Any signal, however complex (such as a seismic wave) can be perfectly represented by such a summa-on • 
The set of coefficients which describe the amplitudes and phases of the sine waves at each frequency is called the frequency domain • 
A -me variant signal like a seismic trace can, in principle, be transferred to and from the frequency domain losslessly • 
Many opera-ons which are complex or impossible in the -me domain become trivial in the frequency domain Amplitude spectra •  The frequency domain representa-on of a signal can be used to iden-fy dominant frequencies in a seismic trace; these might be signal, noise or both Fast Fourier Transforms •  The Fast-­‐Fourier Transform (FFT) allows rapid transforma-ons to (and from) the frequency domain. •  In SAC, the command fft computes the FFT of the current trace(s) in memory SAC> help fft
SUMMARY:
Performs a discrete Fourier transform.
SYNTAX:
FFT {WOMEAN|WMEAN} {RLIM|AMPH}
•  This creates a frequency domain representa-on of the traces •  The spectra can be plofed with the command plotsp SAC> help plotsp
SUMMARY:
Plots spectral data in several different formats.
SYNTAX:
PLOTSP {type} {mode}
plotsp •  By default plotsp plots the amplitude spectrum and the phase, using logarithmic scales, however ogen just interested in the amplitude spectrum: SAC> plotsp am linlin
plots the amplitude spectrum only, using linear scales for both axes Reading and wri-ng spectral files •  Once FFT has been run on a trace, it is converted to a SAC spectral file. This can be saved and read using the normal SAC read/write commands. •  However, the amplitude or phase part of a spectral file can also be wrifen out as a normal SAC file, using the writesp command: SAC> writesp myfile.sac
•  will write out two normal SAC files, one called myfile.sac.AM containing the amplitude data, and one called myfile.sac.PH containing the phase data •  This can be useful for handling or plohng spectral data in a way not normally allowed in SAC •  The readsp command can be used to create a spectral file from two normal SAC files Filtering •  If, using spectral analysis, we can determine what frequencies present in our seismogram represent noise, and which signal, we can filter out unwanted frequencies to improve our observa-on of the phases we are interested in. •  Filtering covers a very broad range of theory and methodology •  Filtering involves convolving a filter spectrum with the seismogram spectrum •  SAC has implements several filter spectra – most commonly employed is the Buferworth filter: where f is frequency, fc is the cut-­‐off frequency, and np is the number of poles (essen-ally the sharpness of the cut-­‐off) Example: 2-­‐pole low-­‐pass Buferworth filter Filtering in SAC •  Main filter commands in SAC are highpass, lowpass and bandpass SAC> help bandpass
SUMMARY:
Applies an IIR bandpass filter.
SYNTAX:
BANDPASS {BUTTER|BESSEL|C1|C2} {CORNERS v1 v2}
{NPOLES n} {PASSES n} {TRANBW v} {ATTEN v}
•  The filter type, corner frequencies, poles and number passes (1-­‐2)
are specified, e.g.: SAC> bp bu co 0.02 0.1 n 2 p 2
Filters the current trace(s) with a 2-­‐pole Buferworth filter, with corner frequencies at 0.02 Hz (50 seconds) and 0.1 Hz (10 seconds) Tes-ng the response func-on of a filter •  To test what the amplitude spectra of a filter looks like: SAC> funcgen impulse delta 0.05 npts 4096
SAC> bp bu co 0.02 0.1 n 2 p 2
SAC> fft
(10.6e)FFT default change: not removing the mean
DC level after DFT is 0.10802E-04
SAC> plotsp am loglin
Shortcut is the filterdesign command … SAC> fd bp bu co 5 25 n 2 p 2 delta 0.01
Note: Phase and group delays for single pass.