author | Andreas Thurnherr <ant@ldeo.columbia.edu> |
Sat, 10 Apr 2021 06:00:45 -0400 | |
changeset 55 | 2d8e1139acd5 |
parent 53 | b4374f1ebd60 |
child 56 | 8f120b9f795a |
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 |
|
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
4 |
# dlm: Tue Oct 29 13:14:19 2019 |
30 | 5 |
# (c) 2015 A.M. Thurnherr |
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
6 |
# uE-Info: 20 0 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 |
46 | 17 |
# May 24, 2016: - calc_binDepths() -> binDepths() |
18 |
# - fixed for partial-depth casts |
|
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
19 |
# Oct 29, 2019: - updated psscale -B to gmt5 syntax |
30 | 20 |
|
21 |
require "$ANTS/libGMT.pl"; |
|
22 |
||
23 |
sub plot_residuals($) |
|
24 |
{ |
|
25 |
my($pfn) = @_; |
|
26 |
||
34 | 27 |
return unless ($P{max_depth}); |
28 |
||
30 | 29 |
my($xmin) = $P{min_ens}-0.5; |
30 |
my($xmax) = $P{max_ens}+0.5; |
|
46 | 31 |
my($ymin) = round(antsParam('min_depth')-25,50); |
30 | 32 |
my($ymax) = ($P{water_depth} > 0) ? |
46 | 33 |
round($P{water_depth}+25,50) : |
34 |
round($P{max_depth}+$P{ADCP_bin_length}+25,50); |
|
30 | 35 |
|
36 |
my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1); |
|
37 |
my($bin_length) = 10 * $P{ADCP_bin_length} / |
|
38 |
($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length}); |
|
39 |
||
40 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax"; |
|
41 |
GMT_begin($pfn,'-JX10/-10',$R,'-P'); |
|
42 |
||
43 |
my($C) = "-C$WCALC/residuals.cpt"; |
|
44 |
GMT_psxy("$C -Sr"); |
|
45 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
|
46 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
46 | 47 |
my(@bindepth) = binDepths($ens); |
30 | 48 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
31 | 49 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
30 | 50 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
51 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
52 |
printf(GMT "%d %f %f $ens_width $bin_length\n", |
|
53 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
54 |
$bindepth[$bin], |
|
55 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi]); |
|
56 |
} |
|
57 |
} |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
58 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # upcast |
30 | 59 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 60 |
my(@bindepth) = binDepths($ens); |
30 | 61 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
31 | 62 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
30 | 63 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
64 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
65 |
printf(GMT "%d %f %f $ens_width $bin_length\n", |
|
66 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
67 |
$bindepth[$bin], |
|
68 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi]); |
|
69 |
} |
|
70 |
} |
|
71 |
||
72 |
if ($P{water_depth} > 0) { # SEABED |
|
73 |
GMT_psxy('-G204/153/102'); |
|
74 |
print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n"); |
|
75 |
} |
|
76 |
||
77 |
GMT_unitcoords(); # LABELS |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
78 |
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
|
79 |
print(GMT "0.99 0.01 V$VERSION\n"); |
41 | 80 |
GMT_pstext('-F+f14,Helvetica,blue+jTL -N'); |
81 |
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n"); |
|
30 | 82 |
|
46 | 83 |
my($depth_tics) = ($ymax-$ymin < 1000) ? 'f10a100' : 'f100a500'; # AXES |
84 |
my($ens_tics) = ($xmax-$xmin < 4000) ? 'f50a500' : 'f500a2000'; |
|
30 | 85 |
GMT_setR($R); |
86 |
GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn"); |
|
87 |
||
88 |
GMT_setAnnotFontSize(7); # SCALE BAR |
|
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
89 |
# GMT_psscale("-Dn0.83/0.1+w3/0.4+e $C -B/:w\@-residual\@-:"); |
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
90 |
GMT_psscale("-Dn0.83/0.1+w3/0.4+e $C -By+lw\@-residual\@-"); |
30 | 91 |
|
92 |
GMT_end(); # FINISH PLOT |
|
93 |
} |
|
94 |
||
95 |
1; # return true on require |