-
Notifications
You must be signed in to change notification settings - Fork 7
/
plot_visc_scan
executable file
·298 lines (256 loc) · 9.21 KB
/
plot_visc_scan
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#!/bin/bash
modes=${1-"1 2 3 4"}
pmodels=${2-"tx2019slab lrr98d smean2_ntn s40rts st11den-1 smean2"}
#makecpt -T-.4/.8/0.05 -Cpolar -D > tmp.cpt
#makecpt -T-.4/.8/0.05 -Croma -D > tmp.cpt
makecpt -T-.2/.8/0.05 -Croma -D > tmp.cpt
#psc_loc=-Dx1.25/4.2/1.5/.15h
psc_loc=-Dx.25/3/2/.15
for mode in $modes;do
if [[ $mode = 1 || $mode = 2 || $mode = 1b ]];then
#
# two layers for 660 fixed
#
nlay=2
for smodel in $pmodels;do
infile=visc_scan_out/visc_scan.$smodel.$nlay.dat.gz
# r_20 r_4-9 r_2-4
for gcol in 1 2 3;do
zcat $infile | gawk -v g=$gcol '{col=4+g;print($4,$col)}' > tmp.$gcol.$smodel
done
done
if [ $mode = 1 ];then
cat <<EOF | gnuplot
set term post color enh solid 24
set xlabel '{/Symbol h}_{lm}/{/Symbol h}_{um}'
set ylabel 'correlation'
set out 'visc.l1.tomo.ps'
set logscale x
set key left
set xrange [0.1:*]
set multi
plot 'tmp.1.smean2_ntn' using (10**\$1) : (\$2) title 'r_{2-20}, SMEAN2' w l lt 1 lw 4,\
'tmp.3.smean2_ntn' using (10**\$1) : (\$2) title 'r_{2-4}, SMEAN2' w l lt 2 lw 4,\
'tmp.2.smean2_ntn' using (10**\$1) : (\$2) title 'r_{4-9}, ' w l lt 3 lw 4,\
'tmp.1.tx2019slab' using (10**\$1) : (\$2) title 'r_{2-20}, TX2019SLAB' w l lt 1 lw 1,\
'tmp.3.tx2019slab' using (10**\$1) : (\$2) title 'r_{2-4}, TX2019SLAB' w l lt 2 lw 1,\
'tmp.2.tx2019slab' using (10**\$1) : (\$2) title 'r_{4-9}, TX2019SLAB' w l lt 3 lw 1
EOF
echo visc.l1.tomo.ps
elif [ $mode = 1b ];then
cat <<EOF | gnuplot
set term post color enh solid "Palatino-Roman,24"
set xlabel '{/Symbol h}_{lm}/{/Symbol h}_{um}'
set ylabel 'correlation'
set out 'visc_l1_tomo_slab.ps'
set logscale x
set key samplen 2 right bottom
set xrange [0.1:*]
set multi
plot 'tmp.1.lrr98d' using (10**\$1) : (\$2) title 'slabs, r_{2-20}' w l lt 3 lw 5,\
'tmp.2.lrr98d' using (10**\$1) : (\$2) title 'slabs, r_{4-9}' w l lt 3 lw 2,\
'tmp.1.tx2019slab' using (10**\$1) : (\$2) title 'tomography, r_{2-20}' w l lt 1 lw 5,\
'tmp.2.tx2019slab' using (10**\$1) : (\$2) title 'tomography, r_{4-9}' w l lt 1 lw 2
EOF
echo visc_l1_tomo_slab.ps
epstopdf visc_l1_tomo_slab.ps
elif [ $mode = 2 ];then
cat <<EOF | gnuplot
set term post color enh solid 24
set xlabel '{/Symbol h}_{lm}/{/Symbol h}_{um}'
set ylabel 'correlation'
set out 'visc.l1.sub.ps'
set logscale x
set key left
set xrange [0.1:*]
plot 'tmp.1.stb00d' using (10**\$1) : (\$2) title 'r_{2-20}, M1' w l lt 1 lw 4,\
'tmp.1.st11den-1' using (10**\$1) : (\$2) title 'r_{2-20}, M2' w l lt 1 lw 1,\
'tmp.3.stb00d' using (10**\$1) : (\$2) title 'r_{2-4}, M1' w l lt 2 lw 4,\
'tmp.3.st11den-1' using (10**\$1) : (\$2) title 'r_{2-4}, M2' w l lt 2 lw 1,\
'tmp.2.stb00d' using (10**\$1) : (\$2) title 'r_{4-9}, M1' w l lt 3 lw 4,\
'tmp.2.st11den-1' using (10**\$1) : (\$2) title 'r_{4-9}, M2' w l lt 3 lw 1
EOF
echo visc.l1.sub.ps
fi
elif [ $mode = 3 ];then
#
# two layer tradeoff
#
nlay=-2
# for smodel in smean2 lrr98d stb00d s40rts semucb-wm1 st11den-1 smean2_ntn;do
#for smodel in smean2_ntn lrr98d;do
for smodel in $pmodels ;do
if [ $smodel = smean2_ntn ];then
mlabel="tomography"
elif [ $smodel = lrr98d ];then
mlabel="slabs"
else
mlabel=`echo $smodel | gawk '{print(toupper($1))}'`
fi
infile=visc_scan_out/visc_scan.$smodel.$nlay.dat.gz
# r_20 r_4-9 r_2-4
#for gcol in 1 2 3;do
for gcol in 1 3;do
zcat $infile | gawk -v g=$gcol '{col=4+g;print($4,$8,$col)}' > tmp.$gcol.$smodel
reg=`minmax -I1/25 tmp.$gcol.$smodel`
sinc=-I0.005/1.5
echo $0: `minmax tmp.$gcol.$smodel` $reg $sinc
blockmedian $sinc $reg tmp.$gcol.$smodel > tmp.dat
surface tmp.dat $reg $sinc -Gtmp.1.grd -T.75 &
grdmask tmp.dat $reg $sinc -Gtmp.2.grd -S20 -NNaN/1/1 &
wait
rm tmp.dat
grdmath tmp.1.grd tmp.2.grd MUL = tmp.grd
#surface $reg $sinc tmp.$gcol.$smodel -Gtmp.grd
if [ $gcol -eq 1 ];then
rl="r@-2-20@-"
elif [ $gcol -eq 3 ];then
rl="r@-2-4@-"
fi
# find 660 max
(grd2xyz -R-2/3/500/700 tmp.grd | gawk '{if($2==660)print($1,$3)}' | gawk -v col=2 -v pcol=1 -f max.awk | gawk '{printf("%.2f %g\n",$1,$2)}' > tmp.660) &
(grd2max_location tmp.grd > tmp.max ) &
proj=-JX4.5/-4.5
ofile=visc_scan_plots/"visc_l1_2d_"$smodel"_"$gcol".ps"
grdimage tmp.grd $reg -Ctmp.cpt $proj -Ba1f.1:"log@-10@-(@~h@~@-lm@-/@~h@~@-um@-)":/a200f20:"z@-um/lm@- [km]":WeSn -P -K > $ofile
grdcontour -S4 tmp.grd $reg $proj -C.3 -A+f12 -O -K >> $ofile
psscale $psc_loc -Ctmp.cpt -B.3/:"$rl": -O -K -E >> $ofile
wait
# abs max
cat tmp.max | psxy $reg $proj -O -K -Sa.3 -Gorange -W0.5 >> $ofile
rmax=`grd2max tmp.grd | gawk '{printf("%.2f",$1)}' `
read r660 x < tmp.660
echo $x 660 | psxy $reg $proj -O -Sc.3 -Gorange -W0.5 -K >> $ofile
echo -2.8 1550 18 0 29 ML "r@-max@-(660 km) = $r660" | pstext -R -J -O -K >> $ofile
echo -2.8 1700 18 0 29 ML "r@-max@- = $rmax" | pstext -R -J -O -K >> $ofile
echo -2.8 1400 22 0 31 ML "$mlabel" | pstext -O $reg $proj >> $ofile
rm tmp.660 tmp.max
modifybb $ofile
(epstopdf $ofile; rm $ofile)&
rm tmp.*grd
echo $ifile $gcol $reg
done
done
elif [ $mode = 4 ];then
#
# three layers
#
nlay=3
for zlm in 660 1000;do
#for smodel in smean2 st11den-1 smean2_ntn semucb-wm1;do
for smodel in $pmodels;do
if [ $smodel = smean2_ntn ];then
mlabel="tomography"
elif [ $smodel = lrr98d ];then
mlabel="slabs"
else
mlabel=`echo $smodel | gawk '{print(toupper($1))}'`
fi
#for smodel in smean2 ;do
if [ $zlm = 660 ];then
infile=visc_scan_out/visc_scan.$smodel.$nlay.dat.gz
else
infile=visc_scan_out/visc_scan.$smodel.$nlay.$zlm.dat.gz
fi
# r_20 r_4-9 r_2-4
#for gcol in 1 2 3;do
for gcol in 1 ;do
if [ $zlm = 660 ];then
ofile=visc_scan_plots/"visc_l2_2d_"$smodel"_"$gcol".ps"
else
ofile=visc_scan_plots/"visc_l2_2d_"$smodel"_"$gcol"_"$zlm".ps"
fi
zcat $infile | gawk -v g=$gcol '{col=4+g;print($4,$1,$col)}' | sort +2 -rn > tmp.$gcol.$smodel
#head -20 tmp.$gcol.$smodel
max=`head -1 tmp.$gcol.$smodel`
reg=`minmax -I1/1 tmp.$gcol.$smodel`
sinc=-I0.005/0.005
surface $reg $sinc tmp.$gcol.$smodel -Gtmp.1.grd -T.75 &
grdmask $reg $sinc tmp.$gcol.$smodel -Gtmp.2.grd -NNaN/1/1 -S0.02 &
wait
grdmath tmp.1.grd tmp.2.grd MUL = tmp.grd
#surface $reg $sinc tmp.$gcol.$smodel -Gtmp.grd
if [ $gcol -eq 1 ];then
rl="r@-2-20@-"
elif [ $gcol -eq 3 ];then
rl="r@-2-4@-"
fi
#makecpt -T-.4/.8/0.05 -Cpolar -D > tmp.cpt
proj=-JX4.5/-4.5
#makecpt -T-.4/.8/0.05 -Croma -D > tmp.cpt
grdimage tmp.grd $reg -Ctmp.cpt $proj -Ba1f.1:"log@-10@-(@~h@~@-lm@-/@~h@~@-um@-), z@-ulm@- = $zlm km":/a1f.1:"log@-10@-(@~h@~@-lith@-/@~h@~@-um@-)":WeSn -P -K > $ofile
grdcontour -S4 tmp.grd $reg $proj -C.3 -A+f12 -O -K >> $ofile
psscale $psc_loc -Ctmp.cpt -B.3/:"$rl": -O -K -E >> $ofile
grd2max_location tmp.grd | psxy $reg $proj -O -K -Sa.3 -Gorange -W0.5 >> $ofile
rmax=`grd2max tmp.grd | gawk '{printf("%.2f",$1)}'`
echo -2.8 2 22 0 31 ML $mlabel | pstext -O $reg -K $proj >> $ofile
echo -2.8 2.6 18 0 29 ML "r@-max@- = $rmax " | pstext -O $reg $proj >> $ofile
modifybb $ofile
(epstopdf $ofile; rm $ofile)&
rm tmp*grd
done
done
done
elif [ $mode = 5 ];then
#
# four layers
#
nlay=4
#for zlm in 660 1000;do
for zlm in 660;do
#for smodel in smean2 st11den-1 smean2_ntn semucb-wm1;do
#for smodel in smean2_ntn lrr98d;do
for smodel in $pmodels ;do
if [ $smodel = smean2_ntn ];then
mlabel="tomography"
elif [ $smodel = lrr98d ];then
mlabel="slabs"
else
mlabel=`echo $smodel | gawk '{print(toupper($1))}'`
fi
for za in 200 300 410 ;do
if [ $za = 410 ];then
suf=dat.gz
suf2=.ps
else
suf=a.$za.dat.gz
suf2=a.$za.ps
fi
if [ $zlm = 660 ];then
infile=visc_scan_out/visc_scan.$smodel.$nlay.$suf
else
infile=visc_scan_out/visc_scan.$smodel.$nlay.$zlm.$suf
fi
for gcol in 1 ;do
if [ $zlm = 660 ];then
ofile=visc_scan_plots/"visc_l4_"$smodel"_"$gcol"$suf2"
else
ofile=visc_scan_plots/"visc_l4_"$smodel"_"$gcol"_"$zlm"$suf2"
fi
zcat $infile | \
gawk -v g=$gcol '{col=4+g;print($1,$2,$4,$col)}' | \
sort +3 -rn > tmp.$gcol.$smodel
#head -10 tmp.$gcol.$smodel
echo model $smodel zlm $zlm
zlmproj=2
proj="-JX5/5 -JZ5 -Z$zlmproj -E145/30 "
reg=-R-0.5/3/0/3/2/3
head -500 tmp.$gcol.$smodel > tmp.plot
minmax tmp.plot
#makecpt -T0.85/0.86/0.0005 -Cpolar -D > tmp.cpt
makecpt -T`gawk -v col=4 -f min.awk tmp.plot`/`gawk -v col=4 -f max.awk tmp.plot`/0.0005 -Cpolar -D > tmp.cpt
psxyz tmp.plot $proj $reg -P -W0.5 -Ctmp.cpt -Su.1 -N -K \
-Ba1f.1:"log@-10@-(@~h@~@-lith@-/@~h@~@-um@-)":/a1f.1:"log@-10@-(@~h@~@-ast@-/@~h@~@-um@-)":/a.2f.02:"log@-10@-(@~h@~@-lm@-/@~h@~@-um@-)": > $ofile
psscale -O -K -Ctmp.cpt -B.003/:"r@-2-20@-": -D3/6/2/.2h >> $ofile
gawk -v zlmp=$zlmproj '{print($1,$2,zlmp,$4)}' tmp.plot | \
psxyz $proj $reg -W0.5 -Ctmp.cpt -Sc.1 -W0.5 -N -O >> $ofile
modifybb $ofile
epstopdf $ofile; rm $ofile
echo
done
done
done
done
fi
done
rm tmp*