-
Notifications
You must be signed in to change notification settings - Fork 3
/
SAC-correlate.sh
executable file
·80 lines (70 loc) · 1.17 KB
/
SAC-correlate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#
# calculate cross-correlation using correlate in SAC:
# http://ds.iris.edu/files/sac-manual/commands/correlate.html
# https://seisman.github.io/SAC_Docs_zh/commands/correlate/
#
# NOTES:
# the final lag time (dT) is with respect to begin time, i.e.,
# dT = dt + (b(f2) - b(f1))
#
# run the bash script to get arrival time
# ./SAC-correlate.sh | awk '{print $2}'
#
# auto-correlation
sac << EOF
fg seis
w f1.sac
w f2.sac
r f1.sac f2.sac
echo on processed
cor norm
(max &2,depmax (abs &2,depmin))
q
EOF
rm f1.sac f2.sac
# prepare SAC data
# seis.sac, its shifted seis-shift[xxx].sac, and
# those two after do rmean, rtrend, taper
sac << EOF
fg seis
w seis.sac
r ./seis.sac
ch b 0
wh
cut 0 7
r seis.sac
w over
cut off
r seis.sac
ch t1 3
wh
cuterr fillz
cut 0.2345 7.2345
r seis.sac
w seis-shift0.2345.sac
cut off
r seis-shift0.2345.sac
ch b 0
w over
q
EOF
sac << EOF
r seis.sac seis-shift0.2345.sac
rmean
rtrend
taper
w seis-rrt.sac seis-shift0.2345-rrt.sac
q
EOF
sac << EOF
r seis.sac seis-shift0.2345.sac
echo on processed
cor norm
(max &2,depmax (abs &2,depmin))
r seis-rrt.sac seis-shift0.2345-rrt.sac
cor norm
(max &2,depmax (abs &2,depmin))
q
EOF
rm seis*.sac