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
|
34
|
4 |
# dlm: Tue Jan 26 20:46:18 2016
|
30
|
5 |
# (c) 2015 A.M. Thurnherr
|
34
|
6 |
# uE-Info: 19 31 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
|
30
|
12 |
|
|
13 |
require "$ANTS/libGMT.pl";
|
|
14 |
|
|
15 |
sub plot_correlation($)
|
|
16 |
{
|
|
17 |
my($pfn) = @_;
|
|
18 |
|
34
|
19 |
return unless ($P{max_depth});
|
|
20 |
|
30
|
21 |
my($xmin) = $P{min_ens}-0.5;
|
|
22 |
my($xmax) = $P{max_ens}+0.5;
|
|
23 |
my($ymin) = 0;
|
|
24 |
my($ymax) = ($P{water_depth} > 0) ?
|
|
25 |
round($P{water_depth} + 25) :
|
|
26 |
round($P{max_depth} + $P{ADCP_bin_length});
|
|
27 |
|
|
28 |
my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
|
|
29 |
my($bin_length) = 10 * $P{ADCP_bin_length} /
|
|
30 |
($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
|
|
31 |
|
|
32 |
my($R) = "-R$xmin/$xmax/$ymin/$ymax";
|
|
33 |
GMT_begin($pfn,'-JX10/-10',$R,'-P');
|
|
34 |
|
|
35 |
my($C) = "-C$WCALC/corr.cpt";
|
|
36 |
GMT_psxy("$C -Sr");
|
|
37 |
for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
|
|
38 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
|
|
39 |
my(@bindepth) = calc_binDepths($ens);
|
|
40 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
|
|
41 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
|
|
42 |
my($bi) = $bindepth[$bin]/$opt_o;
|
|
43 |
printf(GMT "%d %f %f $ens_width $bin_length\n",
|
|
44 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER},
|
|
45 |
$bindepth[$bin],
|
|
46 |
$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]);
|
|
47 |
}
|
|
48 |
}
|
|
49 |
|
|
50 |
if ($P{water_depth} > 0) { # SEABED
|
|
51 |
GMT_psxy('-G204/153/102');
|
|
52 |
print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
|
|
53 |
}
|
|
54 |
|
|
55 |
GMT_unitcoords(); # LABELS
|
|
56 |
GMT_pstext(-Gblue);
|
|
57 |
print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
|
|
58 |
|
|
59 |
my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
|
31
|
60 |
my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a2000';
|
30
|
61 |
GMT_setR($R);
|
|
62 |
GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
|
|
63 |
|
|
64 |
GMT_setAnnotFontSize(7); # SCALE BAR
|
|
65 |
GMT_psscale("-E -D8/2/3/0.4 $C -B/:corr:");
|
|
66 |
|
|
67 |
GMT_end(); # FINISH PLOT
|
|
68 |
}
|
|
69 |
|
|
70 |
1; # return true on require
|