author | A.M. Thurnherr <athurnherr@yahoo.com> |
Thu, 10 Mar 2016 11:25:56 +0000 | |
changeset 37 | 2c4479351544 |
parent 32 | 6041a20feb39 |
child 41 | 6bddb82924e3 |
permissions | -rw-r--r-- |
29 | 1 |
#====================================================================== |
2 |
# P L O T _ W P R O F . P L |
|
3 |
# doc: Sun Jul 26 11:08:50 2015 |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
4 |
# dlm: Mon Oct 12 13:20:47 2015 |
29 | 5 |
# (c) 2015 A.M. Thurnherr |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
6 |
# uE-Info: 53 40 NIL 0 0 72 2 2 4 NIL ofnI |
29 | 7 |
#====================================================================== |
8 |
||
9 |
# HISTORY: |
|
10 |
# Jul 26, 2015: - created from LWplot_prof_2beam |
|
31 | 11 |
# Jul 30, 2015: - moved main label outside plot area |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
12 |
# Oct 12, 2015: - BUG: gaps were not plotted as such |
29 | 13 |
|
14 |
# Tweakables: |
|
15 |
# |
|
16 |
# $plot_wprof_xmin = -0.27; |
|
17 |
# $plot_wprof_ymax = 5000; |
|
18 |
# $plot_wprof_xtics = "-0.25 -0.15 -0.05 0.05"; |
|
19 |
||
20 |
require "$ANTS/libGMT.pl"; |
|
21 |
||
22 |
sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/0/$plot_wprof_ymax"); } |
|
23 |
sub setR2() { GMT_setR("-R-200/200/0/$plot_wprof_ymax"); } |
|
24 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
25 |
sub plotDC($$) |
29 | 26 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
27 |
my($f,$minsamp) = @_; |
29 | 28 |
for (my($bi)=0; $bi<=$#{$DNCAST{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
29 |
if (numberp($DNCAST{$f}[$bi]) && $DNCAST{N_SAMP}[$bi]>=$minsamp) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
30 |
printf(GMT "%g %g\n",$DNCAST{$f}[$bi],($bi+0.5)*$opt_o); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
31 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
32 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
33 |
} |
29 | 34 |
} |
35 |
} |
|
36 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
37 |
sub plotUC($$) |
29 | 38 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
39 |
my($f,$minsamp) = @_; |
29 | 40 |
for (my($bi)=0; $bi<=$#{$UPCAST{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
41 |
if (numberp($UPCAST{$f}[$bi]) && $UPCAST{N_SAMP}[$bi]>=$minsamp) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
42 |
printf(GMT "%g %g\n",$UPCAST{$f}[$bi],($bi+0.5)*$opt_o); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
43 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
44 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
45 |
} |
29 | 46 |
} |
47 |
} |
|
48 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
49 |
sub plotBT($$) |
29 | 50 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
51 |
my($f,$minsamp) = @_; |
29 | 52 |
for (my($bi)=0; $bi<=$#{$BT{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
53 |
if (numberp($BT{$f}[$bi]) && $BT{N_SAMP}[$bi]>=$minsamp) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
54 |
printf(GMT "%g %g\n",$BT{$f}[$bi],($bi+0.5)*$opt_o); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
55 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
56 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
57 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
58 |
} |
29 | 59 |
} |
60 |
||
61 |
||
62 |
sub plot_wprof($) |
|
63 |
{ |
|
64 |
my($pfn) = @_; |
|
65 |
||
66 |
$plot_wprof_xmin = -0.1 |
|
67 |
unless defined($plot_wprof_xmin); |
|
68 |
$plot_wprof_ymax = ($P{water_depth} > 0) ? |
|
69 |
round($P{water_depth} + 25) : |
|
70 |
round($P{max_depth} + 25) |
|
71 |
unless defined($plot_wprof_ymax); |
|
72 |
$plot_wprof_xtics = "-0.05 0.05 0.15" |
|
73 |
unless defined($plot_wprof_xtics); |
|
74 |
||
75 |
GMT_begin($pfn,'-JX10/-10',"-R$plot_wprof_xmin/0.35/0/$plot_wprof_ymax",'-P'); # START PLOT |
|
76 |
||
77 |
GMT_psxy('-G200'); # MAD background |
|
78 |
print(GMT "0.07 0\n 0.07 $plot_wprof_ymax\n0.18 $plot_wprof_ymax\n0.18 0\n"); |
|
79 |
||
80 |
if ($P{water_depth} > 0) { # SEABED |
|
81 |
GMT_psxy('-G204/153/102'); |
|
82 |
print(GMT "$plot_wprof_xmin $plot_wprof_ymax\n0.35 $plot_wprof_ymax\n0.35 $P{water_depth}\n $plot_wprof_xmin $P{water_depth}\n"); |
|
83 |
} |
|
84 |
||
85 |
setR1(); # FRAME |
|
86 |
GMT_psxy('-W1'); |
|
87 |
print(GMT "0 0\n 0 $plot_wprof_ymax\n"); |
|
88 |
setR2(); |
|
89 |
GMT_psxy('-W1 -M'); |
|
90 |
print(GMT ">\n50 0\n 50 $plot_wprof_ymax\n"); |
|
91 |
print(GMT ">\n100 0\n 100 $plot_wprof_ymax\n"); |
|
92 |
print(GMT ">\n150 0\n 150 $plot_wprof_ymax\n"); |
|
93 |
||
94 |
setR1(); # VERTICAL VELOCITIES |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
95 |
GMT_psxy('-Mn -W4,coral,6_2:0'); plotDC('MEDIAN_W12',$opt_k); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
96 |
GMT_psxy('-Mn -W4,coral,4_6:0'); plotDC('MEDIAN_W34',$opt_k); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
97 |
GMT_psxy('-Mn -W4,SeaGreen,6_2:0'); plotUC('MEDIAN_W12',$opt_k); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
98 |
GMT_psxy('-Mn -W4,SeaGreen,4_6:0'); plotUC('MEDIAN_W34',$opt_k); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
99 |
GMT_psxy('-Mn -W4,black'); plotBT('MEDIAN_W',$opt_k); |
29 | 100 |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
101 |
GMT_psxy('-Sc0.1c -Gcoral'); plotDC('MAD_W',0); # MEAN ABSOLUTE DEVIATIONS |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
102 |
GMT_psxy('-Sc0.1c -GSeaGreen'); plotUC('MAD_W',0); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
103 |
GMT_psxy('-Sc0.1c -Gblack'); plotBT('MAD_W',0); |
29 | 104 |
|
105 |
setR2(); # SAMPLES |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
106 |
GMT_psxy('-Mn -W1/coral'); plotDC('N_SAMP',0); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
107 |
GMT_psxy('-Mn -W1/SeaGreen'); plotUC('N_SAMP',0); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
108 |
GMT_psxy('-Mn -W1/black'); plotBT('N_SAMP',0); |
29 | 109 |
|
110 |
GMT_unitcoords(); # LABELS |
|
31 | 111 |
GMT_pstext('-Gblue -N'); |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
112 |
print(GMT "0.01 -0.06 14 0 0 TL $P{out_basename} [$P{run_label}]\n"); |
29 | 113 |
GMT_pstext(); |
114 |
print(GMT "0.6 0.98 12 0 0 BR m.a.d.\n"); |
|
115 |
||
116 |
my($depth_tics) = ($plot_wprof_ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES |
|
117 |
setR1(); |
|
118 |
GMT_psbasemap("-Bf0.01:'Vertical Velocity [m/s] ':/$depth_tics:'Depth [m]':WeS"); |
|
119 |
foreach my $t (split('\s+',$plot_wprof_xtics)) { |
|
120 |
GMT_psbasemap(sprintf('-Ba10-%fS',10-$t)); |
|
121 |
} |
|
122 |
setR2(); |
|
123 |
GMT_psbasemap('-Bf10a1000-950:" # of Samples":N'); |
|
124 |
GMT_psbasemap('-Ba1000-900N'); |
|
125 |
GMT_psbasemap('-Ba1000-850N'); |
|
126 |
||
127 |
GMT_end(); # FINISH PLOT |
|
128 |
} |
|
129 |
||
130 |
1; # return true on require |