Time domain correlation
- cc_time: only calculate cross-correlation coefficient at the specific time window
Frequncy domain correlation
- cc_freq: Do cross-correlation using FFTW
- correlatec: Call the
crscor
function in SAC's libsac to do the cross-correlation. Please refer to Chinese SAC Documentation for more details. - sac_wfcc: This is Lupei Zhu's code downloaded from Introduction to SAC on 2020 Aug. 18.
- PCC2: This is Martin Schimmel's code downloaded from here on 2021 Feb. 22.
- ObsPy: corss_correlation
- SAC: correlate
Do correlation in time domain.
Usage:
cc_time -Ttmark/ts/te [-h] sacifle1 sacfile2
Options:
-T: tmark/begin time (sec)/end time (sec)
-h: show usage
Examples:
cc_time -T1/-3/4 seis1.sac seis2.sac
Do correlation in frequency domain.
Usage:
cc_freq -Ttmark/ts/te [-Occf] [-Wtaper] [-Acczero]
[-h] sacfile1 sacfile2
Options:
-T: tmark/begin time (sec)/end time (sec)
-O: cross-correlation function file
-W: taper (0: NO (default); 1: hanning; 2: cos)
-A: only output cross-correlation at zero lag time (0: YES; 1: NO (default))
-h: show usage
Examples:
cc_freq -T1/-3/4 seis1.sac seis2.sac
cc_freq -T1/-3/4 -A0 seis1.sac seis2.sac
cc_freq -T1/-3/4 -W1 seis1.sac seis2.sac
cc_freq -T1/-3/4 -Occf12.sac seis1.sac seis2.sac
Do correlation in frequency domain calling crscor.
Usage:
correlatec -Ttmark/ts/te [-Occf] [-Wtaper] [-Acczero]
[-h] sacfile1 sacfile2
Options:
-T: tmark/begin time (sec)/end time (sec)
-O: cross-correlation function file
-W: taper (0: NO (default); 1: hanning; 2: cos)
-A: only output cross-correlation at zero lag time (0: YES; 1: NO (default))
-h: show usage
Examples:
correlatec -T1/-3/4 seis1.sac seis2.sac
correlatec -T1/-3/4 -A0 seis1.sac seis2.sac
correlatec -T1/-3/4 -W1 seis1.sac seis2.sac
correlatec -T1/-3/4 -Occf12.sac seis1.sac seis2.sac
When we do correlation, some pre-processing may have been done, e.g., rmean
, rtrend
, taper
.
$ SAC
$ r seis.sac
$ rmean; rtrend; taper;
Some codes (e.g., cc-time
) may just use the RAW data, while some codes (e.g., cc_freq
and correlatec
) may do some processing in the running, e.g. taper
. Therefore, we have to be very careful to explain the difference between different codes if the data preprocessing is a little different. Maybe we should add those pre-processing in the code, so that we can choose whether to use it.
Be careful about reference time between different codes!!! Usually, we use the tmark (-5 -> b; -4 -> e; -3 -> 0; -2 -> a; 0-9 -> T0-9) as the reference time. But some code may add additional shift for some purpose, e.g., sac_wfcc
adds tmark to the time shift.