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