version prior to carrying out separate dc-/uc- time lagging
authorA.M. Thurnherr <athurnherr@yahoo.com>
Mon, 15 Oct 2012 20:28:20 +0000
changeset 10 7e76fdef8953
parent 9 6ea152571f00
child 11 9e5eba6992f7
version prior to carrying out separate dc-/uc- time lagging
LADCP_w
PostProcess.sh
defaults.pl
edit_data.pl
--- a/LADCP_w	Wed Apr 18 10:36:46 2012 -0400
+++ b/LADCP_w	Mon Oct 15 20:28:20 2012 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L A D C P _ W 
 #                    doc: Fri Dec 17 18:11:13 2010
-#                    dlm: Thu Oct 27 22:34:35 2011
+#                    dlm: Mon Oct 15 09:43:38 2012
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 114 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 116 10 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # TODO:
@@ -112,6 +112,8 @@
 #				  - moved editTilt() to after time-series calculation to allow
 #				    time matching to work even with strict tilt limit
 #				  - added correctAttitude()
+#	May 22, 2012: - adapted to ANTS V5
+#	Oct 15, 2012: - added $edit_data_hook
 
 # CTD REQUIREMENTS
 #	- elapsed		elapsed seconds; see note below
@@ -156,7 +158,7 @@
 #	  affect the w profiles, as long as the median bin values are used
 
 ($WCALC) 	  = ($0                =~ m{^(.*)/[^/]*$});
-($ANTS) 	  = (`which list`      =~ m{^(.*)/[^/]*$});
+($ANTS) 	  = (`which ANTSlib`   =~ m{^(.*)/[^/]*$});
 ($PERL_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$});
 
 require "$ANTS/ants.pl";
@@ -675,7 +677,7 @@
 	    }
 	} else{
 	    undef($LADCP{ENSEMBLE}[$ens]->{REFLR_W});						# don't output in time-series file
-	    undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});						# old DEPTH from calcLADCPts()
+	    undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});						# old DEPTH from calcLADCPts() must be removed
 	}
 }
 	
@@ -755,12 +757,18 @@
 #----------------------------------------------------------------------
 # Data Editing after LADCP and CTD data have been merged
 #	1) surface layer editing
+#	2) user-supplied $edit_data_hook
 #----------------------------------------------------------------------
 
 progress("Removing data from instrument at surface...\n");
 $nerm = editSurfLayer($firstGoodEns,$lastGoodEns,$surface_layer_depth);
 progress("\t$nerm ensembles removed\n");
 
+if (defined($edit_data_hook)) {
+	progress("Executing user-supplied \$edit_data_hook...\n");
+	&{$edit_data_hook}($firstGoodEns,$lastGoodEns);
+}
+
 #---------------------------------------------------------------------------
 # Depth-bin LADCP velocity data
 #
--- a/PostProcess.sh	Wed Apr 18 10:36:46 2012 -0400
+++ b/PostProcess.sh	Mon Oct 15 20:28:20 2012 +0000
@@ -2,14 +2,15 @@
 #======================================================================
 #                    P O S T P R O C E S S . S H 
 #                    doc: Mon Oct 17 16:42:08 2011
-#                    dlm: Fri Oct 21 11:03:29 2011
+#                    dlm: Thu Oct 11 14:23:01 2012
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 12 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 13 47 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
 #	Oct 17, 2011: - created
 #	Oct 21, 2011: - made user friendly
+#	Oct 11, 2012: - added support for TL output
 
 [ $# -gt 0 ] || {
 	echo "Usage: $0 <out-basename> [<run-label> [<data-subdir> [<plot-subdir> [<log-subdir>]]]]" >&2
@@ -22,7 +23,7 @@
 [ -n "$4" ] && P_SUBDIR=$4	|| P_SUBDIR=$RUN
 [ -n "$5" ] && L_SUBDIR=$5	|| L_SUBDIR=$RUN
 
-chmod +x $D_SUBDIR/$OBN.prof $D_SUBDIR/$OBN.w
+chmod +x $D_SUBDIR/$OBN.prof $D_SUBDIR/$OBN.w $D_SUBDIR/$OBN.TL
 
 tile -s 1.3 -y -90 $P_SUBDIR/${OBN}_prof.eps $P_SUBDIR/${OBN}_w.eps \
 				   $P_SUBDIR/${OBN}_BR.eps $P_SUBDIR/${OBN}_residuals.eps \
--- a/defaults.pl	Wed Apr 18 10:36:46 2012 -0400
+++ b/defaults.pl	Mon Oct 15 20:28:20 2012 +0000
@@ -1,9 +1,9 @@
 #======================================================================
 #                    D E F A U L T S . P L 
 #                    doc: Tue Oct 11 17:11:21 2011
-#                    dlm: Thu Oct 27 22:36:34 2011
+#                    dlm: Thu Oct 11 14:18:12 2012
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 60 0 NIL 0 0 72 0 2 4 NIL ofnI
+#                    uE-Info: 25 48 NIL 0 0 72 0 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -22,6 +22,7 @@
 #	Oct 26, 2011: - added $first_guess_timelag
 #	Oct 27, 2011: - modified ProcessingParam file loading
 #				  - added ${pitch,roll,heading}_bias
+#	Oct 11, 2012: - added .TL output to defaults
 
 # Variable Names:
 #	- variables that are only used in a particular library are
@@ -136,7 +137,8 @@
 # diagnostic plots
 
 $out_BR		= "| LWplot_BR 	   $plot_subdir/${out_basename}_BR.eps";
-$out_TL 	= "| LWplot_TL     $plot_subdir/${out_basename}_TL.eps";
+$out_TL 	= "| LWplot_TL     $plot_subdir/${out_basename}_TL.eps" .
+			  "> $data_subdir/$out_basename.TL";
 $out_TLhist = "| LWplot_TLhist $plot_subdir/${out_basename}_TLhist.eps";
 
 
--- a/edit_data.pl	Wed Apr 18 10:36:46 2012 -0400
+++ b/edit_data.pl	Mon Oct 15 20:28:20 2012 +0000
@@ -1,9 +1,9 @@
 #======================================================================
 #                    E D I T _ D A T A . P L 
 #                    doc: Sat May 22 21:35:55 2010
-#                    dlm: Thu Oct 27 22:34:22 2011
+#                    dlm: Mon Oct 15 10:03:13 2012
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 42 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 28 81 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -25,6 +25,7 @@
 #	Oct 20, 2011: - added editFarBins()
 #	Oct 27, 2011: - adapted editTilt() to new call location
 #				  - added correctAttitude()
+#	Oct 15, 2012: - BUG: editSurfLayer() counted also ensembles without CTD depth
 
 # NOTES:
 #	- all bins must be edited (not just the ones between $LADCP_firstBin
@@ -280,6 +281,7 @@
 	my($fe,$te,$sld) = @_;		# first & last ens to process
 	my($nerm) = 0;				# of ensembles affected
 	for (my($e)=$fe; $e<=$te; $e++) {
+		next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
 		undef($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}),$nerm++
 			if ($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH} <= $sld);
 	}