author | A.M. Thurnherr <athurnherr@yahoo.com> |
Wed, 25 May 2016 12:14:29 -0400 | |
changeset 46 | cc6c4309828a |
parent 45 | 6d49c7420a6c |
child 47 | 2ccb81b7cea5 |
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 |
|
46 | 4 |
# dlm: Tue May 24 22:31:14 2016 |
29 | 5 |
# (c) 2015 A.M. Thurnherr |
46 | 6 |
# uE-Info: 19 51 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 |
41 | 13 |
# Mar 16, 2016: - adapted to gmt5 |
14 |
# Mar 17, 2016: - improved |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
15 |
# May 18, 2016: - replaced rms tilt by mean tilt with traffic background |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
16 |
# - added plot_wprof_ymin tweakable |
46 | 17 |
# May 24, 2016: - BUG: ymin did not work for nsamp |
18 |
# - fixed for partial-depth profiles |
|
19 |
# - suppress plotting of nsamp == 0 |
|
29 | 20 |
|
21 |
# Tweakables: |
|
22 |
# |
|
23 |
# $plot_wprof_xmin = -0.27; |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
24 |
# $plot_wprof_ymin = 3600; |
29 | 25 |
# $plot_wprof_ymax = 5000; |
26 |
# $plot_wprof_xtics = "-0.25 -0.15 -0.05 0.05"; |
|
27 |
||
28 |
require "$ANTS/libGMT.pl"; |
|
29 |
||
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
30 |
sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax"); } |
46 | 31 |
sub setR2() { GMT_setR("-R-450/350/$plot_wprof_ymin/$plot_wprof_ymax"); } |
29 | 32 |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
33 |
sub plotDC($$) |
29 | 34 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
35 |
my($f,$minsamp) = @_; |
29 | 36 |
for (my($bi)=0; $bi<=$#{$DNCAST{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
37 |
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
|
38 |
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
|
39 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
40 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
41 |
} |
29 | 42 |
} |
43 |
} |
|
44 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
45 |
sub plotUC($$) |
29 | 46 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
47 |
my($f,$minsamp) = @_; |
29 | 48 |
for (my($bi)=0; $bi<=$#{$UPCAST{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
49 |
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
|
50 |
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
|
51 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
52 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
53 |
} |
29 | 54 |
} |
55 |
} |
|
56 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
57 |
sub plotBT($$) |
29 | 58 |
{ |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
59 |
my($f,$minsamp) = @_; |
29 | 60 |
for (my($bi)=0; $bi<=$#{$BT{$f}}; $bi++) { |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
61 |
if (numberp($BT{$f}[$bi]) && $BT{N_SAMP}[$bi]>=$minsamp) { |
41 | 62 |
$have_BT = 1; |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
63 |
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
|
64 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
65 |
print(GMT "nan nan\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
66 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
67 |
} |
29 | 68 |
} |
69 |
||
70 |
||
71 |
sub plot_wprof($) |
|
72 |
{ |
|
73 |
my($pfn) = @_; |
|
74 |
||
75 |
$plot_wprof_xmin = -0.1 |
|
76 |
unless defined($plot_wprof_xmin); |
|
46 | 77 |
$plot_wprof_ymin = round(antsParam('min_depth')-25,50) |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
78 |
unless defined($plot_wprof_ymin); |
29 | 79 |
$plot_wprof_ymax = ($P{water_depth} > 0) ? |
46 | 80 |
round($P{water_depth}+25,50) : |
81 |
round($P{max_depth}+25,50) |
|
29 | 82 |
unless defined($plot_wprof_ymax); |
83 |
$plot_wprof_xtics = "-0.05 0.05 0.15" |
|
84 |
unless defined($plot_wprof_xtics); |
|
85 |
||
46 | 86 |
GMT_begin($pfn,'-JX10/-10',"-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax",'-P'); # START PLOT |
29 | 87 |
|
88 |
GMT_psxy('-G200'); # MAD background |
|
46 | 89 |
print(GMT "0.07 $plot_wprof_ymin\n 0.07 $plot_wprof_ymax\n0.18 $plot_wprof_ymax\n0.18 $plot_wprof_ymin\n"); |
29 | 90 |
|
91 |
if ($P{water_depth} > 0) { # SEABED |
|
92 |
GMT_psxy('-G204/153/102'); |
|
93 |
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"); |
|
94 |
} |
|
95 |
||
96 |
setR1(); # FRAME |
|
41 | 97 |
GMT_psxy('-W0.5'); |
29 | 98 |
print(GMT "0 0\n 0 $plot_wprof_ymax\n"); |
99 |
setR2(); |
|
41 | 100 |
GMT_psxy('-W0.5'); |
29 | 101 |
print(GMT ">\n50 0\n 50 $plot_wprof_ymax\n"); |
102 |
print(GMT ">\n150 0\n 150 $plot_wprof_ymax\n"); |
|
41 | 103 |
print(GMT ">\n250 0\n 250 $plot_wprof_ymax\n"); |
29 | 104 |
|
105 |
setR1(); # VERTICAL VELOCITIES |
|
41 | 106 |
GMT_psxy('-W1,coral,8_2:0'); plotDC('MEDIAN_W12',$opt_k); |
107 |
GMT_psxy('-W1,coral,1_1:0'); plotDC('MEDIAN_W34',$opt_k); |
|
108 |
GMT_psxy('-W1,SeaGreen,8_2:0'); plotUC('MEDIAN_W12',$opt_k); |
|
109 |
GMT_psxy('-W1,SeaGreen,1_1:0'); plotUC('MEDIAN_W34',$opt_k); |
|
110 |
GMT_psxy('-W1,black'); plotBT('MEDIAN_W',$opt_k); |
|
29 | 111 |
|
41 | 112 |
GMT_psxy('-Sc0.1c -Gcoral'); plotDC('MAD_W',0); # MEAN ABSOLUTE DEVIATIONS |
113 |
GMT_psxy('-Sc0.1c -GSeaGreen'); plotUC('MAD_W',0); |
|
114 |
GMT_psxy('-Sc0.1c -Gblack'); plotBT('MAD_W',0); |
|
29 | 115 |
|
116 |
setR2(); # SAMPLES |
|
46 | 117 |
GMT_psxy('-W0.7,coral'); plotDC('N_SAMP',1); |
118 |
GMT_psxy('-W0.7,SeaGreen'); plotUC('N_SAMP',1); |
|
119 |
GMT_psxy('-W0.7,black'); plotBT('N_SAMP',1); |
|
29 | 120 |
|
121 |
GMT_unitcoords(); # LABELS |
|
41 | 122 |
GMT_pstext('-F+f14,Helvetica,blue+jTL -N'); |
123 |
print(GMT "0.01 -0.06 $P{out_basename} [$P{run_label}]\n"); |
|
124 |
GMT_pstext('-F+f12,Helvetica+jBR'); |
|
125 |
print(GMT "0.6 0.98 m.a.d.\n"); |
|
126 |
GMT_pstext('-F -N'); |
|
127 |
print(GMT "0.32 1.12 Vertical Velocity [m/s]\n"); |
|
128 |
GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite'); |
|
129 |
print(GMT "0.99 0.01 V$VERSION\n"); |
|
29 | 130 |
|
41 | 131 |
GMT_pstext('-F+f12,Helvetica,coral+jTL -Gwhite'); |
132 |
print(GMT "0.02 0.01 dc\n"); |
|
133 |
GMT_pstext('-F+f12,Helvetica,SeaGreen+jTL -Gwhite'); |
|
134 |
print(GMT "0.02 0.06 uc\n"); |
|
135 |
if ($have_BT) { |
|
136 |
GMT_pstext('-F+f12,Helvetica,black+jTL -Gwhite'); |
|
137 |
print(GMT "0.02 0.10 BT\n"); |
|
138 |
} |
|
139 |
||
140 |
GMT_pstext('-F+f9,Helvetica,CornFlowerBlue+jTL -N'); |
|
141 |
printf(GMT "0.64 1.020 $LADCP{BEAM_FREQUENCY}kHz $LADCP{INSTRUMENT_TYPE} $P{ADCP_orientation}\n"); |
|
142 |
printf(GMT "0.64 1.055 bin setup\n 0.77 1.055 : %.1fm/%1.fm/%1.fm\n", |
|
143 |
$LADCP{BLANKING_DISTANCE},$LADCP{TRANSMITTED_PULSE_LENGTH},$LADCP{BIN_LENGTH}); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
144 |
print(GMT "0.64 1.090 mean tilt\n 0.77 1.096 :\n"); |
42 | 145 |
print(GMT "0.64 1.130 rms a\@-pkg\@-\n 0.77 1.1315 :\n"); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
146 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
147 |
if ($P{dc_mean_tilt} < 4) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
148 |
GMT_pstext('-F+f9,Helvetica,coral+jTL -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
149 |
} elsif ($P{dc_mean_tilt} < 8) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
150 |
GMT_pstext('-F+f9,Helvetica,coral+jTL -Gyellow -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
151 |
} else { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
152 |
GMT_pstext('-F+f9,Helvetica,coral+jTL -Gred -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
153 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
154 |
printf(GMT "0.808 1.090 %.1f\\260\n",$P{dc_mean_tilt}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
155 |
if ($P{uc_mean_tilt} < 4) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
156 |
GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
157 |
} elsif ($P{uc_mean_tilt} < 8) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
158 |
GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
159 |
} else { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
160 |
GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gred -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
161 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
162 |
printf(GMT "0.91 1.090 %.1f\\260\n",$P{uc_mean_tilt}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
163 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
164 |
if ($P{dc_rms_accel_pkg} < 0.7) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
165 |
GMT_pstext('-F+f9,Helvetica,coral+jTL -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
166 |
} else { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
167 |
GMT_pstext('-F+f9,Helvetica,coral+jTL -Gyellow -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
168 |
} |
42 | 169 |
printf(GMT "0.78 1.125 %.1fm\@+2\@+/s\n",$P{dc_rms_accel_pkg}); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
170 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
171 |
if ($P{uc_rms_accel_pkg} < 0.7) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
172 |
GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
173 |
} else { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
174 |
GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
175 |
} |
42 | 176 |
printf(GMT "0.89 1.125 %.1fm\@+2\@+/s\n",$P{uc_rms_accel_pkg}); |
41 | 177 |
|
46 | 178 |
my($depth_tics) = ($plot_wprof_ymax-$plot_prof_ymin < 1000 ) ? 'f10a100' : 'f100a500'; # AXES |
29 | 179 |
setR1(); |
41 | 180 |
GMT_psbasemap("-Bf0.01:'':/$depth_tics:'Depth [m]':WeS"); |
29 | 181 |
foreach my $t (split('\s+',$plot_wprof_xtics)) { |
182 |
GMT_psbasemap(sprintf('-Ba10-%fS',10-$t)); |
|
183 |
} |
|
184 |
setR2(); |
|
185 |
GMT_psbasemap('-Bf10a1000-950:" # of Samples":N'); |
|
186 |
GMT_psbasemap('-Ba1000-850N'); |
|
41 | 187 |
GMT_psbasemap('-Ba1000-750N'); |
29 | 188 |
|
189 |
GMT_end(); # FINISH PLOT |
|
190 |
} |
|
191 |
||
192 |
1; # return true on require |