author | A.M. Thurnherr <athurnherr@yahoo.com> |
Thu, 19 May 2016 09:38:56 -0400 | |
changeset 45 | 6d49c7420a6c |
parent 41 | 6bddb82924e3 |
child 46 | cc6c4309828a |
permissions | -rw-r--r-- |
30 | 1 |
#====================================================================== |
2 |
# P L O T _ R E S I D U A L S . P L |
|
3 |
# doc: Tue Jul 28 13:21:09 2015 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
4 |
# dlm: Wed May 18 19:44:44 2016 |
30 | 5 |
# (c) 2015 A.M. Thurnherr |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
6 |
# uE-Info: 55 43 NIL 0 0 72 0 2 4 NIL ofnI |
30 | 7 |
#====================================================================== |
8 |
||
9 |
# HISTORY: |
|
10 |
# Jul 28, 2015: - created from [LWplot_residuals] |
|
31 | 11 |
# Jul 30, 2015: - made it respect outGrid_ selection |
12 |
# - modified $ens_tics |
|
34 | 13 |
# Jan 26, 2016: - added return on no data to plot |
41 | 14 |
# 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
|
15 |
# May 18, 2016: - added version |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
16 |
# - expunged $realLastGoodEns |
30 | 17 |
|
18 |
require "$ANTS/libGMT.pl"; |
|
19 |
||
20 |
sub plot_residuals($) |
|
21 |
{ |
|
22 |
my($pfn) = @_; |
|
23 |
||
34 | 24 |
return unless ($P{max_depth}); |
25 |
||
30 | 26 |
my($xmin) = $P{min_ens}-0.5; |
27 |
my($xmax) = $P{max_ens}+0.5; |
|
28 |
my($ymin) = 0; |
|
29 |
my($ymax) = ($P{water_depth} > 0) ? |
|
30 |
round($P{water_depth} + 25) : |
|
31 |
round($P{max_depth} + $P{ADCP_bin_length}); |
|
32 |
||
33 |
my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1); |
|
34 |
my($bin_length) = 10 * $P{ADCP_bin_length} / |
|
35 |
($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length}); |
|
36 |
||
37 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax"; |
|
38 |
GMT_begin($pfn,'-JX10/-10',$R,'-P'); |
|
39 |
||
40 |
my($C) = "-C$WCALC/residuals.cpt"; |
|
41 |
GMT_psxy("$C -Sr"); |
|
42 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
|
43 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
44 |
my(@bindepth) = calc_binDepths($ens); |
|
45 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
31 | 46 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
30 | 47 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
48 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
49 |
printf(GMT "%d %f %f $ens_width $bin_length\n", |
|
50 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
51 |
$bindepth[$bin], |
|
52 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi]); |
|
53 |
} |
|
54 |
} |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
55 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # upcast |
30 | 56 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
57 |
my(@bindepth) = calc_binDepths($ens); |
|
58 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
31 | 59 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
30 | 60 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
61 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
62 |
printf(GMT "%d %f %f $ens_width $bin_length\n", |
|
63 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
64 |
$bindepth[$bin], |
|
65 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi]); |
|
66 |
} |
|
67 |
} |
|
68 |
||
69 |
if ($P{water_depth} > 0) { # SEABED |
|
70 |
GMT_psxy('-G204/153/102'); |
|
71 |
print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n"); |
|
72 |
} |
|
73 |
||
74 |
GMT_unitcoords(); # LABELS |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
75 |
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
|
76 |
print(GMT "0.99 0.01 V$VERSION\n"); |
41 | 77 |
GMT_pstext('-F+f14,Helvetica,blue+jTL -N'); |
78 |
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n"); |
|
30 | 79 |
|
80 |
my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES |
|
31 | 81 |
my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a2000'; |
30 | 82 |
GMT_setR($R); |
83 |
GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn"); |
|
84 |
||
85 |
GMT_setAnnotFontSize(7); # SCALE BAR |
|
41 | 86 |
# GMT_psscale("-E -D8/2/3/0.4 $C -B/:residuals:"); |
87 |
GMT_psscale("-Dn0.83/0.1+w3/0.4+e $C -B/:residuals:"); |
|
30 | 88 |
|
89 |
GMT_end(); # FINISH PLOT |
|
90 |
} |
|
91 |
||
92 |
1; # return true on require |