author | Andreas Thurnherr <ant@ldeo.columbia.edu> |
Sat, 10 Apr 2021 06:00:45 -0400 | |
changeset 55 | 2d8e1139acd5 |
parent 54 | 828e5466391b |
permissions | -rw-r--r-- |
30 | 1 |
#====================================================================== |
2 |
# P L O T _ M E A N _ R E S I D U A L S . P L |
|
3 |
# doc: Tue Jul 28 13:21:09 2015 |
|
54 | 4 |
# dlm: Fri May 15 19:06:51 2020 |
30 | 5 |
# (c) 2015 A.M. Thurnherr |
54 | 6 |
# uE-Info: 122 47 NIL 0 0 72 2 2 4 NIL ofnI |
30 | 7 |
#====================================================================== |
8 |
||
9 |
# HISTORY: |
|
10 |
# Jul 28, 2015: - created from [LWplot_BR] |
|
11 |
# Jul 29, 2015: - finished |
|
31 | 12 |
# Jul 30, 2015: - added bin_tics |
13 |
# - added outGrid_* support |
|
34 | 14 |
# Jan 22, 2015: - many changes |
15 |
# - added quality assessment label |
|
16 |
# Jan 25, 2016: - added return on no data |
|
41 | 17 |
# Mar 16, 2016: - adapted to gmt5 |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
18 |
# May 18, 2016: - added version |
54 | 19 |
# May 15, 2020: - adapted to bin-residuals separate per beam pair |
20 |
# - added orange range |
|
21 |
# - slightly relaxed green range |
|
30 | 22 |
|
23 |
require "$ANTS/libGMT.pl"; |
|
24 |
||
25 |
sub plot_mean_residuals($) |
|
26 |
{ |
|
27 |
my($pfn) = @_; |
|
28 |
||
34 | 29 |
return unless ($P{BR_max_bin}); |
30 |
||
30 | 31 |
my($xmin) = -0.05; |
32 |
my($xmax) = 0.05; |
|
33 |
my($ymin) = 0.5; |
|
34 |
my($ymax) = $P{BR_max_bin} + 0.5; |
|
35 |
||
36 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax"; |
|
37 |
GMT_begin($pfn,'-JX10/-10',$R,'-P'); |
|
38 |
||
34 | 39 |
if ($outGrid_firstBin>$LADCP_firstBin || $outGrid_lastBin<$LADCP_lastBin) { # mark used bins |
41 | 40 |
GMT_psxy('-G200 -L'); |
31 | 41 |
printf(GMT ">\n%f %f\n%f %f\n%f %f\n%f %f\n", |
42 |
$xmin,$LADCP_firstBin-0.5, |
|
43 |
$xmax,$LADCP_firstBin-0.5, |
|
44 |
$xmax,$outGrid_firstBin-0.5, |
|
45 |
$xmin,$outGrid_firstBin-0.5) |
|
46 |
if ($outGrid_firstBin>$LADCP_firstBin); |
|
47 |
printf(GMT ">\n%f %f\n%f %f\n%f %f\n%f %f\n", |
|
48 |
$xmin,$LADCP_lastBin+0.5, |
|
49 |
$xmax,$LADCP_lastBin+0.5, |
|
50 |
$xmax,$outGrid_lastBin+0.5, |
|
51 |
$xmin,$outGrid_lastBin+0.5) |
|
52 |
if ($outGrid_lastBin<$LADCP_lastBin); |
|
53 |
} |
|
54 |
||
34 | 55 |
GMT_psxy('-W1'); # plot zero line |
30 | 56 |
printf(GMT "0 $ymin\n0 $ymax\n"); |
57 |
||
54 | 58 |
GMT_psxy('-W2,coral,8_2:0'); |
59 |
for (my($bin)=$LADCP_firstBin; $bin<@dc_bres12; $bin++) { |
|
34 | 60 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); |
54 | 61 |
next unless ($dc_bres12_nsamp[$bin] >= $dc_bres12_max_nsamp/3); |
62 |
printf(GMT "%f %d\n",$dc_avg_bres12[$bin],$bin+1); |
|
63 |
} |
|
64 |
GMT_psxy('-W2,coral,1_1:0'); |
|
65 |
for (my($bin)=$LADCP_firstBin; $bin<@dc_bres34; $bin++) { |
|
66 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); |
|
67 |
next unless ($dc_bres34_nsamp[$bin] >= $dc_bres34_max_nsamp/3); |
|
68 |
printf(GMT "%f %d\n",$dc_avg_bres34[$bin],$bin+1); |
|
30 | 69 |
} |
41 | 70 |
GMT_psxy('-Ex0.2/2,coral'); |
54 | 71 |
for (my($bin)=$LADCP_firstBin-1; $bin<@dc_bres12; $bin++) { |
30 | 72 |
printf(GMT "%f %d %f\n", |
54 | 73 |
$dc_avg_bres12[$bin], |
74 |
$bin+1, |
|
75 |
($dc_bres12_nsamp[$bin] > 1) ? |
|
76 |
$dc_sig_bres12[$bin]/sqrt($dc_bres12_nsamp[$bin]-1) : 0); |
|
77 |
} |
|
78 |
for (my($bin)=$LADCP_firstBin-1; $bin<@dc_bres34; $bin++) { |
|
79 |
printf(GMT "%f %d %f\n", |
|
80 |
$dc_avg_bres34[$bin], |
|
30 | 81 |
$bin+1, |
54 | 82 |
($dc_bres34_nsamp[$bin] > 1) ? |
83 |
$dc_sig_bres34[$bin]/sqrt($dc_bres34_nsamp[$bin]-1) : 0); |
|
30 | 84 |
} |
54 | 85 |
GMT_psxy('-W2,SeaGreen,8_2:0'); |
86 |
for (my($bin)=$LADCP_firstBin; $bin<@uc_bres12; $bin++) { |
|
34 | 87 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); |
54 | 88 |
next unless ($uc_bres12_nsamp[$bin] >= $uc_bres12_max_nsamp/3); |
89 |
printf(GMT "%f %d\n",$uc_avg_bres12[$bin],$bin+1); |
|
90 |
} |
|
91 |
GMT_psxy('-W2,SeaGreen,1_1:0'); |
|
92 |
for (my($bin)=$LADCP_firstBin; $bin<@uc_bres34; $bin++) { |
|
93 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); |
|
94 |
next unless ($uc_bres34_nsamp[$bin] >= $uc_bres34_max_nsamp/3); |
|
95 |
printf(GMT "%f %d\n",$uc_avg_bres34[$bin],$bin+1); |
|
30 | 96 |
} |
41 | 97 |
GMT_psxy('-Ex0.2/2,SeaGreen'); |
54 | 98 |
for (my($bin)=$LADCP_firstBin-1; $bin<@uc_bres12; $bin++) { |
30 | 99 |
printf(GMT "%f %d %f\n", |
54 | 100 |
$uc_avg_bres12[$bin], |
30 | 101 |
$bin+1, |
54 | 102 |
($uc_bres12_nsamp[$bin] > 1) ? |
103 |
$uc_sig_bres12[$bin]/sqrt($uc_bres12_nsamp[$bin]-1) : 0); |
|
104 |
} |
|
105 |
for (my($bin)=$LADCP_firstBin-1; $bin<@uc_bres34; $bin++) { |
|
106 |
printf(GMT "%f %d %f\n", |
|
107 |
$uc_avg_bres34[$bin], |
|
108 |
$bin+1, |
|
109 |
($uc_bres34_nsamp[$bin] > 1) ? |
|
110 |
$uc_sig_bres34[$bin]/sqrt($uc_bres34_nsamp[$bin]-1) : 0); |
|
30 | 111 |
} |
112 |
||
113 |
GMT_unitcoords(); # LABELS |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
114 |
GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite'); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
115 |
print(GMT "0.99 0.01 V$VERSION\n"); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
116 |
|
41 | 117 |
GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id |
118 |
print(GMT "0.0 -0.03 $P{out_basename} $P{run_label}\n"); |
|
34 | 119 |
|
54 | 120 |
GMT_pstext('-F+f12,Helvetica-Bold,black+jBL -Gwhite'); # rms residuals |
121 |
print(GMT "0.1 0.88 beams <1,2>\n"); |
|
122 |
GMT_pstext('-F+f12,Helvetica-Bold,black+jBL -Gwhite'); |
|
123 |
print(GMT "0.7 0.88 beams <3,4>\n"); |
|
124 |
||
41 | 125 |
GMT_pstext('-F+f12,Helvetica,coral+jBL'); # rms residuals |
126 |
print(GMT "0.01 0.93 dc\n"); |
|
54 | 127 |
if ($dc_bres12_rms >= 0.005) { GMT_pstext('-F+f12,Helvetica,white+jBL -Gred'); } |
128 |
elsif ($dc_bres12_rms >= 0.003) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gorange'); } |
|
129 |
elsif ($dc_bres12_rms >= 0.0015) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gyellow'); } |
|
41 | 130 |
else { GMT_pstext('-F+f12,Helvetica,black+jBL -Ggreen'); } |
54 | 131 |
printf(GMT "0.10 0.93 %.1f mm/s rms\n",1000*$dc_bres12_rms); |
132 |
||
133 |
if ($dc_bres34_rms >= 0.005) { GMT_pstext('-F+f12,Helvetica,white+jBL -Gred'); } |
|
134 |
elsif ($dc_bres34_rms >= 0.003) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gorange'); } |
|
135 |
elsif ($dc_bres34_rms >= 0.0015) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gyellow'); } |
|
136 |
else { GMT_pstext('-F+f12,Helvetica,black+jBL -Ggreen'); } |
|
137 |
printf(GMT "0.70 0.93 %.1f mm/s rms\n",1000*$dc_bres34_rms); |
|
34 | 138 |
|
41 | 139 |
GMT_pstext('-F+f12,Helvetica,SeaGreen+jBL'); |
140 |
print(GMT "0.01 0.98 uc\n"); |
|
54 | 141 |
if ($uc_bres12_rms >= 0.005) { GMT_pstext('-F+f12,Helvetica,white+jBL -Gred'); } |
142 |
elsif ($uc_bres12_rms >= 0.003) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gorange'); } |
|
143 |
elsif ($uc_bres12_rms >= 0.0015) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gyellow'); } |
|
41 | 144 |
else { GMT_pstext('-F+f12,Helvetica,black+jBL -Ggreen'); } |
54 | 145 |
printf(GMT "0.10 0.98 %.1f mm/s rms\n",1000*$uc_bres12_rms); |
146 |
if ($uc_bres34_rms >= 0.005) { GMT_pstext('-F+f12,Helvetica,white+jBL -Gred'); } |
|
147 |
elsif ($uc_bres34_rms >= 0.003) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gorange'); } |
|
148 |
elsif ($uc_bres34_rms >= 0.0015) { GMT_pstext('-F+f12,Helvetica,black+jBL -Gyellow'); } |
|
149 |
else { GMT_pstext('-F+f12,Helvetica,black+jBL -Ggreen'); } |
|
150 |
printf(GMT "0.70 0.98 %.1f mm/s rms\n",1000*$uc_bres34_rms); |
|
30 | 151 |
|
31 | 152 |
my($bin_tics) = ($ymax <= 20) ? 'f1a1' : 'f1a2'; |
30 | 153 |
GMT_setR($R); # FINISH PLOT |
31 | 154 |
GMT_end("-Bf0.005a0.02:'Residual Vertical Velocity [m/s]':/$bin_tics:'Bin [#]':WeSn"); |
30 | 155 |
} |
156 |
||
157 |
1; # return true on require |