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
|
34
|
4 |
# dlm: Tue Jan 26 20:13:56 2016
|
30
|
5 |
# (c) 2015 A.M. Thurnherr
|
34
|
6 |
# uE-Info: 16 33 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
|
30
|
17 |
|
|
18 |
require "$ANTS/libGMT.pl";
|
|
19 |
|
|
20 |
sub plot_mean_residuals($)
|
|
21 |
{
|
|
22 |
my($pfn) = @_;
|
|
23 |
|
34
|
24 |
return unless ($P{BR_max_bin});
|
|
25 |
|
30
|
26 |
my($xmin) = -0.05;
|
|
27 |
my($xmax) = 0.05;
|
|
28 |
my($ymin) = 0.5;
|
|
29 |
my($ymax) = $P{BR_max_bin} + 0.5;
|
|
30 |
|
|
31 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax";
|
|
32 |
GMT_begin($pfn,'-JX10/-10',$R,'-P');
|
|
33 |
|
34
|
34 |
if ($outGrid_firstBin>$LADCP_firstBin || $outGrid_lastBin<$LADCP_lastBin) { # mark used bins
|
31
|
35 |
GMT_psxy('-G200 -M -L');
|
|
36 |
printf(GMT ">\n%f %f\n%f %f\n%f %f\n%f %f\n",
|
|
37 |
$xmin,$LADCP_firstBin-0.5,
|
|
38 |
$xmax,$LADCP_firstBin-0.5,
|
|
39 |
$xmax,$outGrid_firstBin-0.5,
|
|
40 |
$xmin,$outGrid_firstBin-0.5)
|
|
41 |
if ($outGrid_firstBin>$LADCP_firstBin);
|
|
42 |
printf(GMT ">\n%f %f\n%f %f\n%f %f\n%f %f\n",
|
|
43 |
$xmin,$LADCP_lastBin+0.5,
|
|
44 |
$xmax,$LADCP_lastBin+0.5,
|
|
45 |
$xmax,$outGrid_lastBin+0.5,
|
|
46 |
$xmin,$outGrid_lastBin+0.5)
|
|
47 |
if ($outGrid_lastBin<$LADCP_lastBin);
|
|
48 |
}
|
|
49 |
|
34
|
50 |
GMT_psxy('-W1'); # plot zero line
|
30
|
51 |
printf(GMT "0 $ymin\n0 $ymax\n");
|
|
52 |
|
|
53 |
GMT_psxy('-Mn -W4/coral');
|
34
|
54 |
for (my($bin)=$LADCP_firstBin; $bin<@dc_bres; $bin++) { # SKIP FIRST BIN
|
|
55 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin);
|
|
56 |
next unless ($dc_bres_nsamp[$bin] >= $dc_bres_max_nsamp/3);
|
30
|
57 |
printf(GMT "%f %d\n",$dc_avg_bres[$bin],$bin+1);
|
|
58 |
}
|
|
59 |
GMT_psxy('-Mn -Ex0.2/4/coral');
|
34
|
60 |
for (my($bin)=$LADCP_firstBin-1; $bin<@dc_bres; $bin++) {
|
30
|
61 |
printf(GMT "%f %d %f\n",
|
|
62 |
$dc_avg_bres[$bin],
|
|
63 |
$bin+1,
|
34
|
64 |
($dc_bres_nsamp[$bin] > 1) ?
|
|
65 |
$dc_sig_bres[$bin]/sqrt($dc_bres_nsamp[$bin]-1) : 0);
|
30
|
66 |
}
|
|
67 |
GMT_psxy('-Mn -W4/SeaGreen');
|
34
|
68 |
for (my($bin)=$LADCP_firstBin; $bin<@uc_bres; $bin++) { # SKIP FIRST BIN
|
|
69 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin);
|
|
70 |
next unless ($uc_bres_nsamp[$bin] >= $uc_bres_max_nsamp/3);
|
30
|
71 |
printf(GMT "%f %d\n",$uc_avg_bres[$bin],$bin+1);
|
|
72 |
}
|
|
73 |
GMT_psxy('-Mn -Ex0.2/4/SeaGreen');
|
34
|
74 |
for (my($bin)=$LADCP_firstBin-1; $bin<@uc_bres; $bin++) {
|
30
|
75 |
printf(GMT "%f %d %f\n",
|
|
76 |
$uc_avg_bres[$bin],
|
|
77 |
$bin+1,
|
34
|
78 |
($uc_bres_nsamp[$bin] > 1) ?
|
|
79 |
$uc_sig_bres[$bin]/sqrt($uc_bres_nsamp[$bin]-1) : 0);
|
30
|
80 |
}
|
|
81 |
|
|
82 |
GMT_unitcoords(); # LABELS
|
34
|
83 |
|
|
84 |
GMT_pstext('-Gblue -N'); # profile id
|
|
85 |
print(GMT "0.0 -0.03 14 0 0 BL $P{out_basename} $P{run_label}\n");
|
|
86 |
|
|
87 |
GMT_pstext('-Gcoral'); # rms residuals
|
|
88 |
print(GMT "0.01 0.93 12 0 0 BL dc\n");
|
|
89 |
if ($dc_bres_rms >= 0.005) { GMT_pstext('-Gwhite -Wred'); }
|
|
90 |
elsif ($dc_bres_rms >= 0.001) { GMT_pstext('-Gblack -Wyellow'); }
|
|
91 |
else { GMT_pstext('-Gblack -Wgreen'); }
|
|
92 |
printf(GMT "0.10 0.93 12 0 0 BL %.1f mm/s rms\n",1000*$dc_bres_rms);
|
|
93 |
|
|
94 |
GMT_pstext('-GSeaGreen');
|
|
95 |
print(GMT "0.01 0.98 12 0 0 BL uc\n");
|
|
96 |
if ($uc_bres_rms >= 0.005) { GMT_pstext('-Gwhite -Wred'); }
|
|
97 |
elsif ($uc_bres_rms >= 0.001) { GMT_pstext('-Gblack -Wyellow'); }
|
|
98 |
else { GMT_pstext('-Gblack -Wgreen'); }
|
|
99 |
printf(GMT "0.10 0.98 12 0 0 BL %.1f mm/s rms\n",1000*$uc_bres_rms);
|
30
|
100 |
|
31
|
101 |
my($bin_tics) = ($ymax <= 20) ? 'f1a1' : 'f1a2';
|
30
|
102 |
GMT_setR($R); # FINISH PLOT
|
31
|
103 |
GMT_end("-Bf0.005a0.02:'Residual Vertical Velocity [m/s]':/$bin_tics:'Bin [#]':WeSn");
|
30
|
104 |
}
|
|
105 |
|
|
106 |
1; # return true on require
|