author | A.M. Thurnherr <athurnherr@yahoo.com> |
Tue, 06 Dec 2022 12:47:21 -0500 | |
changeset 64 | 58ef697c01ae |
parent 56 | 8f120b9f795a |
permissions | -rw-r--r-- |
30 | 1 |
#====================================================================== |
2 |
# P L O T _ C O R R E L A T I O N . P L |
|
3 |
# doc: Tue Jul 28 13:21:09 2015 |
|
56 | 4 |
# dlm: Thu Jul 1 13:24:42 2021 |
30 | 5 |
# (c) 2015 A.M. Thurnherr |
56 | 6 |
# uE-Info: 18 47 NIL 0 0 72 0 2 4 NIL ofnI |
30 | 7 |
#====================================================================== |
8 |
||
9 |
# HISTORY: |
|
10 |
# Jul 28, 2015: - created from [LWplot_corr] |
|
34 | 11 |
# Jan 26, 2016: - added return on no data to plot |
41 | 12 |
# 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
|
13 |
# May 18, 2016: - added version |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
14 |
# - expunged $realLastGoodEns |
46 | 15 |
# May 24, 2016: - calc_binDepths() -> binDepths() |
16 |
# - fixed for partial-depth casts |
|
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
17 |
# Oct 29, 2019: - updated psscale -B to gmt5 syntax |
56 | 18 |
# Jul 1, 2021: - adapted to more std %PARAMs |
30 | 19 |
|
20 |
require "$ANTS/libGMT.pl"; |
|
21 |
||
22 |
sub plot_correlation($) |
|
23 |
{ |
|
24 |
my($pfn) = @_; |
|
25 |
||
56 | 26 |
return unless ($P{'depth.max'}); |
34 | 27 |
|
56 | 28 |
my($xmin) = $P{'ens.min'}-0.5; |
29 |
my($xmax) = $P{'ens.max'}+0.5; |
|
30 |
my($ymin) = round(antsParam('depth.min')-25,50); |
|
30 | 31 |
my($ymax) = ($P{water_depth} > 0) ? |
46 | 32 |
round($P{water_depth}+25,50) : |
56 | 33 |
round($P{'depth.max'}+$P{ADCP_bin_length}+25,50); |
30 | 34 |
|
56 | 35 |
my($ens_width) = 10 / ($P{'ens.max'} - $P{'ens.min'} + 1); |
30 | 36 |
my($bin_length) = 10 * $P{ADCP_bin_length} / |
56 | 37 |
($P{'depth.max'}-$P{'depth.min'}+$P{ADCP_bin_length}); |
30 | 38 |
|
39 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax"; |
|
40 |
GMT_begin($pfn,'-JX10/-10',$R,'-P'); |
|
41 |
||
42 |
my($C) = "-C$WCALC/corr.cpt"; |
|
43 |
GMT_psxy("$C -Sr"); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
44 |
for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
30 | 45 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 46 |
my(@bindepth) = binDepths($ens); |
30 | 47 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
48 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
49 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
50 |
printf(GMT "%d %f %f $ens_width $bin_length\n", |
|
51 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
52 |
$bindepth[$bin], |
|
53 |
$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]); |
|
54 |
} |
|
55 |
} |
|
56 |
||
57 |
if ($P{water_depth} > 0) { # SEABED |
|
58 |
GMT_psxy('-G204/153/102'); |
|
59 |
print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n"); |
|
60 |
} |
|
61 |
||
62 |
GMT_unitcoords(); # LABELS |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
41
diff
changeset
|
63 |
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
|
64 |
print(GMT "0.99 0.01 V$VERSION\n"); |
41 | 65 |
GMT_pstext('-F+f14,Helvetica,blue+jTL -N'); |
66 |
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n"); |
|
30 | 67 |
|
46 | 68 |
my($depth_tics) = ($ymax-$ymin < 1000) ? 'f10a100' : 'f100a500'; # AXES |
69 |
my($ens_tics) = ($xmax-$xmin < 4000) ? 'f50a500' : 'f500a2000'; |
|
30 | 70 |
GMT_setR($R); |
71 |
GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn"); |
|
72 |
||
73 |
GMT_setAnnotFontSize(7); # SCALE BAR |
|
53
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
74 |
# GMT_psscale("-Dn0.85/0.1+w3/0.4+e $C -B/:corr:"); |
b4374f1ebd60
updated psscale -B argument to gmt5 syntax
Andreas Thurnherr
parents:
46
diff
changeset
|
75 |
GMT_psscale("-Dn0.85/0.1+w3/0.4+e $C -By+lcorr"); |
30 | 76 |
|
77 |
GMT_end(); # FINISH PLOT |
|
78 |
} |
|
79 |
||
80 |
1; # return true on require |