-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_sac2mt5
executable file
·46 lines (43 loc) · 897 Bytes
/
copy_sac2mt5
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
#!/bin/bash
read -p "Enter Data Directory: " dir
cd $dir
rm -rf selected_s2m
mkdir selected_s2m
evla=$1
evlo=$2
evdp=$3
orig=$4
for file in *.SAC
do
echo $file
sac<<!>/dev/null
r $file
rmean
rtrend
ch evla $evla
ch evlo $evlo
ch evdp $evdp
ch o gmt $orig
wh
w over
q
!
taup_setsac -mod iasp91 -ph P-1,S-2 -evdpkm $file
sttn=`saclhdr -KSTNM $file`
pmark=`saclhdr -T1 $file | awk '{print ($1==-12345)?0:1}'`
smark=`saclhdr -T2 $file | awk '{print ($1==-12345)?0:1}'`
smarker=`saclhdr -T2 $file`
endtime=`saclhdr -E $file`
echo $smarker $endtime | awk '{print $1,$2,$2-$1}'
omarker=`saclhdr -O $file | awk '{print ($1==-12345)?0:1}'`
if [ $pmark -eq 1 ] && [ $smark -eq 1 ] && [ $omarker -eq 1 ]
then
diff=$(echo $endtime - $smarker | bc | awk '{print ($1 >= 60)?1:0 }')
if [ $diff -eq 1 ]
then
cp $file selected_s2m
cp RESP/*$sttn* selected_s2m/
cp PZ/*$sttn* selected_s2m/
fi
fi
done