--- a/HISTORY Thu May 12 10:54:28 2016 -0400
+++ b/HISTORY Thu May 19 09:38:56 2016 -0400
@@ -1,16 +1,24 @@
======================================================================
H I S T O R Y
doc: Mon Oct 12 16:09:24 2015
- dlm: Thu May 12 10:47:25 2016
+ dlm: Thu May 19 00:51:48 2016
(c) 2015 A.M. Thurnherr
- uE-Info: 124 23 NIL 0 0 72 3 2 4 NIL ofnI
+ uE-Info: 158 56 NIL 0 0 72 3 2 4 NIL ofnI
======================================================================
+----------------------------------------------------------------------
+First Released Version (howto does not cover VKE parameterization)
+----------------------------------------------------------------------
+
V1.0:
Oct 12, 2015:
- finalized HowTo V1.0 (antsLibVer V6.2, ADCP_tools V1.3)
- uploaded to Mercurial server
+----------------------------------------------------------------------
+First Version with Full HowTo (including VKE parameterization)
+----------------------------------------------------------------------
+
V1.1:
Oct 12, 2015: V1.1beta1
- added [version.pl]
@@ -29,6 +37,10 @@
- decreased default vertical resolution to 20m [defaults.pl] [LADCP_w_ocean]
- removed beta from version [version.pl] [.hg/hgrc]
+----------------------------------------------------------------------
+First Widely Released Version (many significant improvements)
+----------------------------------------------------------------------
+
V1.2:
Jan 5, 2016: V1.2beta
- updated [version.pl]
@@ -122,3 +134,25 @@
May 12, 2016:
- updated version to 1.2
- updated HowTo
+ - published
+
+----------------------------------------------------------------------
+Adding Corrections For Beam-Pointing Errors
+----------------------------------------------------------------------
+
+V1.3:
+ May 12, 2016:
+ - updated [version.pl]
+ - [LADCP_w_ocean] added fields to wsamp output
+
+ May 17-18, 2015:
+ - [LADCP_w_ocean] added fields to wsamp output
+ - modified _wprof fig (mean instead of rms tilts)
+ - minor mods elsewhere (e.g. version info in all plots)
+ - added new plots [defaults.pl] requiring mods to [LADCP_w_ocean]:
+ - [plot_acceleration_residuals.pl]
+ - [plot_attitude_biases_w.pl]
+ - [plot_attitude_residuals.pl]
+ - [plot_residual_profs.pl]
+ - removed assumption of 1500m/s ADCP soundspeed setting (various files)
+ - added correct w12, w34 for earth velocity data
--- a/LADCP_w_ocean Thu May 12 10:54:28 2016 -0400
+++ b/LADCP_w_ocean Thu May 19 09:38:56 2016 -0400
@@ -2,9 +2,9 @@
#======================================================================
# L A D C P _ W _ O C E A N
# doc: Fri Dec 17 18:11:13 2010
-# dlm: Wed Apr 6 10:28:40 2016
+# dlm: Thu May 19 00:57:30 2016
# (c) 2010 A.M. Thurnherr
-# uE-Info: 246 73 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 1879 0 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# TODO:
@@ -12,16 +12,12 @@
# - avoid over-plotting axis labels
# - allow for different nsamp magnitudes
# - add "dc" "uc" labels
-# - add software version
# - add seabed to eps.VKE profile
# - add seabed to LADCP_w_postproc .wprof output
# ! use instrument tilt in sidelobe editing
-# ! change w_tt output to w_t output; change -a to use w_t or remove -a?
# - worry about water-depth differences (disabled warning)
# - make upcast-flag valid for yoyo casts
# - make diagnostic output 3-beam field work for Earth coordinates
-# ? remove water-depth from BT code, which is not really used and a bit of an outlier
-# because mean and stddev are used instead of median/mad
$antsSummary = 'calculate vertical velocities from LADCP & CTD time series';
@@ -244,6 +240,15 @@
# - added -r default (0.04m/s)
# Mar 31, 2016: - changed version %PARAM
# Apr 6, 2016: - BUG: GMT test looked for psxy, rather than gmt binary
+# May 12, 2106: - added v12, v34 to wsamp output
+# May 17, 2016: - added residual12, residual34 to wsamp output
+# - changed pitch field in wsamp output to gimbal pitch
+# - added w_t to .wsamp output for completeness
+# May 18, 2016: - replaced rms_tilt by mean_tilt
+# - add (gimbal-)pitch, roll and residual{12,34} to wprof output
+# - expunged super-confusing $realLastGoodEns
+# - removed assumption of default 1500m/s sspd setting during acquisition
+# - added w12, w34 for earth-coordinates
# HISTORY END
# CTD REQUIREMENTS
@@ -255,9 +260,12 @@
# - %lat/%lon OPTIONAL
# 2-BEAM SOLUTIONS
-# - for beam-coordinate data, two separate two-beam solutions (w12 & w34) are calculated
-# - discrepancies can be indicative of package wake effects (e.g. MIXET data)
-# - for earth-coordinate data, w12 and w34 are simply copies of w
+# - both for beam- and earth-coordinate data, two separate two-beam
+# solutions (w12 & w34) are calculated:
+# - w12 corresponds to pitch axis
+# - w34 corresponds to roll axis
+# - the 2-beam solutions are largely independent of each other
+# => key for detecting data problems, such as package wakes
# NUMERICAL OPTIONS
# - the first option in the list cannot be numerical!
@@ -347,7 +355,7 @@
"[calculate -n) <lags,lags[$opt_n]>] [lag -w)indow <sz,sz[$opt_w s]>] [lag-p)iece <CTD_elapsed_min|+[,...]>]",
"[require top-3) lags to account for <frac[$opt_3]> of all]",
"[disable time-l)ag filtering]",
- "[pressure-sensor -a)cceleration correction <residual/CTD_w_tt>]",
+ "[pressure-sensor -a)cceleration-derivative correction <residual/CTD_w_tt>]",
"[-o)utput bin <resolution[$opt_o m]>] [-k) require <min[$opt_k]> samples]",
"[e-x)ecute <perl-expr>]",
"<profile-id> [run-label]");
@@ -483,7 +491,6 @@
# Read LADCP data
#
# sanity checks:
-# - 1500m/s sound speed
# - single-ping ensembles
#
# warnings:
@@ -497,8 +504,6 @@
error("$LADCP_file: cannot process multi-ping ensembles\n")
unless ($LADCP{PINGS_PER_ENSEMBLE} == 1);
-error(sprintf("$LADCP_file: unsupported soundspeed setting (%d m/s != 1500 m/s)\n",$LADCP{ENSEMBLE}[0]->{SPEED_OF_SOUND}))
- unless ($LADCP{ENSEMBLE}[0]->{SPEED_OF_SOUND} == 1500);
warning(2,"$LADCP_file: wide-bandwidth setting\n")
if ($LADCP{WIDE_BANDWIDTH});
warning(2,"$LADCP_file: low transmit-power setting\n")
@@ -645,8 +650,8 @@
$LADCP{ENSEMBLE}[$ens]->{V_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V}[$bin];
$LADCP{ENSEMBLE}[$ens]->{W_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin];
- ($dummy,$LADCP{ENSEMBLE}[$ens]->{W12}[$bin],
- $dummy,$LADCP{ENSEMBLE}[$ens]->{W34}[$bin]) =
+ ($LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{W12}[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{V34}[$bin],$LADCP{ENSEMBLE}[$ens]->{W34}[$bin]) =
velBeamToBPEarth(\%LADCP,$ens,@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]});
}
}
@@ -673,7 +678,12 @@
$LADCP{ENSEMBLE}[$ens]->{V_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V}[$bin];
$LADCP{ENSEMBLE}[$ens]->{W_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin];
- $LADCP{ENSEMBLE}[$ens]->{W12}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W34}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin];
+ $LADCP{ENSEMBLE}[$ens]->{V12}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V34}[$bin] = nan;
+
+ # for 3-beam solutions, the following code sets w12 and w34 equal to w
+ my($delta) = $LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin] * sqrt(2)/2 * tan(rad($LADCP{BEAM_ANGLE}));
+ $LADCP{ENSEMBLE}[$ens]->{W12}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin] - $delta;
+ $LADCP{ENSEMBLE}[$ens]->{W34}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin] + $delta;
}
}
progress("\t$nvw valid velocities in bins $LADCP_firstBin-$LADCP_lastBin\n");
@@ -796,16 +806,16 @@
last;
}
-my($dc_sumsq,$dc_n,$uc_sumsq,$uc_n) = (0,0,0,0);
+my($dc_sumTilts,$dc_n,$uc_sumTilts,$uc_n) = (0,0,0,0);
$fprm = $pte = 0;
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) {
my($ne) = editTilt($ens,$opt_t);
if ($ne == 0) {
if ($ens <= $LADCP_atbottom) {
- $dc_sumsq += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT});
+ $dc_sumTilts += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT});
$dc_n++;
} else {
- $uc_sumsq += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT});
+ $uc_sumTilts += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT});
$uc_n++;
}
} else {
@@ -813,9 +823,9 @@
}
$fprm += editFarBins($ens,$first_bad_bin) if defined($first_bad_bin);
}
-my($dc_rms_tilt) = ($dc_n > 0) ? sqrt($dc_sumsq/$dc_n) : nan;
-my($uc_rms_tilt) = ($uc_n > 0) ? sqrt($uc_sumsq/$uc_n) : nan;
-&antsAddParams('dc_rms_tilt',$dc_rms_tilt,'uc_rms_tilt',$uc_rms_tilt);
+my($dc_mean_tilt) = ($dc_n > 0) ? sqrt($dc_sumTilts/$dc_n) : nan;
+my($uc_mean_tilt) = ($uc_n > 0) ? sqrt($uc_sumTilts/$uc_n) : nan;
+&antsAddParams('dc_mean_tilt',$dc_mean_tilt,'uc_mean_tilt',$uc_mean_tilt);
progress("\tattitude threshold (max_tilt = %d deg): %d velocites removed (%d%% of total)\n",
$opt_t,$pte,round(100*$pte/$nvv));
@@ -994,7 +1004,7 @@
undef($CTD{TIME_LAG}); # to avoid confusion, clear old 1Hz-based lag
#------------------------------------------------
-# Merge CTD with LADCP data
+# Merge (associate) CTD with LADCP data
# - after this step, reflr w is sound-speed corrected!!!
#------------------------------------------------
@@ -1025,12 +1035,12 @@
if ($skipped > 0) {
$firstGoodEns++,$skipped++,next # in gap
unless defined($LADCP{ENSEMBLE}[$firstGoodEns]->{REFLR_W});
- info("$skipped initial LADCP ensembles skipped because CTD data begin with LADCP in water\n");
+ info("\t$skipped initial LADCP ensembles skipped because CTD data begin with LADCP in water\n");
$skipped = 0;
}
if ($scan > $#{$CTD{ELAPSED}}) {
while (!defined($LADCP{ENSEMBLE}[$ens-1]->{REFLR_W})) { $ens--; } # in gap
- info(sprintf("%d final LADCP ensembles skipped because CTD data end with LADCP in water\n",
+ info(sprintf("\t%d final LADCP ensembles skipped because CTD data end with LADCP in water\n",
$lastGoodEns-$ens+1));
$lastGoodEns = $ens-1;
last;
@@ -1041,12 +1051,13 @@
if (defined($LADCP{ENSEMBLE}[$ens]->{REFLR_W}) # not a gap
&& numberp($CTD{DEPTH}[$scan])) {
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NOSSCORR} = $LADCP{ENSEMBLE}[$ens]->{REFLR_W};
- $LADCP{ENSEMBLE}[$ens]->{REFLR_W} *= $CTD{SVEL}[$scan]/1500; # correct for sound-speed variations at source
+ $LADCP{ENSEMBLE}[$ens]->{REFLR_W} *= # correct for sound-speed variations at source
+ $CTD{SVEL}[$scan] / $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND};
error(sprintf("\n$0: negative depth (%.1fm) in CTD file at elapsed(CTD) = %.1fs\n",
$CTD{DEPTH}[$scan],$CTD{ELAPSED}[$scan]))
unless ($CTD{DEPTH}[$scan] >= 0);
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} = $CTD{DEPTH}[$scan];
- $LADCP{ENSEMBLE}[$ens]->{CTD_SCAN} = $scan; # calc rms package acceleration
+ $LADCP{ENSEMBLE}[$ens]->{CTD_SCAN} = $scan; # used for other CTD fields
if (numberp($CTD{W_t}[$scan])) {
if ($ens <= $LADCP_atbottom) {
$dc_sumsq += &SQR($CTD{W_t}[$scan]); $dc_n++;
@@ -1333,32 +1344,38 @@
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W12}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin])
if numberp($LADCP{ENSEMBLE}[$ens]->{W12}[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W34}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin])
if numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin] =
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}];
+ $LADCP{ENSEMBLE}[$ens]->{V12}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND};
+ $LADCP{ENSEMBLE}[$ens]->{V34}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND};
my($bi) = $bindepth[$bin]/$opt_o;
push(@{$DNCAST{ENSEMBLE}[$bi]},$ens);
push(@{$DNCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$DNCAST{CTD_W}[$bi]},$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$DNCAST{CTD_W_tt}[$bi]},$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$DNCAST{BIN}[$bi]},$bin);
push(@{$DNCAST{DEPTH}[$bi]},$bindepth[$bin]);
push(@{$DNCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]);
push(@{$DNCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]);
push(@{$DNCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ push(@{$DNCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]);
+ push(@{$DNCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]);
+ push(@{$DNCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH});
+ push(@{$DNCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL});
}
}
@@ -1368,13 +1385,17 @@
$DNCAST{MEDIAN_W}[$bi] = median(@{$DNCAST{W}[$bi]});
$DNCAST{MEDIAN_W12}[$bi] = median(@{$DNCAST{W12}[$bi]});
$DNCAST{MEDIAN_W34}[$bi] = median(@{$DNCAST{W34}[$bi]});
+ $DNCAST{MEDIAN_V12}[$bi] = median(@{$DNCAST{V12}[$bi]});
+ $DNCAST{MEDIAN_V34}[$bi] = median(@{$DNCAST{V34}[$bi]});
+ $DNCAST{MEAN_PITCH}[$bi] = avg(@{$DNCAST{PITCH}[$bi]});
+ $DNCAST{MEAN_ROLL}[$bi] = avg(@{$DNCAST{ROLL}[$bi]});
$DNCAST{MAD_W}[$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{W}[$bi]});
$DNCAST{N_SAMP}[$bi] = @{$DNCAST{W}[$bi]};
}
progress("\tupcast...\n"); # upcast
-for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) {
+for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
$realLastGoodEns = $ens;
my(@bindepth) = calc_binDepths($ens);
@@ -1386,32 +1407,38 @@
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W12}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin])
if numberp($LADCP{ENSEMBLE}[$ens]->{W12}[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] =
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W34}[$bin],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND},
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},
$bindepth[$bin])
if numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin] =
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}];
+ $LADCP{ENSEMBLE}[$ens]->{V12}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND};
+ $LADCP{ENSEMBLE}[$ens]->{V34}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND};
my($bi) = $bindepth[$bin]/$opt_o;
push(@{$UPCAST{ENSEMBLE}[$bi]},$ens);
push(@{$UPCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$UPCAST{CTD_W}[$bi]},$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$UPCAST{CTD_W_tt}[$bi]},$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]);
-# push(@{$UPCAST{BIN}[$bi]},$bin);
push(@{$UPCAST{DEPTH}[$bi]},$bindepth[$bin]);
push(@{$UPCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]);
push(@{$UPCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]);
push(@{$UPCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ push(@{$UPCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]);
+ push(@{$UPCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]);
+ push(@{$UPCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH});
+ push(@{$UPCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL});
}
}
@@ -1421,6 +1448,10 @@
$UPCAST{MEDIAN_W}[$bi] = median(@{$UPCAST{W}[$bi]});
$UPCAST{MEDIAN_W12}[$bi] = median(@{$UPCAST{W12}[$bi]});
$UPCAST{MEDIAN_W34}[$bi] = median(@{$UPCAST{W34}[$bi]});
+ $UPCAST{MEDIAN_V12}[$bi] = median(@{$DNCAST{V12}[$bi]});
+ $UPCAST{MEDIAN_V34}[$bi] = median(@{$DNCAST{V34}[$bi]});
+ $UPCAST{MEAN_PITCH}[$bi] = avg(@{$UPCAST{PITCH}[$bi]});
+ $UPCAST{MEAN_ROLL}[$bi] = avg(@{$UPCAST{ROLL}[$bi]});
$UPCAST{MAD_W}[$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{W}[$bi]});
$UPCAST{N_SAMP}[$bi] = @{$UPCAST{W}[$bi]};
}
@@ -1431,7 +1462,7 @@
# 1) acceleration-dependence of Paroscientific pressure measurements; O(10cm/s) [IWISE 28]
# 2) residual CTD/LADCP mismatch errors; O(1cm/s) [Thurnherr, CWTMC 2011]
# 3) ADCP short-term variability; O(1cm/s) for vertical?
-# - two steps:
+# - multiple sub-steps:
# - remove ensemble-median residual from all ocean vertical velocities
# - re-bin profiles
# - calculate new residuals
@@ -1459,16 +1490,14 @@
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} = median(@residuals); # NB: can be nan!
next unless numberp($LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W});
- for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { # remove from ocean velocities
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { # subtract from ocean velocities
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] -=
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W};
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] -=
- $LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W}
- if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]);
+ $LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W};
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] -=
- $LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W}
- if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ $LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W};
}
$LADCP{ENSEMBLE}[$ens]->{REFLR_W} -= # NB: this can be nan here
@@ -1597,21 +1626,65 @@
}
} # if defined($opt_r)
-#--------------------------------------------
-# Calculate and Output Bin-Averaged Resiudals
-#--------------------------------------------
+$lastGoodEns = $realLastGoodEns; # now the ensemble range is final
+
+&antsAddParams('min_depth',$min_depth,'max_depth',$max_depth, # define plot range limits
+ 'min_ens',$LADCP{ENSEMBLE}[$firstGoodEns]->{NUMBER},
+ 'max_ens',$LADCP{ENSEMBLE}[$lastGoodEns]->{NUMBER},
+ 'min_elapsed',$LADCP{ENSEMBLE}[$firstGoodEns]->{CTD_ELAPSED},
+ 'max_elapsed',$LADCP{ENSEMBLE}[$lastGoodEns]->{CTD_ELAPSED});
+
+#-----------------------------------------------
+# Add residuals to depth-binned profiles (wprof)
+#-----------------------------------------------
+
+progress("Binning vertical-velocity residuals into depth profiles...");
-&antsAddParams('min_depth',$min_depth,'max_depth',$max_depth, # plot range limits
- 'min_ens',$LADCP{ENSEMBLE}[$firstGoodEns]->{NUMBER},
- 'max_ens',$LADCP{ENSEMBLE}[$realLastGoodEns]->{NUMBER},
- 'min_elapsed',$LADCP{ENSEMBLE}[$firstGoodEns]->{CTD_ELAPSED},
- 'max_elapsed',$LADCP{ENSEMBLE}[$realLastGoodEns]->{CTD_ELAPSED});
+for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ next unless numberp($DNCAST{MEDIAN_W}[$bi]);
+ push(@{$DNCAST{RESIDUAL12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]-$DNCAST{MEDIAN_W}[$bi]);
+ push(@{$DNCAST{RESIDUAL34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]-$DNCAST{MEDIAN_W}[$bi]);
+ }
+}
+for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) {
+ $DNCAST{MEAN_RESIDUAL12}[$bi] = avg(@{$DNCAST{RESIDUAL12}[$bi]});
+ $DNCAST{MEAN_RESIDUAL34}[$bi] = avg(@{$DNCAST{RESIDUAL34}[$bi]});
+}
+
+for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ next unless numberp($UPCAST{MEDIAN_W}[$bi]);
+ push(@{$UPCAST{RESIDUAL12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]-$UPCAST{MEDIAN_W}[$bi]);
+ push(@{$UPCAST{RESIDUAL34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]-$UPCAST{MEDIAN_W}[$bi]);
+ }
+}
+for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) {
+ $UPCAST{MEAN_RESIDUAL12}[$bi] = avg(@{$UPCAST{RESIDUAL12}[$bi]});
+ $UPCAST{MEAN_RESIDUAL34}[$bi] = avg(@{$UPCAST{RESIDUAL34}[$bi]});
+}
+
+progress("\n");
+
+#-------------------------------------------------
+# Calculate and Output ADCP-Bin-Averaged Residuals
+#-------------------------------------------------
if (@out_BR) {
- progress("Binning residuals...");
+ progress("Binning vertical-velocity residuals wrt. ADCP bin number...");
local(@dc_bres,@uc_bres);
- for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast
+ for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # DOWNCAST
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -1621,7 +1694,7 @@
- $DNCAST{MEDIAN_W}[$bindepth[$bin]/$opt_o]);
}
}
- for ($ens=$LADCP_atbottom; $ens<=$realLastGoodEns; $ens++) { # upcast
+ for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # UPCAST
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -1674,7 +1747,7 @@
local($dc_bres_rms) = ($dc_n > 0) ? sqrt($dc_sumsq/$dc_n) : nan;
local($uc_bres_rms) = ($uc_n > 0) ? sqrt($uc_sumsq/$uc_n) : nan;
- progress("\nWriting binned residuals to ");
+ progress("\n\twriting binned residuals to ");
my($saveParams) = $antsCurParams;
@antsNewLayout = ('bin','dc_residual','dc_residual.sig','dc_residual.nsamp',
@@ -1708,7 +1781,7 @@
if (defined($water_depth)) {
progress("Calculating BT-referenced vertical velocities\n");
- calc_BTprof($firstGoodEns,$realLastGoodEns,$water_depth,$sig_water_depth);
+ calc_BTprof($firstGoodEns,$lastGoodEns,$water_depth,$sig_water_depth);
my($sumSq) = my($n) = 0;
for (my($bi)=0; $bi<=$#{$BT{MEDIAN_W}}; $bi++) {
@@ -1728,13 +1801,14 @@
# output all samples (-w)
#------------------------
-# NB: residual field is calculated with respect to down-/upcast medians in -o-size bins
+# NB: residual fields are calculated with respect to down-/upcast medians in -o-size bins
if (@out_wsamp) {
progress("Writing vertical-velocity data to ");
@antsNewLayout = ('ensemble','bin','elapsed','depth','CTD_depth','downcast',
- 'w','w12','w34','residual','CTD_w','CTD_w_tt','LADCP_w','errvel',
- 'correlation','echo_amplitude','Sv',
+ 'w','w12','w34','v12','v34','residual','residual12','residual34',
+ 'CTD_w','CTD_w_t','CTD_w_tt','LADCP_w',
+ 'errvel','correlation','echo_amplitude','Sv',
'pitch','roll','tilt','heading','3_beam','svel');
foreach my $of (@out_wsamp) {
@@ -1762,17 +1836,21 @@
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},1,
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin],
- $LADCP{BEAM_COORDINATES} ? $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] : nan,
- $LADCP{BEAM_COORDINATES} ? $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] : nan,
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{V34}[$bin],
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $CTD{W_t}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin],
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin],
median(@{$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]}),
median(@{$LADCP{ENSEMBLE}[$ens]->{ECHO_AMPLITUDE}[$bin]}),
$LADCP{ENSEMBLE}[$ens]->{SV}[$bin],
- $LADCP{ENSEMBLE}[$ens]->{PITCH},
+ $LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH},
$LADCP{ENSEMBLE}[$ens]->{ROLL},
$LADCP{ENSEMBLE}[$ens]->{TILT},
$LADCP{ENSEMBLE}[$ens]->{HEADING},
@@ -1785,7 +1863,7 @@
} # for $bin
} # for $ens
- for ($ens=$LADCP_atbottom; $ens<=$realLastGoodEns; $ens++) { # upcast
+ for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # upcast
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -1796,17 +1874,21 @@
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},0,
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin],
- $LADCP{BEAM_COORDINATES} ? $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] : nan,
- $LADCP{BEAM_COORDINATES} ? $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] : nan,
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{V34}[$bin],
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi],
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
+ $CTD{W_t}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}],
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin],
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin],
median(@{$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]}),
median(@{$LADCP{ENSEMBLE}[$ens]->{ECHO_AMPLITUDE}[$bin]}),
$LADCP{ENSEMBLE}[$ens]->{SV}[$bin],
- $LADCP{ENSEMBLE}[$ens]->{PITCH},
+ $LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH},
$LADCP{ENSEMBLE}[$ens]->{ROLL},
$LADCP{ENSEMBLE}[$ens]->{TILT},
$LADCP{ENSEMBLE}[$ens]->{HEADING},
@@ -1830,8 +1912,8 @@
if (@out_profile) {
progress("Writing vertical-velocity profiles to ");
- @antsNewLayout = ('depth','hab','dc_depth','dc_elapsed','dc_w','dc_w.mad','dc_w.nsamp','dc_w12','dc_w34',
- 'uc_depth','uc_elapsed','uc_w','uc_w.mad','uc_w.nsamp','uc_w12','uc_w34',
+ @antsNewLayout = ('depth','hab','dc_depth','dc_elapsed','dc_w','dc_w.mad','dc_w.nsamp','dc_w12','dc_w34','dc_v12','dc_v34',
+ 'uc_depth','uc_elapsed','uc_w','uc_w.mad','uc_w.nsamp','uc_w12','uc_w34','uc_v12','uc_v34',
'BT_w','BT_w.mad','BT_w.nsamp');
foreach my $of (@out_profile) {
@@ -1855,10 +1937,12 @@
$DNCAST{N_SAMP}[$bi]>=$opt_k?$DNCAST{MEDIAN_W}[$bi]:nan,
$DNCAST{MAD_W}[$bi],$DNCAST{N_SAMP}[$bi],
$DNCAST{MEDIAN_W12}[$bi],$DNCAST{MEDIAN_W34}[$bi],
+ $DNCAST{MEDIAN_V12}[$bi],$DNCAST{MEDIAN_V34}[$bi],
$UPCAST{MEAN_DEPTH}[$bi],$UPCAST{MEAN_ELAPSED}[$bi], # uc data
$UPCAST{N_SAMP}[$bi]>=$opt_k?$UPCAST{MEDIAN_W}[$bi]:nan,
$UPCAST{MAD_W}[$bi],$UPCAST{N_SAMP}[$bi],
$UPCAST{MEDIAN_W12}[$bi],$UPCAST{MEDIAN_W34}[$bi],
+ $UPCAST{MEDIAN_V12}[$bi],$UPCAST{MEDIAN_V34}[$bi],
$BT{N_SAMP}[$bi]>=$opt_k?$BT{MEDIAN_W}[$bi]:nan, # BT data
$BT{MAD_W}[$bi],$BT{N_SAMP}[$bi]
);
@@ -1891,7 +1975,7 @@
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
- for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) {
next unless defined($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my($reflr_oc_w) = defined($LADCP{ENSEMBLE}[$ens]->{REFLR_W})
? $LADCP{ENSEMBLE}[$ens]->{REFLR_W} - $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]
--- a/acoustic_backscatter.pl Thu May 12 10:54:28 2016 -0400
+++ b/acoustic_backscatter.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# A C O U S T I C _ B A C K S C A T T E R . P L
# doc: Wed Oct 20 13:02:27 2010
-# dlm: Sat Mar 26 06:10:57 2016
+# dlm: Wed May 18 20:36:57 2016
# (c) 2010 A.M. Thurnherr
-# uE-Info: 29 92 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 30 36 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -27,6 +27,7 @@
# Jun 18, 2015: - removed assertion marked by ##???, which bombed on P16N1#41 DL
# Jan 26, 2016: - added %PARAMs
# Mar 26, 2016: - BUG: nSv was declared local to this scope even though it is used outside
+# May 18, 2016: - improved logging
#----------------------------------------------------------------------
# Volume Scattering Coefficient, following Deines (IEEE 1999)
@@ -245,9 +246,9 @@
}
if (@wdepth) {
- info("%d bins with seabed signatures found (\@Sv_rng: @Sv_rng)\n",scalar(@wdepth));
+ info("\t%d bins with seabed signatures found (\@Sv_rng: @Sv_rng)\n",scalar(@wdepth));
} else {
- info("no bins with seabed signatures found\n");
+ info("\tno bins with seabed signatures found\n");
}
return (undef,undef) if (scalar(@wdepth) < $SS_min_samp); # require min number of samples
--- a/default_paths.pl Thu May 12 10:54:28 2016 -0400
+++ b/default_paths.pl Thu May 19 09:38:56 2016 -0400
@@ -1,13 +1,16 @@
#======================================================================
# D E F A U L T _ P A T H S . P L
# doc: Tue Mar 29 07:09:52 2016
-# dlm: Tue Mar 29 13:47:24 2016
+# dlm: Wed May 18 20:23:32 2016
# (c) 2016 A.M. Thurnherr
-# uE-Info: 11 0 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 13 44 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
# Mar 29, 2016: - split from [defaults.pl]
+# May 18, 2016: - added new attitude and acceleration residuals plots
+# - renamed mean_residual to bin_residuals plots
+# - added new residual_profs plot
#======================================================================
# ProcessingParams file selection
@@ -80,7 +83,7 @@
"$data_dir/$out_basename.wprof");
-#----------------------------------------------------------------------
+#--------------------------------------------------------------------------------------------------
# Vertical-velocity sample data output and plots:
#
# Data (in $data_dir):
@@ -91,8 +94,11 @@
# *_wsamp.ps vertical velocity time-depth plot
# *_residuals.ps residual vertical velocity time-depth plot
# *_backscatter.ps volume scattering coefficient time-depth plot
+# *_attitude_res.ps residuals binned wrt. pitch/roll
+# *_res_profs.ps residuals binned in depth
+# *_acceleration_res.ps OPTIONAL: residuals binned wrt. package acceleration derivative
# *_correlation.ps OPTIONAL: correlation time-depth plot
-#----------------------------------------------------------------------
+#--------------------------------------------------------------------------------------------------
push(@out_wsamp,"$data_dir/$out_basename.wsamp");
#push(@out_wsamp,sprintf('dump_residual_profiles(%s/residuals/%03d)',$data_dir,$PROF));
@@ -100,9 +106,11 @@
push(@out_wsamp,"plot_residuals($plot_dir/${out_basename}_residuals.ps)");
push(@out_wsamp,"plot_backscatter($plot_dir/${out_basename}_backscatter.ps)");
push(@out_wsamp,"plot_wsamp($plot_dir/${out_basename}_wsamp.ps)");
+push(@out_wsamp,"plot_attitude_residuals($plot_dir/${out_basename}_attitude_res.ps)");
+push(@out_wsamp,"plot_residual_profs($plot_dir/${out_basename}_residual_profs.ps)");
+#push(@out_wsamp,"plot_acceleration_residuals($plot_dir/${out_basename}_acceleration_res.ps)");
#push(@out_wsamp,"plot_correlation($plot_dir/${out_basename}_correlation.ps)");
-
#----------------------------------------------------------------------
# Time-series output
#
@@ -116,7 +124,7 @@
# Per-bin vertical-velocity residuals (plot only)
#----------------------------------------------------------------------
-@out_BR = ("plot_mean_residuals($plot_dir/${out_basename}_mean_residuals.ps)");
+@out_BR = ("plot_mean_residuals($plot_dir/${out_basename}_bin_residuals.ps)");
#----------------------------------------------------------------------
--- a/edit_data.pl Thu May 12 10:54:28 2016 -0400
+++ b/edit_data.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# E D I T _ D A T A . P L
# doc: Sat May 22 21:35:55 2010
-# dlm: Sun Jan 24 16:22:23 2016
+# dlm: Wed May 18 22:34:15 2016
# (c) 2010 A.M. Thurnherr
-# uE-Info: 433 31 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 269 0 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -33,6 +33,7 @@
# - croak -> error
# Sep 26, 2015: - added $vessel_draft to editSideLobes
# Jan 23, 2016: - added &editBadTimeLagging()
+# May 18, 2016: - removed assumption of 1500m/s soundspeed setting
# NOTES:
# - editCorr_Earthcoords() is overly conservative and removed most
@@ -265,7 +266,7 @@
my($range) = defined($wd) ? $wd - $LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}
: $LADCP{ENSEMBLE}[$e]->{CTD_DEPTH} - $vessel_draft;
$range = 0 if ($range < 0);
- my($sscorr) = $CTD{SVEL}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}] / 1500;
+ my($sscorr) = $CTD{SVEL}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}] / $LADCP{ENSEMBLE}[$e]->{SPEED_OF_SOUND};
my($goodBins) = ($range - $sscorr*$LADCP{DISTANCE_TO_BIN1_CENTER}) * cos(rad($LADCP{BEAM_ANGLE}))
/ ($sscorr*$LADCP{BIN_LENGTH})
- 1.5;
--- a/find_seabed.pl Thu May 12 10:54:28 2016 -0400
+++ b/find_seabed.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# F I N D _ S E A B E D . P L
# doc: Sun May 23 20:26:11 2010
-# dlm: Tue Jan 26 15:22:26 2016
+# dlm: Wed May 18 22:38:53 2016
# (c) 2010 A.M. Thurnherr
-# uE-Info: 16 33 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 22 0 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -14,6 +14,7 @@
# Oct 19, 2011: - added $SS_max_allowed_range
# - renamed $SS_min_allowed_hab to *_range
# Jan 26, 2016: - added %PARAMs
+# May 18, 2016: - removed assumption of 1500m/s soundspeed setting
# NOTES:
# 1) BT range is corrected for sound speed at the transducer. This is not
@@ -22,8 +23,7 @@
# to be small. The seabed depth is only used for sidelobe editing,
# which is done with a generous safety margin (from the UH shear
# method implementation).
-# 2) Acquisition sound speed of 1500m/s assumed.
-# 3) To be reasonably accurate, DEPTH must be from the CTD at this stage.
+# 2) To be reasonably accurate, DEPTH must be from the CTD at this stage.
#======================================================================
# (seabed median depth, mad) = find_seabed(dta ptr, btm ensno, coord flag)
@@ -63,7 +63,7 @@
$d->{ENSEMBLE}[$i]->{BT_RANGE}[2]/4 +
$d->{ENSEMBLE}[$i]->{BT_RANGE}[3]/4;
$d->{ENSEMBLE}[$i]->{DEPTH_BT} *= cos(rad($d->{BEAM_ANGLE}));
- $d->{ENSEMBLE}[$i]->{DEPTH_BT} *= $CTD{SVEL}[$d->{ENSEMBLE}[$i]->{CTD_SCAN}]/1500;
+ $d->{ENSEMBLE}[$i]->{DEPTH_BT} *= $CTD{SVEL}[$d->{ENSEMBLE}[$i]->{CTD_SCAN}]/$d->{ENSEMBLE}[$i]->{SPEED_OF_SOUND};
next unless ($d->{ENSEMBLE}[$i]->{DEPTH_BT} >= $SS_min_allowed_range &&
$d->{ENSEMBLE}[$i]->{DEPTH_BT} <= $SS_max_allowed_range);
$d->{ENSEMBLE}[$i]->{DEPTH_BT} *= -1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_acceleration_residuals.pl Thu May 19 09:38:56 2016 -0400
@@ -0,0 +1,220 @@
+#======================================================================
+# P L O T _ A C C E L E R A T I O N _ R E S I D U A L S . P L
+# doc: Tue May 17 21:40:08 2016
+# dlm: Wed May 18 19:43:18 2016
+# (c) 2016 A.M. Thurnherr
+# uE-Info: 46 37 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# May 17, 2016: - created from [plot_attitude_biases.pl]
+# May 18, 2016: - made work
+
+require "$ANTS/libGMT.pl";
+
+sub plot_acceleration_residuals($)
+{
+ my($pfn) = @_; # plot file name
+
+ my($xmin) = -1.5;
+ my($xmax) = 1.5;
+ my($ymin) = -0.03;
+ my($ymax) = 0.03;
+ my($bin_size) = 0.1; # m/s^3
+
+ my($min_thin) = 200;
+ my($min_fat) = 500;
+ my($btstrp_ndraw) = 20;
+ my($excluded_surf_layer) = 150;
+ my($hist_height) = 0.015;
+
+ my($xo1) = -0.03;
+ my($xo2) = -0.01;
+ my($xo3) = 0.01;
+ my($xo4) = 0.03;
+
+ #-------------------------------------------------------
+ # Bin-Average & Create Histogram from Beampair Residuals
+ # - use 0.1 m/s^3
+ # - also calculate mean/rms pitch
+ #-------------------------------------------------------
+
+ my(@pHistDC,@rHistDC,@pSumDC,@rSumDC,$pHistDC,$rHistDC,$pSumDC,$rSumDC);
+ my(@pHistUC,@rHistUC,@pSumUC,@rSumUC,$pHistUC,$rHistUC,$pSumUC,$rSumUC);
+ my(@pValsDC,@rValsDC,@pValsUC,@rValsUC,$mode);
+ my(@w_ttSumDC,@w_ttSumUC);
+ for (my($e)=$firstGoodEns; $e<=$lastGoodEns; $e++) {
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($e);
+
+ for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next if ($bindepth[$bin] <= $excluded_surf_layer);
+ next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]) &&
+ numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]);
+
+ my($hi) = int(($CTD{W_tt}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}]-$xmin)/$bin_size);
+ next unless ($hi >= 0);
+ my($bi) = $bindepth[$bin]/$opt_o;
+
+ if ($e < $LADCP_atbottom) { # DOWNCAST
+ $w_ttSumDC += $CTD{W_tt}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}]; $pHistDC++; $rHistDC++;
+ $pSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi];
+ $rSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi];
+ push(@{$pValsDC[$hi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
+ push(@{$rValsDC[$hi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
+ $pSumDC[$hi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi]; $pHistDC[$hi]++;
+ $rSumDC[$hi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi]; $rHistDC[$hi]++;
+ $mode = $pHistDC[$hi] if ($pHistDC[$hi] > $mode);
+ $mode = $rHistDC[$hi] if ($rHistDC[$hi] > $mode);
+ } else { # UPCAST
+ $w_ttSumUC += $CTD{W_tt}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}]; $pHistUC++; $rHistUC++;
+ $pSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi];
+ $rSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi];
+ push(@{$pValsUC[$hi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
+ push(@{$rValsUC[$hi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
+ $pSumUC[$hi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi]; $pHistUC[$hi]++;
+ $rSumUC[$hi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi]; $rHistUC[$hi]++;
+ $mode = $pHistUC[$hi] if ($pHistUC[$hi] > $mode);
+ $mode = $rHistUC[$hi] if ($rHistUC[$hi] > $mode);
+ }
+ }
+ }
+
+ #----------
+ # Plot Data
+ #----------
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax"; # plot frame
+ GMT_begin($pfn,'-JX10/10',$R,"-P -Bg0.5f0.1a0.5:'Acceleration Derivative (w\@-tt\@-) [m s\@+-3\@+]':/g0.01f0.001a0.01:'Beam-Plane Residual Vertical Velocity [m/s]':WeSn");
+
+ # ZERO LINE
+ GMT_psxy('-W4,CornflowerBlue');
+ print(GMT "$xmin 0\n$xmax 0\n");
+
+ # HISTOGRAMS
+ GMT_psxy('-W2,coral');
+ for (my($i)=0; $i<@pHistDC; $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i*$bin_size+$xmin+$xo2-($bin_size/2),$ymin,
+ $i*$bin_size+$xmin+$xo2-($bin_size/2),$ymin+$hist_height*$pHistDC[$i]/$mode,
+ $i*$bin_size+$xmin+$xo2+($bin_size/2),$ymin+$hist_height*$pHistDC[$i]/$mode,
+ $i*$bin_size+$xmin+$xo2+($bin_size/2),$ymin,
+ $i*$bin_size+$xmin+$xo2+($bin_size/2),$ymin+$hist_height*$pHistDC[$i]/$mode);
+ }
+ GMT_psxy('-W2,SeaGreen');
+ for (my($i)=0; $i<@pHistUC; $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i*$bin_size+$xmin+$xo3-($bin_size/2),$ymin,
+ $i*$bin_size+$xmin+$xo3-($bin_size/2),$ymin+$hist_height*$pHistUC[$i]/$mode,
+ $i*$bin_size+$xmin+$xo3+($bin_size/2),$ymin+$hist_height*$pHistUC[$i]/$mode,
+ $i*$bin_size+$xmin+$xo3+($bin_size/2),$ymin,
+ $i*$bin_size+$xmin+$xo3+($bin_size/2),$ymin+$hist_height*$pHistUC[$i]/$mode);
+ }
+
+ # DC PITCH
+ GMT_psxy('-Ey0.2/2,coral');
+ for (my($i)=0; $i<@pHistDC; $i++) {
+ next unless ($pHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral'); # dc pitch
+ for (my($i)=0; $i<@pHistDC; $i++) {
+ next unless ($pHistDC[$i]>=$min_thin && $pHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -Gcoral');
+ for (my($i)=0; $i<@pHistDC; $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i*$bin_size+$xmin+$xo1,$pSumDC[$i]/$pHistDC[$i]); # errorbar center symbol
+ }
+ if ($pHistDC) {
+ GMT_psxy('-W1,coral,8_2:0'); # averages (lines)
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$pSumDC/$pHistDC,$xmax,$pSumDC/$pHistDC); # bias
+ }
+
+ # DC ROLL
+ GMT_psxy('-Ey0.2/2,coral');
+ for (my($i)=0; $i<@rHistDC; $i++) {
+ next unless ($rHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo2,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral');
+ for (my($i)=0; $i<@rHistDC; $i++) {
+ next unless ($rHistDC[$i]>=$min_thin && $rHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo2,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,coral');
+ for (my($i)=0; $i<@rHistDC; $i++) {
+ next unless ($rHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i*$bin_size+$xmin+$xo2,$rSumDC[$i]/$rHistDC[$i]);
+ }
+ if ($rHistDC) {
+ GMT_psxy('-W1,coral,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$rSumDC/$rHistDC,$xmax,$rSumDC/$rHistDC);
+ }
+
+ # UC PITCH
+ GMT_psxy('-Ey0.2/2,SeaGreen');
+ for (my($i)=0; $i<@pHistUC; $i++) {
+ next unless ($pHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<@pHistUC; $i++) {
+ next unless ($pHistUC[$i]>=$min_thin && $pHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -GSeaGreen');
+ for (my($i)=0; $i<@pHistUC; $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i*$bin_size+$xmin+$xo3,$pSumUC[$i]/$pHistUC[$i]);
+ }
+ if ($pHistUC) {
+ GMT_psxy('-W1,SeaGreen,8_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$pSumUC/$pHistUC,$xmax,$pSumUC/$pHistUC);
+ }
+
+ # UC ROLL
+ GMT_psxy('-Ey0.2/2,SeaGreen');
+ for (my($i)=0; $i<@rHistUC; $i++) {
+ next unless ($rHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo4,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<@rHistUC; $i++) {
+ next unless ($rHistUC[$i]>=$min_thin && $rHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i*$bin_size+$xmin+$xo4,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,SeaGreen');
+ for (my($i)=0; $i<@rHistUC; $i++) {
+ next unless ($rHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i*$bin_size+$xmin+$xo4,$rSumUC[$i]/$rHistUC[$i]);
+ }
+ if ($rHistUC) {
+ GMT_psxy('-W1,SeaGreen,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$rSumUC/$rHistUC,$xmax,$rSumUC/$rHistUC);
+ }
+
+ # ANNOTATIONS
+ GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.99 V$VERSION\n");
+ GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id
+ print(GMT "0.0 1.03 $P{out_basename} $P{run_label}\n");
+
+ GMT_setR($R); # FINISH PLOT
+ GMT_end();
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_attitude_biases_w.pl Thu May 19 09:38:56 2016 -0400
@@ -0,0 +1,228 @@
+#======================================================================
+# P L O T _ A T T I T U D E _ B I A S E S _ W . P L
+# doc: Sun May 15 16:08:59 2016
+# dlm: Wed May 18 19:43:55 2016
+# (c) 2016 A.M. Thurnherr
+# uE-Info: 41 37 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# May 15, 2016: - created from [plot_mean_residuals.pl]
+# May 16, 2016: - continued
+# May 17, 2016: - renamed from [plot_attitude_biases.pl]
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
+
+require "$ANTS/libGMT.pl";
+
+sub plot_attitude_biases_w($)
+{
+ my($pfn) = @_; # plot file name
+
+ my($xmin) = -round($opt_t); # full pitch range
+ my($xmax) = round($opt_t);
+ my($ymin) = -0.05;
+ my($ymax) = 0.05;
+
+ my($min_thin) = 200;
+ my($min_fat) = 500;
+ my($btstrp_ndraw) = 20;
+ my($excluded_surf_layer) = 150;
+
+ #--------------------------------------------------------
+ # Bin-Average & Create Histogram from Beampair Velocities
+ # - use 1-degree bins for simplicity
+ # - use gimbal pitch (not measured pitch)
+ #--------------------------------------------------------
+
+ my(@pHistDC,@rHistDC,@pSumDC,@rSumDC,$pHistDC,$rHistDC,$pSumDC,$rSumDC);
+ my(@pHistUC,@rHistUC,@pSumUC,@rSumUC,$pHistUC,$rHistUC,$pSumUC,$rSumUC);
+ my(@pValsDC,@rValsDC,@pValsUC,@rValsUC,$mode);
+ for (my($e)=$firstGoodEns; $e<=$lastGoodEns; $e++) {
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($e);
+ for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next if ($bindepth[$bin] <= $excluded_surf_layer);
+ next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]) &&
+ numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ my($pi) = int($LADCP{ENSEMBLE}[$e]->{GIMBAL_PITCH}+$opt_t); # pitch/roll indices
+ my($ri) = int($LADCP{ENSEMBLE}[$e]->{ROLL}+$opt_t);
+ if ($e < $LADCP_atbottom) { # downcast
+ push(@{$pValsDC[$pi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]);
+ push(@{$rValsDC[$ri]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ $pSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]; $pHistDC++;
+ $rSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]; $rHistDC++;
+ $pSumDC[$pi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]; $pHistDC[$pi]++;
+ $rSumDC[$ri] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]; $rHistDC[$ri]++;
+ $mode = $pHistDC[$pi] if ($pHistDC[$pi] > $mode);
+ $mode = $rHistDC[$ri] if ($rHistDC[$ri] > $mode);
+ } else { # upcast
+ push(@{$pValsUC[$pi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]);
+ push(@{$rValsUC[$ri]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]);
+ $pSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]; $pHistUC++;
+ $rSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]; $rHistUC++;
+ $pSumUC[$pi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]; $pHistUC[$pi]++;
+ $rSumUC[$ri] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]; $rHistUC[$ri]++;
+ $mode = $pHistUC[$pi] if ($pHistUC[$pi] > $mode);
+ $mode = $rHistUC[$ri] if ($rHistUC[$ri] > $mode);
+ }
+ }
+ }
+
+ #----------
+ # Plot Data
+ #----------
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax"; # begin plot
+ GMT_begin($pfn,'-JX10/10',$R,"-P -Bg5f1a5:'Pitch/Roll [\260]':/g0.01f0.001a0.01:'Beam-Plane Vertical Velocity [m/s]':WeSn");
+
+ # ZERO LINE
+ GMT_psxy('-W4,CornflowerBlue');
+ print(GMT "$xmin 0\n$xmax 0\n");
+
+ # DC PITCH
+ GMT_psxy('-Ey0.2/2,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral'); # dc pitch
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i]>=$min_thin && $pHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -Gcoral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.3,$pSumDC[$i]/$pHistDC[$i]); # errorbar center symbol
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.3,$ymin+0.03*$pHistDC[$i]/$mode); # histogram symbol
+ }
+ if ($pHistDC) {
+ GMT_psxy('-W1,coral,8_2:0'); # average bias (horizontal line);
+ printf(GMT ">\n%f %f\n%f %f\n",-$opt_t,$pSumDC/$pHistDC,$opt_t,$pSumDC/$pHistDC)
+ }
+ GMT_psxy('-W2,coral,8_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n", # histogram bar
+ $i-round($opt_t)-0.3-0.5,$ymin,
+ $i-round($opt_t)-0.3-0.5,$ymin+0.03*$pHistDC[$i]/$mode,
+ $i-round($opt_t)-0.3+0.5,$ymin+0.03*$pHistDC[$i]/$mode,
+ $i-round($opt_t)-0.3+0.5,$ymin,
+ $i-round($opt_t)-0.3+0.5,$ymin+0.03*$pHistDC[$i]/$mode);
+ }
+
+ GMT_psxy('-Ey0.2/2,coral'); # dc roll
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i]>=$min_thin && $rHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.1,$rSumDC[$i]/$rHistDC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.1,$ymin+0.03*$rHistDC[$i]/$mode);
+ }
+ if ($rHistDC) {
+ GMT_psxy('-W1,coral,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",-$opt_t,$rSumDC/$rHistDC,$opt_t,$rSumDC/$rHistDC);
+ }
+ GMT_psxy('-W2,coral,2_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)-0.1-0.5,$ymin,
+ $i-round($opt_t)-0.1-0.5,$ymin+0.03*$rHistDC[$i]/$mode,
+ $i-round($opt_t)-0.1+0.5,$ymin+0.03*$rHistDC[$i]/$mode,
+ $i-round($opt_t)-0.1+0.5,$ymin,
+ $i-round($opt_t)-0.1+0.5,$ymin+0.03*$rHistDC[$i]/$mode);
+ }
+
+ GMT_psxy('-Ey0.2/2,SeaGreen'); # uc pitch
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i]>=$min_thin && $pHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -GSeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.1,$pSumUC[$i]/$pHistUC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.1,$ymin+0.03*$pHistUC[$i]/$mode);
+ }
+ if ($pHistUC) {
+ GMT_psxy('-W1,SeaGreen,8_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",-$opt_t,$pSumUC/$pHistUC,$opt_t,$pSumUC/$pHistUC);
+ }
+ GMT_psxy('-W2,SeaGreen,8_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)+0.1-0.5,$ymin,
+ $i-round($opt_t)+0.1-0.5,$ymin+0.03*$pHistUC[$i]/$mode,
+ $i-round($opt_t)+0.1+0.5,$ymin+0.03*$pHistUC[$i]/$mode,
+ $i-round($opt_t)+0.1+0.5,$ymin,
+ $i-round($opt_t)+0.1+0.5,$ymin+0.03*$pHistUC[$i]/$mode);
+ }
+
+ GMT_psxy('-Ey0.2/2,SeaGreen'); # uc roll
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i]>=$min_thin && $rHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.3,$rSumUC[$i]/$rHistUC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.3,$ymin+0.03*$rHistUC[$i]/$mode);
+ }
+ if ($rHistUC) {
+ GMT_psxy('-W1,SeaGreen,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",-$opt_t,$rSumUC/$rHistUC,$opt_t,$rSumUC/$rHistUC);
+ }
+ GMT_psxy('-W2,SeaGreen,2_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)+0.3-0.5,$ymin,
+ $i-round($opt_t)+0.3-0.5,$ymin+0.03*$rHistUC[$i]/$mode,
+ $i-round($opt_t)+0.3+0.5,$ymin+0.03*$rHistUC[$i]/$mode,
+ $i-round($opt_t)+0.3+0.5,$ymin,
+ $i-round($opt_t)+0.3+0.5,$ymin+0.03*$rHistUC[$i]/$mode);
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
+
+ GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id
+ print(GMT "0.0 1.03 $P{out_basename} $P{run_label}\n");
+
+ GMT_setR($R); # FINISH PLOT
+ GMT_end();
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_attitude_residuals.pl Thu May 19 09:38:56 2016 -0400
@@ -0,0 +1,247 @@
+#======================================================================
+# P L O T _ A T T I T U D E _ R E S I D U A L S . P L
+# doc: Sun May 15 16:08:59 2016
+# dlm: Wed May 18 19:44:19 2016
+# (c) 2016 A.M. Thurnherr
+# uE-Info: 45 37 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# May 15, 2016: - created from [plot_mean_residuals.pl]
+# May 16, 2016: - continued
+# May 17, 2016: - changed from w{12,34} to residual{12,34}
+# - added pitch/roll means
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
+
+require "$ANTS/libGMT.pl";
+
+sub plot_attitude_residuals($)
+{
+ my($pfn) = @_; # plot file name
+
+ my($xmin) = -round($opt_t); # full pitch range
+ my($xmax) = round($opt_t);
+ my($ymin) = -0.03;
+ my($ymax) = 0.03;
+
+ my($min_thin) = 200;
+ my($min_fat) = 500;
+ my($btstrp_ndraw) = 20;
+ my($excluded_surf_layer) = 150;
+ my($hist_height) = 0.015;
+
+ #-------------------------------------------------------
+ # Bin-Average & Create Histogram from Beampair Residuals
+ # - use 1-degree bins for simplicity
+ # - use gimbal pitch (not RDI pitch)
+ # - also calculate mean/rms pitch
+ #-------------------------------------------------------
+
+ my(@pHistDC,@rHistDC,@pSumDC,@rSumDC,$pHistDC,$rHistDC,$pSumDC,$rSumDC);
+ my(@pHistUC,@rHistUC,@pSumUC,@rSumUC,$pHistUC,$rHistUC,$pSumUC,$rSumUC);
+ my(@pValsDC,@rValsDC,@pValsUC,@rValsUC,$mode);
+ my(@pitchSumDC,@rollSumDC,@pitchSumUC,@rollSumUC);
+ for (my($e)=$firstGoodEns; $e<=$lastGoodEns; $e++) {
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($e);
+
+ for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next if ($bindepth[$bin] <= $excluded_surf_layer);
+ next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
+ next unless numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin]) &&
+ numberp($LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin]);
+
+ my($pi) = int($LADCP{ENSEMBLE}[$e]->{GIMBAL_PITCH}+$opt_t); # pitch/roll indices
+ my($ri) = int($LADCP{ENSEMBLE}[$e]->{ROLL}+$opt_t);
+ my($bi) = $bindepth[$bin]/$opt_o;
+
+ if ($e < $LADCP_atbottom) { # downcast
+ $pitchSumDC += $LADCP{ENSEMBLE}[$e]->{GIMBAL_PITCH}; $pHistDC++;
+ $rollSumDC += $LADCP{ENSEMBLE}[$e]->{ROLL}; $rHistDC++;
+ $pSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi];
+ $rSumDC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi];
+ push(@{$pValsDC[$pi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
+ push(@{$rValsDC[$ri]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
+ $pSumDC[$pi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $DNCAST{MEDIAN_W}[$bi]; $pHistDC[$pi]++;
+ $rSumDC[$ri] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi]; $rHistDC[$ri]++;
+ $mode = $pHistDC[$pi] if ($pHistDC[$pi] > $mode);
+ $mode = $rHistDC[$ri] if ($rHistDC[$ri] > $mode);
+ } else { # upcast
+ $pitchSumUC += $LADCP{ENSEMBLE}[$e]->{GIMBAL_PITCH}; $pHistUC++;
+ $rollSumUC += $LADCP{ENSEMBLE}[$e]->{ROLL}; $rHistUC++;
+ $pSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi];
+ $rSumUC += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi];
+ push(@{$pValsUC[$pi]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
+ push(@{$rValsUC[$ri]},$LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
+ $pSumUC[$pi] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W12}[$bin] - $UPCAST{MEDIAN_W}[$bi]; $pHistUC[$pi]++;
+ $rSumUC[$ri] += $LADCP{ENSEMBLE}[$e]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi]; $rHistUC[$ri]++;
+ $mode = $pHistUC[$pi] if ($pHistUC[$pi] > $mode);
+ $mode = $rHistUC[$ri] if ($rHistUC[$ri] > $mode);
+ }
+ }
+ }
+
+ #----------
+ # Plot Data
+ #----------
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax"; # plot frame
+ GMT_begin($pfn,'-JX10/10',$R,"-P -Bg5f1a5:'Pitch/Roll [\260]':/g0.01f0.001a0.01:'Beam-Plane Residual Vertical Velocity [m/s]':WeSn");
+
+ # ZERO LINE
+ GMT_psxy('-W4,CornflowerBlue');
+ print(GMT "$xmin 0\n$xmax 0\n");
+
+ # DC PITCH
+ GMT_psxy('-Ey0.2/2,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral'); # dc pitch
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i]>=$min_thin && $pHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsDC[$i]}); # 95% bootstrap conf limits
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -Gcoral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.3,$pSumDC[$i]/$pHistDC[$i]); # errorbar center symbol
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.3,$ymin+$hist_height*$pHistDC[$i]/$mode); # histogram symbol
+ }
+ if ($pHistDC) {
+ GMT_psxy('-W1,coral,8_2:0'); # averages (lines)
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$pSumDC/$pHistDC,$xmax,$pSumDC/$pHistDC); # bias
+ printf(GMT ">\n%f %f\n%f %f\n",$pitchSumDC/$pHistDC,$ymin,$pitchSumDC/$pHistDC,$ymax);# pitch
+ }
+ GMT_psxy('-W2,coral,8_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistDC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n", # histogram bar
+ $i-round($opt_t)-0.3-0.5,$ymin,
+ $i-round($opt_t)-0.3-0.5,$ymin+$hist_height*$pHistDC[$i]/$mode,
+ $i-round($opt_t)-0.3+0.5,$ymin+$hist_height*$pHistDC[$i]/$mode,
+ $i-round($opt_t)-0.3+0.5,$ymin,
+ $i-round($opt_t)-0.3+0.5,$ymin+$hist_height*$pHistDC[$i]/$mode);
+ }
+
+ # DC ROLL
+ GMT_psxy('-Ey0.2/2,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i]>=$min_thin && $rHistDC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsDC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)-0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,coral');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.1,$rSumDC[$i]/$rHistDC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)-0.1,$ymin+$hist_height*$rHistDC[$i]/$mode);
+ }
+ if ($rHistDC) {
+ GMT_psxy('-W1,coral,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$rSumDC/$rHistDC,$xmax,$rSumDC/$rHistDC);
+ printf(GMT ">\n%f %f\n%f %f\n",$rollSumDC/$rHistDC,$ymin,$rollSumDC/$rHistDC,$ymax);
+ }
+ GMT_psxy('-W2,coral,2_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistDC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)-0.1-0.5,$ymin,
+ $i-round($opt_t)-0.1-0.5,$ymin+$hist_height*$rHistDC[$i]/$mode,
+ $i-round($opt_t)-0.1+0.5,$ymin+$hist_height*$rHistDC[$i]/$mode,
+ $i-round($opt_t)-0.1+0.5,$ymin,
+ $i-round($opt_t)-0.1+0.5,$ymin+$hist_height*$rHistDC[$i]/$mode);
+ }
+
+ # UC PITCH
+ GMT_psxy('-Ey0.2/2,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i]>=$min_thin && $pHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$pValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.1,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sc0.15 -GSeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.1,$pSumUC[$i]/$pHistUC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.1,$ymin+$hist_height*$pHistUC[$i]/$mode);
+ }
+ if ($pHistUC) {
+ GMT_psxy('-W1,SeaGreen,8_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$pSumUC/$pHistUC,$xmax,$pSumUC/$pHistUC);
+ printf(GMT ">\n%f %f\n%f %f\n",$pitchSumUC/$pHistUC,$ymin,$pitchSumUC/$pHistUC,$ymax);
+ }
+ GMT_psxy('-W2,SeaGreen,8_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($pHistUC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)+0.1-0.5,$ymin,
+ $i-round($opt_t)+0.1-0.5,$ymin+$hist_height*$pHistUC[$i]/$mode,
+ $i-round($opt_t)+0.1+0.5,$ymin+$hist_height*$pHistUC[$i]/$mode,
+ $i-round($opt_t)+0.1+0.5,$ymin,
+ $i-round($opt_t)+0.1+0.5,$ymin+$hist_height*$pHistUC[$i]/$mode);
+ }
+
+ # UC ROLL
+ GMT_psxy('-Ey0.2/2,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Ey0.2/1,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i]>=$min_thin && $rHistUC[$i]<$min_fat);
+ my($minLim,$maxLim) = &bootstrap($btstrp_ndraw,0.95,\&avg,@{$rValsUC[$i]});
+ printf(GMT "%f %f %f\n",$i-round($opt_t)+0.3,($maxLim+$minLim)/2,($maxLim-$minLim)/2);
+ }
+ GMT_psxy('-Sx0.25 -W2,SeaGreen');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_thin);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.3,$rSumUC[$i]/$rHistUC[$i]);
+ printf(GMT "%f %f\n",$i-round($opt_t)+0.3,$ymin+$hist_height*$rHistUC[$i]/$mode);
+ }
+ if ($rHistUC) {
+ GMT_psxy('-W1,SeaGreen,2_2:0');
+ printf(GMT ">\n%f %f\n%f %f\n",$xmin,$rSumUC/$rHistUC,$xmax,$rSumUC/$rHistUC);
+ printf(GMT ">\n%f %f\n%f %f\n",$rollSumUC/$rHistUC,$ymin,$rollSumUC/$rHistUC,$ymax);
+ }
+ GMT_psxy('-W2,SeaGreen,2_2:0');
+ for (my($i)=0; $i<2*round($opt_t); $i++) {
+ next unless ($rHistUC[$i] >= $min_thin);
+ printf(GMT ">\n%f %f\n%f %f\n%f %f\n>\n%f %f\n%f %f\n",
+ $i-round($opt_t)+0.3-0.5,$ymin,
+ $i-round($opt_t)+0.3-0.5,$ymin+$hist_height*$rHistUC[$i]/$mode,
+ $i-round($opt_t)+0.3+0.5,$ymin+$hist_height*$rHistUC[$i]/$mode,
+ $i-round($opt_t)+0.3+0.5,$ymin,
+ $i-round($opt_t)+0.3+0.5,$ymin+$hist_height*$rHistUC[$i]/$mode);
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.99 V$VERSION\n");
+
+ GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id
+ print(GMT "0.0 1.03 $P{out_basename} $P{run_label}\n");
+
+ GMT_setR($R); # FINISH PLOT
+ GMT_end();
+}
+
+1; # return true on require
--- a/plot_backscatter.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_backscatter.pl Thu May 19 09:38:56 2016 -0400
@@ -1,15 +1,17 @@
#======================================================================
# P L O T _ B A C K S C A T T E R . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 16:19:45 2016
+# dlm: Wed May 18 19:44:28 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 57 44 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 40 41 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
# Jul 28, 2015: - created from [LWplot_Sv]
# Jan 26, 2016: - added return on no data to plot
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
require "$ANTS/libGMT.pl";
@@ -35,7 +37,7 @@
my($C) = "-C$WCALC/Sv.cpt";
GMT_psxy("$C -Sr");
- for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -54,6 +56,8 @@
}
GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n");
--- a/plot_correlation.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_correlation.pl Thu May 19 09:38:56 2016 -0400
@@ -1,15 +1,17 @@
#======================================================================
# P L O T _ C O R R E L A T I O N . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 16:26:09 2016
+# dlm: Wed May 18 19:44:36 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 67 37 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 40 41 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
# Jul 28, 2015: - created from [LWplot_corr]
# Jan 26, 2016: - added return on no data to plot
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
require "$ANTS/libGMT.pl";
@@ -35,7 +37,7 @@
my($C) = "-C$WCALC/corr.cpt";
GMT_psxy("$C -Sr");
- for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -54,6 +56,8 @@
}
GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n");
--- a/plot_mean_residuals.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_mean_residuals.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# P L O T _ M E A N _ R E S I D U A L S . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 15:55:14 2016
+# dlm: Wed May 18 12:55:09 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 96 29 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 19 0 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -15,6 +15,7 @@
# - added quality assessment label
# Jan 25, 2016: - added return on no data
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
require "$ANTS/libGMT.pl";
@@ -81,7 +82,9 @@
}
GMT_unitcoords(); # LABELS
-
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
+
GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id
print(GMT "0.0 -0.03 $P{out_basename} $P{run_label}\n");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_residual_profs.pl Thu May 19 09:38:56 2016 -0400
@@ -0,0 +1,95 @@
+#======================================================================
+# P L O T _ R E S I D U A L _ P R O F S . P L
+# doc: Wed May 18 18:43:33 2016
+# dlm: Wed May 18 21:43:53 2016
+# (c) 2016 A.M. Thurnherr
+# uE-Info: 48 29 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# May 18, 2016: - created from [plot_mean_residuals.pl]
+
+require "$ANTS/libGMT.pl";
+
+sub plotDC($$)
+{
+ my($f,$minsamp) = @_;
+ my($sum,$n);
+ for (my($bi)=0; $bi<=$#{$DNCAST{$f}}; $bi++) {
+ if (numberp($DNCAST{$f}[$bi]) && $DNCAST{N_SAMP}[$bi]>=$minsamp) {
+ $sum += $DNCAST{$f}[$bi]**2; $n++;
+ printf(GMT "%g %g\n",$DNCAST{$f}[$bi],($bi+0.5)*$opt_o);
+ } else {
+ print(GMT "nan nan\n");
+ }
+ }
+ return $n ? sqrt($sum/$n) : nan;
+}
+
+sub plotUC($$) # from [plot_wprofs.pl]
+{
+ my($f,$minsamp) = @_;
+ my($sum,$n);
+ for (my($bi)=0; $bi<=$#{$UPCAST{$f}}; $bi++) {
+ if (numberp($UPCAST{$f}[$bi]) && $UPCAST{N_SAMP}[$bi]>=$minsamp) {
+ $sum += $UPCAST{$f}[$bi]**2; $n++;
+ printf(GMT "%g %g\n",$UPCAST{$f}[$bi],($bi+0.5)*$opt_o);
+ } else {
+ print(GMT "nan nan\n");
+ }
+ }
+ return $n ? sqrt($sum/$n) : nan;
+}
+
+sub plot_residual_profs($)
+{
+ my($pfn) = @_;
+
+ my($yellow_light) = 0.004;
+ my($red_light) = 0.01;
+
+ my($xmin) = -0.05;
+ my($xmax) = 0.05;
+ my($ymin) = 0;
+ my($ymax) = ($P{water_depth} > 0) ? round($P{water_depth} + 25) :
+ round($P{max_depth} + 25);
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ my($depth_tics) = ($ymax < 1000 ) ? 'f10a100g100' : 'f100a500g500';
+ GMT_begin($pfn,'-JX10/-10',$R,"-P -Bf0.005a0.02g0.01:'Residual Vertical Velocity [m/s]':/$depth_tics:'Depth [m]':WeSn");
+
+ GMT_psxy('-W4,CornflowerBlue'); # zero line
+ printf(GMT "0 $ymin\n0 $ymax\n");
+
+ GMT_psxy('-W1,coral,8_2:0'); my($r12DC) = plotDC('MEAN_RESIDUAL12',$opt_k); # dc residual12 (pitch plane)
+ GMT_psxy('-W1,coral,1_1:0'); my($r34DC) = plotDC('MEAN_RESIDUAL34',$opt_k); # dc residual34 (roll plane)
+ GMT_psxy('-W1,SeaGreen,8_2:0'); my($r12UC) = plotUC('MEAN_RESIDUAL12',$opt_k); # uc residual12 (pitch plane)
+ GMT_psxy('-W1,SeaGreen,1_1:0'); my($r34UC) = plotUC('MEAN_RESIDUAL34',$opt_k); # uc residual34 (roll plane)
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
+ GMT_pstext('-F+f14,Helvetica,blue+jBL -N'); # profile id
+ print(GMT "0.0 -0.03 $P{out_basename} $P{run_label}\n");
+
+ if ($r12DC >= $red_light) { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBL -Gred'); } # rms residuals
+ elsif ($r12DC >= $yellow_light) { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBL -Gyellow'); }
+ else { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBL -Gwhite'); }
+ printf(GMT "0.01 0.93 %.1f mm/s rms\n",1000*$r12DC);
+ if ($r12UC >= $red_light) { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBL -Gred'); }
+ elsif ($r12UC >= $yellow_light) { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBL -Gyellow'); }
+ else { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBL -Gwhite'); }
+ printf(GMT "0.01 0.98 %.1f mm/s rms\n",1000*$r12UC);
+ if ($r34DC >= $red_light) { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBR -Gred'); }
+ elsif ($r34DC >= $yellow_light) { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBR -Gyellow'); }
+ else { GMT_pstext('-F+f12,Helvetica-Bold,coral+jBR -Gwhite'); }
+ printf(GMT "0.99 0.93 %.1f mm/s rms\n",1000*$r34DC);
+ if ($r34UC >= $red_light) { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBR -Gred'); }
+ elsif ($r34UC >= $yellow_light) { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBR -Gyellow'); }
+ else { GMT_pstext('-F+f12,Helvetica-Bold,SeaGreen+jBR -Gwhite'); }
+ printf(GMT "0.99 0.98 %.1f mm/s rms\n",1000*$r34UC);
+
+ GMT_end();
+}
+
+1; # return true on require
--- a/plot_residuals.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_residuals.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# P L O T _ R E S I D U A L S . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 16:32:39 2016
+# dlm: Wed May 18 19:44:44 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 83 24 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 55 43 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -12,6 +12,8 @@
# - modified $ens_tics
# Jan 26, 2016: - added return on no data to plot
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
require "$ANTS/libGMT.pl";
@@ -50,7 +52,7 @@
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
}
}
- for ($ens=$LADCP_atbottom; $ens<=$realLastGoodEns; $ens++) { # upcast
+ for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # upcast
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -70,6 +72,8 @@
}
GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n");
--- a/plot_time_lags.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_time_lags.pl Thu May 19 09:38:56 2016 -0400
@@ -1,15 +1,16 @@
#======================================================================
# P L O T _ T I M E _ L A G S . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 16:42:42 2016
+# dlm: Wed May 18 12:58:17 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 50 25 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 51 28 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
# Jul 29, 2015: - created from [LWplot_TL]
# Jan 26, 2016: - added return on no data to plot
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
require "$ANTS/libGMT.pl";
@@ -46,6 +47,8 @@
}
GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.99 V$VERSION\n");
GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
print(GMT "0.01 1.06 $P{out_basename} $P{run_label}\n");
--- a/plot_wprof.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_wprof.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# P L O T _ W P R O F . P L
# doc: Sun Jul 26 11:08:50 2015
-# dlm: Thu Mar 17 12:44:45 2016
+# dlm: Thu May 19 01:00:27 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 145 24 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 76 36 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -12,16 +12,19 @@
# Oct 12, 2015: - BUG: gaps were not plotted as such
# Mar 16, 2016: - adapted to gmt5
# Mar 17, 2016: - improved
+# May 18, 2016: - replaced rms tilt by mean tilt with traffic background
+# - added plot_wprof_ymin tweakable
# Tweakables:
#
# $plot_wprof_xmin = -0.27;
+# $plot_wprof_ymin = 3600;
# $plot_wprof_ymax = 5000;
# $plot_wprof_xtics = "-0.25 -0.15 -0.05 0.05";
require "$ANTS/libGMT.pl";
-sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/0/$plot_wprof_ymax"); }
+sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax"); }
#sub setR2() { GMT_setR("-R-200/200/0/$plot_wprof_ymax"); }
sub setR2() { GMT_setR("-R-450/350/0/$plot_wprof_ymax"); }
@@ -69,6 +72,8 @@
$plot_wprof_xmin = -0.1
unless defined($plot_wprof_xmin);
+ $plot_wprof_ymin = 0
+ unless defined($plot_wprof_ymin);
$plot_wprof_ymax = ($P{water_depth} > 0) ?
round($P{water_depth} + 25) :
round($P{max_depth} + 25)
@@ -134,15 +139,38 @@
printf(GMT "0.64 1.020 $LADCP{BEAM_FREQUENCY}kHz $LADCP{INSTRUMENT_TYPE} $P{ADCP_orientation}\n");
printf(GMT "0.64 1.055 bin setup\n 0.77 1.055 : %.1fm/%1.fm/%1.fm\n",
$LADCP{BLANKING_DISTANCE},$LADCP{TRANSMITTED_PULSE_LENGTH},$LADCP{BIN_LENGTH});
- print(GMT "0.64 1.090 rms tilt\n 0.77 1.096 :\n");
+ print(GMT "0.64 1.090 mean tilt\n 0.77 1.096 :\n");
print(GMT "0.64 1.130 rms a\@-pkg\@-\n 0.77 1.1315 :\n");
- GMT_pstext('-F+f9,Helvetica,coral+jTL -N');
-# printf(GMT "0.788 1.090 %.1f\\260\n",$P{dc_rms_tilt});
- printf(GMT "0.808 1.090 %.1f\\260\n",$P{dc_rms_tilt});
+
+ if ($P{dc_mean_tilt} < 4) {
+ GMT_pstext('-F+f9,Helvetica,coral+jTL -N');
+ } elsif ($P{dc_mean_tilt} < 8) {
+ GMT_pstext('-F+f9,Helvetica,coral+jTL -Gyellow -N');
+ } else {
+ GMT_pstext('-F+f9,Helvetica,coral+jTL -Gred -N');
+ }
+ printf(GMT "0.808 1.090 %.1f\\260\n",$P{dc_mean_tilt});
+ if ($P{uc_mean_tilt} < 4) {
+ GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -N');
+ } elsif ($P{uc_mean_tilt} < 8) {
+ GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N');
+ } else {
+ GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gred -N');
+ }
+ printf(GMT "0.91 1.090 %.1f\\260\n",$P{uc_mean_tilt});
+
+ if ($P{dc_rms_accel_pkg} < 0.7) {
+ GMT_pstext('-F+f9,Helvetica,coral+jTL -N');
+ } else {
+ GMT_pstext('-F+f9,Helvetica,coral+jTL -Gyellow -N');
+ }
printf(GMT "0.78 1.125 %.1fm\@+2\@+/s\n",$P{dc_rms_accel_pkg});
- GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -N');
-# printf(GMT "0.89 1.090 %.1f\\260\n",$P{uc_rms_tilt});
- printf(GMT "0.91 1.090 %.1f\\260\n",$P{uc_rms_tilt});
+
+ if ($P{uc_rms_accel_pkg} < 0.7) {
+ GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -N');
+ } else {
+ GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N');
+ }
printf(GMT "0.89 1.125 %.1fm\@+2\@+/s\n",$P{uc_rms_accel_pkg});
my($depth_tics) = ($plot_wprof_ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
--- a/plot_wsamp.pl Thu May 12 10:54:28 2016 -0400
+++ b/plot_wsamp.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# P L O T _ W S A M P . P L
# doc: Tue Jul 28 13:21:09 2015
-# dlm: Wed Mar 16 16:29:52 2016
+# dlm: Wed May 18 19:44:53 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 71 37 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 43 41 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -13,6 +13,8 @@
# Oct 12, 2015: - move main label outside plot area
# Jan 26, 2016: - added return on no data to plot
# Mar 16, 2016: - adapted to gmt5
+# May 18, 2016: - added version
+# - expunged $realLastGoodEns
require "$ANTS/libGMT.pl";
@@ -38,7 +40,7 @@
my($C) = "-C$WCALC/w.cpt";
GMT_psxy("$C -Sr");
- for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
@@ -58,6 +60,9 @@
}
GMT_unitcoords(); # LABELS
+ GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
+ print(GMT "0.99 0.01 V$VERSION\n");
+
GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
print(GMT "0.01 -0.06 $P{out_basename} [$P{run_label}]\n");
--- a/svel_corrections.pl Thu May 12 10:54:28 2016 -0400
+++ b/svel_corrections.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# S V E L _ C O R R E C T I O N S . P L
# doc: Thu Dec 30 01:35:18 2010
-# dlm: Thu Apr 17 09:02:29 2014
+# dlm: Thu May 19 00:51:30 2016
# (c) 2010 A.M. Thurnherr
-# uE-Info: 49 24 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 19 65 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -14,6 +14,9 @@
# 2010 Gom Spill data set the uplooker code did not stop
# at the surface, requiring additon of another test
# Mar 4, 2014: - added support for missing TILT (PITCH/ROLL)
+# May 12, 2016: - removed unused lines of code
+# May 18, 2016: - removed assumption of 1500m/s soundspeed setting
+# - made sscorr_w return nan on undef'd input vel
# NOTES:
# In an effort to track down the scale bias, NBP0901 stn 160 was reprocessed with various
@@ -22,9 +25,10 @@
# 2) simplified (dBin/dADCP): very similar to full correction, esp. when dBin is used
# 3) hacked correction (1450m/s vs 1500m/s assumed soundspeed) => bias largely disappears
-sub sscorr_w($$$$) # sound-speed correction for w
+sub sscorr_w($$$$$) # sound-speed correction for w
{ # see RDI Coord. Trans. manual sec. 4.1, ...
- my($wObs,$wCTD,$dADCP,$dBin) = @_; # but there is an error: the ^2 applies to the []
+ my($wObs,$wCTD,$ssADCP,$dADCP,$dBin) = @_; # but there is an error: the ^2 applies to the []
+ return nan unless numberp($wObs);
my($tanSqBeamAngle) = tan(rad($LADCP{BEAM_ANGLE}))**2;
$dADCP = int($dADCP); # @sVelProf is binned to 1m
@@ -34,9 +38,7 @@
while (!numberp($sVelProf[$dBin ])) { $dBin--; }
my($Kn) = sqrt(1 + (1 - $sVelProf[$dBin]/$sVelProf[$dADCP])**2 * $tanSqBeamAngle);
-### return $wObs - $wCTD; # no correction
-### return ($wObs*$sVelProf[$dBin]/1500 - $wCTD); # simplified correction; dADCP instead of dBin similar
- return ($wObs*$sVelProf[$dBin]/1500 - $wCTD) / $Kn; # full correction
+ return ($wObs*$sVelProf[$dBin]/$ssADCP - $wCTD) / $Kn; # full correction
}
sub calc_binDepths($) # see RDI Coord Trans manual sec. 4.2
@@ -73,8 +75,8 @@
my($Kn) = sqrt(1 + (1 - $avgss/$ADCPss)**2 * $tanSqBeamAngle);
$bindz[0] = $LADCP{ENSEMBLE}[$ens]->{XDUCER_FACING_UP} ?
- - $LADCP{DISTANCE_TO_BIN1_CENTER}*$Kn*$avgss/1500*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT})) :
- + $LADCP{DISTANCE_TO_BIN1_CENTER}*$Kn*$avgss/1500*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT}));
+ - $LADCP{DISTANCE_TO_BIN1_CENTER}*$Kn*$avgss/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT})) :
+ + $LADCP{DISTANCE_TO_BIN1_CENTER}*$Kn*$avgss/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT}));
for (my($bin)=1; $bin<=$LADCP_lastBin-1; $bin++) {
$sumss = $nss = 0;
@@ -98,8 +100,8 @@
$Kn = sqrt(1 + (1 - $avgss/$ADCPss)**2 * $tanSqBeamAngle);
$bindz[$bin] = $LADCP{ENSEMBLE}[$ens]->{XDUCER_FACING_UP} ?
- $bindz[$bin-1] - $LADCP{BIN_LENGTH}*$Kn*$avgss/1500*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT})) :
- $bindz[$bin-1] + $LADCP{BIN_LENGTH}*$Kn*$avgss/1500*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT}));
+ $bindz[$bin-1] - $LADCP{BIN_LENGTH}*$Kn*$avgss/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT})) :
+ $bindz[$bin-1] + $LADCP{BIN_LENGTH}*$Kn*$avgss/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}*cos(rad($LADCP{ENSEMBLE}[$ens]->{TILT}));
}
my(@bindepth);
--- a/version.pl Thu May 12 10:54:28 2016 -0400
+++ b/version.pl Thu May 19 09:38:56 2016 -0400
@@ -1,9 +1,9 @@
#======================================================================
# V E R S I O N . P L
# doc: Tue Oct 13 10:40:57 2015
-# dlm: Thu May 12 10:46:27 2016
+# dlm: Thu May 12 13:50:14 2016
# (c) 2015 A.M. Thurnherr
-# uE-Info: 21 46 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 23 21 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -18,7 +18,9 @@
# May 12, 2016: - V1.2
#$VERSION = '1.1'; # Jan 4, 2016
-$VERSION = '1.2'; # May 12, 2016
+#$VERSION = '1.2'; # May 12, 2016
+
+$VERSION = '1.3beta';
$antsMinLibVersion = 6.6;
$ADCP_tools_minVersion = 1.5;