# HG changeset patch # User A.M. Thurnherr # Date 1425675263 18000 # Node ID dd5b67a41791e2f2ac07cf8cb8b14c5258b29890 # Parent 9b972ce37c3b01e0678db6e19248700b47f6795e# Parent f72cd642972ccaa9ca35315c4e558409126868cc merged Explorer with DoMORE-1 changes diff --git a/LADCPintsh b/LADCPintsh --- 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: Tue Jul 15 09:14:27 2014 +# dlm: Fri Mar 6 15:51:49 2015 # (c) 2010 A.M. Thurnherr & E. Firing -# uE-Info: 526 0 NIL 0 0 72 0 2 4 NIL ofnI +# uE-Info: 8 0 NIL 0 0 72 0 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 () { last if /^Columns\s+=\s+z:u:v:err/; diff --git a/LADCPproc.backscatter b/LADCPproc.backscatter --- 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: Tue Aug 5 13:32:13 2014 +# dlm: Fri Mar 6 15:52:50 2015 # (c) 2010 A.M. Thurnherr -# uE-Info: 30 71 NIL 0 0 72 2 2 4 NIL ofnI +# uE-Info: 32 0 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 # Jul 27, 2014: - moved depthOfGI() to [LADCPproc.utils] # Aug 5, 2014: - BUG: find_backscatter_seabed() discarded everything if # LADCP bin 1 had the backscatter max at the edge of @@ -253,7 +254,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 printf(STDERR "\n\t\tlooking for seabed below %d m (gi = [%d..%d])",$search_below,$mdgi,scalar(@nSv)) if ($opt_d); diff --git a/LADCPproc.bestLag b/LADCPproc.bestLag --- 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: Sat Jul 19 18:32:26 2014 +# dlm: Fri Mar 6 15:53:43 2015 # (c) 2010 A.M. Thurnherr -# uE-Info: 29 44 NIL 0 0 72 2 2 4 NIL ofnI +# uE-Info: 33 0 NIL 0 0 72 2 2 4 NIL ofnI #====================================================================== # TODO: @@ -27,6 +27,9 @@ # Jun 25, 2013: - adapted to :: %PARAM convention # Mar 19, 2014: - moved %PARAM to LADCPproc # Jul 19, 2014: - made lagging obey -z)oom +# 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($$) { @@ -34,9 +37,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}); @@ -115,8 +118,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++; @@ -129,6 +135,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 #----------------------------------------------------------------------