--- a/LADCPintsh
+++ b/LADCPintsh
@@ -2,9 +2,9 @@
#======================================================================
# L A D C P I N T S H
# doc: Thu Oct 14 21:22:50 2010
-# dlm: Thu Mar 20 12:14:53 2014
+# dlm: Sat Jun 7 10:43:54 2014
# (c) 2010 A.M. Thurnherr & E. Firing
-# uE-Info: 266 0 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 59 43 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
$antsSummary = 'integrate LADCP shear';
@@ -56,6 +56,7 @@
# - make sure LADCP DUL metadata are dealt with correctly
# Jul 12, 2013: - clarified -u usage with better messages
# Mar 20, 2014: - fiddled while debugging [LADCPproc]
+# Jun 7, 2014: - improved error messages
($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
require "$ANTS/ants.pl";
@@ -420,7 +421,7 @@
&fixLowSampStat(\@BT_w_var,@BT_nsamp);
} elsif (defined($BTdF) && defined($BTuF) && # LDEO_IX ANTS format
defined($BTvF) && defined($BTerrF)) {
- croak("$0: -m not supported for this BT file format\n")
+ croak("$0: -m not supported for LDEO_IX output\n")
if defined($opt_m);
while (my(@BTr) = &antsFileIn(BTF)) {
my($gi) = int($BTr[$BTdF] / $DZ);
@@ -434,7 +435,7 @@
croak("$opt_r: not a valid reference-velocity file (ANTS format)\n");
}
} else { # non-ANTS file (LDEO_IX assumed)
- croak("$0: -m not supported for this BT file format\n")
+ croak("$0: -m not supported for LDEO_IX output\n")
if defined($opt_m);
while (<BTF>) {
last if /^Columns\s+=\s+z:u:v:err/;
--- a/LADCPproc.backscatter
+++ b/LADCPproc.backscatter
@@ -1,9 +1,9 @@
#======================================================================
# L A D C P P R O C . B A C K S C A T T E R
# doc: Wed Oct 20 13:02:27 2010
-# dlm: Thu Mar 27 18:54:02 2014
+# dlm: Sun May 25 21:38:44 2014
# (c) 2010 A.M. Thurnherr
-# uE-Info: 25 52 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 26 45 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -23,6 +23,7 @@
# for shallow casts)
# Mar 21, 2014: - adapted to new [LADCPproc.utils]
# Mar 27, 2014: - adapted to depthOfBinAlongBeam()
+# May 25, 2014: - made search_below integer
my($BEAM1) = 0;
my($BEAM2) = 1;
@@ -250,7 +251,7 @@
my($water_depth) = @_;
my(@wdepth_gi); # water_depth indices
- my($search_below) = max(0,$water_depth-$BT_begin_search_above);
+ my($search_below) = int(max(0,$water_depth-$BT_begin_search_above));
my($mdgi) = int($search_below/$GRID_DZ); # grid index to begin search
print(STDERR "\n\t\tlooking for seabed below $search_below m (gi >= $mdgi)") if ($opt_d);
--- a/LADCPproc.bestLag
+++ b/LADCPproc.bestLag
@@ -1,9 +1,9 @@
#======================================================================
# L A D C P P R O C . B E S T L A G
# doc: Tue Sep 28 21:58:48 2010
-# dlm: Wed Mar 19 21:33:30 2014
+# dlm: Sun May 25 21:16:27 2014
# (c) 2010 A.M. Thurnherr
-# uE-Info: 28 45 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 31 72 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# TODO:
@@ -26,6 +26,9 @@
# Oct 19, 2012: - BUG: opt_i had wrong sign!
# Jun 25, 2013: - adapted to :: %PARAM convention
# Mar 19, 2014: - moved %PARAM to LADCPproc
+# May 25, 2015: - added assertion to require numeric interpolated LADCP_w
+# - BUG: interp_LADCP_w left gaps
+# - added debug code to output bestLag input time series
sub interp_LADCP_w($$)
{
@@ -33,9 +36,9 @@
my($sc) = ($elapsed - $LADCP{ENSEMBLE}[$ens-1]->{ELAPSED_TIME}) /
($LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME} -
$LADCP{ENSEMBLE}[$ens-1]->{ELAPSED_TIME});
- unless (numberp($LADCP{ENSEMBLE}[$ens-1]->{W})) {
+ unless (numberp($LADCP{ENSEMBLE}[$ens]->{W})) {
$nGaps++;
- return $LADCP{ENSEMBLE}[$ens]->{W};
+ $LADCP{ENSEMBLE}[$ens]->{W} = $LADCP{ENSEMBLE}[$ens-1]->{W};
}
return $LADCP{ENSEMBLE}[$ens-1]->{W} +
$sc * ($LADCP{ENSEMBLE}[$ens]->{W} - $LADCP{ENSEMBLE}[$ens-1]->{W});
@@ -114,8 +117,11 @@
for (my($ens)=$LADCP_start,my($r)=0; $ens<=$LADCP_end; $ens++) {
while ($r*$CTD{sampint} < $LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME}) {
unless ($first_guess_lag > $r) {
- $LADCP_w[$r-$first_guess_lag] = interp_LADCP_w($r*$CTD{sampint},$ens);
+ my($w) = interp_LADCP_w($r*$CTD{sampint},$ens);
+ next if (!defined($firstValid) && !defined($w));
$firstValid = $r-$first_guess_lag unless defined($firstValid);
+ die("assertion failed") unless defined($w);
+ $LADCP_w[$r-$first_guess_lag] = $w;
$nValid++;
}
$r++;
@@ -128,6 +134,17 @@
print(STDERR "\n");
#----------------------------------------------------------------------
+ # Output w Time Series
+ #----------------------------------------------------------------------
+
+# open(F,'>bestLag.out');
+# print(F "#ANTS#FIELDS# {rec} {LADCP_w} {CTD_w}\n");
+# for (my($r)=$firstValid; $r<$firstValid+$nValid; $r++) {
+# print(F "$r $LADCP_w[$r] $CTD{w}[$r]\n");
+# }
+# close(F);
+
+ #----------------------------------------------------------------------
# Calculate lags
#----------------------------------------------------------------------
--- a/LADCPproc.defaults
+++ b/LADCPproc.defaults
@@ -1,9 +1,9 @@
#======================================================================
# L A D C P P R O C . D E F A U L T S
# doc: Fri Sep 17 09:44:21 2010
-# dlm: Tue May 20 10:49:52 2014
+# dlm: Wed May 28 23:23:41 2014
# (c) 2010 A.M. Thurnherr
-# uE-Info: 289 0 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 260 0 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# default parameters for [LADCPproc]
@@ -262,6 +262,8 @@
## min_correlation (BB only) is the minimum correlation, in
## counts, for each beam in a given bin.
+# mk_prof() in [RDI_Utils.pl] removes all velocities with
+# correlations < 70 before this criterion is applied.
$min_cor = 70;
--- a/LADCPproc.loadCTD
+++ b/LADCPproc.loadCTD
@@ -1,9 +1,9 @@
#======================================================================
# L A D C P P R O C . L O A D C T D
# doc: Thu Dec 9 18:39:01 2010
-# dlm: Thu Nov 21 10:14:37 2013
+# dlm: Sun Sep 14 21:20:12 2014
# (c) 2010 A.M. Thurnherr
-# uE-Info: 170 0 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 37 0 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY: