after implementing new schemes for plotting and active files
authorA.M. Thurnherr <athurnherr@yahoo.com>
Thu, 16 Apr 2015 10:31:09 +0000
changeset 26 b89d4b01fcc5
parent 25 bd38f8bfb8e6
child 27 2053d8de8d6b
after implementing new schemes for plotting and active files
LADCP_VKE
LADCP_w
LWplot_BR
LWplot_CAE
LWplot_Sv
LWplot_TL
LWplot_corr
LWplot_prof
LWplot_prof_2beam
LWplot_residuals
LWplot_spec
LWplot_w
SBE_w
time_lag.pl
--- a/LADCP_VKE	Thu Apr 16 08:43:46 2015 -0400
+++ b/LADCP_VKE	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L A D C P _ V K E 
 #                    doc: Tue Oct 14 11:05:16 2014 
-#                    dlm: Fri Nov  7 13:54:06 2014
+#                    dlm: Thu Apr 16 10:29:45 2015
 #                    (c) 2012 A.M. Thurnherr
-#                    uE-Info: 33 15 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 188 54 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 $antsSummary = 'calculate VKE from LADCP-derived vertical-velocity profiles';
@@ -16,13 +16,16 @@
 #	Oct 17, 2014: - changed parameterization constant $c to 0.021
 #	Nov  6, 2014: - restored from backup and adapted to ANTS V6.0
 #	Nov  7, 2014: - changed parameterization constant $c to 0.0215
+#	Apr 16, 2015: - disabled output activation unless ANTS tools are available
+#				  - removed superfluous $ANTSBIN definition
 
 # NOTES:
 #	- requires power densities
 #	- output spectra (-s) have ADCP-related corrections applied unless -c is set
 
-($ANTSBIN) = ($0 =~ m{^(.*)/[^/]*$});
 ($ANTSLIB) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
+$ANTS_TOOLS_AVAILABLE = (`which list` ne '');
+
 require "$ANTSLIB/ants.pl";
 require "$ANTSLIB/libLADCP.pl";
 
@@ -182,7 +185,7 @@
 		$ofname = sprintf("${opt_s}_%02d.wspec",$r+1);
 		open(STDOUT,">$ofname") || croak("$ofname: $!\n");
 		undef($antsOldHeaders);
-		&antsActivateOut();
+		&antsActivateOut() if ($ANTS_TOOLS_AVAILABLE);
 
 		my($saveParams) = $antsCurParams;										# add all extra input fields as %PARAMs
 		&antsAddParams('binpgrams::depth.min',$ants_[$r][$mindf],
--- a/LADCP_w	Thu Apr 16 08:43:46 2015 -0400
+++ b/LADCP_w	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L A D C P _ W 
 #                    doc: Fri Dec 17 18:11:13 2010
-#                    dlm: Thu Apr 16 08:36:02 2015
+#                    dlm: Thu Apr 16 10:24:42 2015
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 308 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 159 70 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # TODO:
@@ -156,6 +156,7 @@
 #	Apr 16, 2015: - turned output specifies into lists (re-design of
 #					plotting sub-system)
 #				  - removed 30s sleep from PostProcess.sh call
+#				  - disabled active output when ANTS are not available
 
 # CTD REQUIREMENTS
 #	- elapsed		elapsed seconds; see note below
@@ -212,6 +213,7 @@
 ($ADCP_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$});
 ($WCALC) 	  = ($0                =~ m{^(.*)/[^/]*$});
 $WCALC = '.' if ($WCALC eq '');
+$ANTS_TOOLS_AVAILABLE = (`which list` ne '');
 
 die("$0: Korn shell (/bin/ksh) required but not found\n")
 	unless (-x '/bin/ksh');
@@ -586,10 +588,10 @@
 	@antsNewLayout = ('ensemble','elapsed','reflr_w','reflr_w.stddev','reflr_w.nsamp','depth');
 	
 	foreach my $of (@out_LADCP) {
-	    progress("$of ");
-	    $of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+	    progress("<$of> ");
+	    $of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		open(STDOUT,$of) || croak("$of: $!\n");
-		chmod(0777&~umask,*STDOUT);
+		undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 		for (my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) {
 			&antsOut($LADCP{ENSEMBLE}[$ens]->{NUMBER},
 					 $LADCP{ENSEMBLE}[$ens]->{ELAPSED},
@@ -1262,10 +1264,10 @@
 	&antsAddParams('BR_max_bin',max(scalar(@dc_bres),scalar(@uc_bres)));
 
 	foreach my $of (@out_BR) {
-	    progress("$of ");
-	    $of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+	    progress("<$of> ");
+	    $of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		open(STDOUT,$of) || croak("$of: $!\n");
-		chmod(0777&~umask,*STDOUT);
+		undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 		for (my($bin)=0; $bin<max(scalar(@dc_bres),scalar(@uc_bres)); $bin++) {
 			my($dc_avg) = avg(@{$dc_bres[$bin]});
 			my($uc_avg) = avg(@{$uc_bres[$bin]});
@@ -1314,10 +1316,10 @@
 					  'pitch','roll','tilt','heading','3_beam','svel');
 
 	foreach my $of (@out_w) {
-	    progress("$of ");
-	    $of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+	    progress("<$of> ");
+	    $of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		open(STDOUT,$of) || croak("$of: $!\n");
-		chmod(0777&~umask,*STDOUT);
+		undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 	    
 		for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) {						# downcast
 		  next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
@@ -1403,10 +1405,10 @@
 	                          'BT_w','BT_w.mad','BT_w.nsamp');
 
 	foreach my $of (@out_profile) {
-	    progress("$of ");
-	    $of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+	    progress("<$of> ");
+	    $of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		open(STDOUT,$of) || croak("$of: $!\n");
-		chmod(0777&~umask,*STDOUT);
+		undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 	    
 		for (my($bi)=0; $bi<=max($#{$DNCAST{ENSEMBLE}},$#{$UPCAST{ENSEMBLE}},$#{$BT{NSAMP}}); $bi++) {
 			&antsOut(($bi+0.5)*$opt_o,					# nominal depth
@@ -1439,10 +1441,10 @@
 					  'reflr_ocean_w');
 					  
 	foreach my $of (@out_timeseries) {
-	    progress("$of ");
-	    $of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+	    progress("<$of> ");
+	    $of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		open(STDOUT,$of) || croak("$of: $!\n");
-		chmod(0777&~umask,*STDOUT);
+		undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 		 
 		for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
 			next unless defined($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
--- a/LWplot_BR	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_BR	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ B R 
 #                    doc: Mon Oct 17 10:57:12 2011
-#                    dlm: Sun Apr  5 22:08:49 2015
+#                    dlm: Thu Apr 16 08:08:23 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 16 39 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 17 51 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -14,6 +14,7 @@
 #	Apr 12, 2012: - made re-entrant
 #   Oct 30, 2103: - got rid of non-portable echo -e
 #	Apr  5, 2015: - made fixbb optional
+#	Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -31,7 +32,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$max_bin" ] && max_bin=`expr -- "$line" : '#ANTS#PARAMS#.*max_bin{\([^}]*\)}`
@@ -55,12 +55,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_BR
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_CAE	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_CAE	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L W P L O T _ C A E 
 #                    doc: Wed May 15 19:35:58 2013
-#                    dlm: Sun Apr  5 22:09:30 2015
+#                    dlm: Thu Apr 16 08:08:52 2015
 #                    (c) 2013 A.M. Thurnherr
-#                    uE-Info: 101 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 55 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -13,6 +13,7 @@
 #	Oct 30, 2013: - BUG: debug statement had been left in code
 #   Oct 30, 2013: - got rid of non-portable echo -e
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -30,7 +31,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
@@ -51,12 +51,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_BR
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_Sv	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_Sv	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ S V 
 #                    doc: Sat Oct 15 13:42:50 2011
-#                    dlm: Sun Apr  5 22:09:54 2015
+#                    dlm: Thu Apr 16 08:09:17 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 104 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 64 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -16,6 +16,7 @@
 #	May 16, 2013: - adapted to file-layout changes
 #	May 20, 2013: - renamed volume_scattering_coeff to Sv
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -34,7 +35,6 @@
 while [ -z "$fields" ]
 do
 	read line
-	[ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -60,12 +60,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_Sv
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_TL	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_TL	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L W P L O T _ T L 
 #                    doc: Thu Oct 13 10:51:49 2011
-#                    dlm: Sun Apr  5 22:54:26 2015
+#                    dlm: Thu Apr 16 08:09:32 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 24 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 57 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -22,6 +22,7 @@
 #   Oct 30, 2103: - got rid of non-portable echo -e
 #	Apr  5, 2015: - made fixbb optional
 #				  - BUG: ps file had not been closed properly (fixbb took care of that)
+#   Apr 16, 2015: - removed copy of input on stdout
 
 USAGE="Usage: $0 <eps-file> [in-file]"
 	[ $# -eq 2 ] && exec <"$2" "$0" "$1"
@@ -31,7 +32,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_elapsed" ] && min_elapsed=`expr -- "$line" : '#ANTS#PARAMS#.*elapsed.min{\([^}]*\)}`
@@ -53,12 +53,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_TL
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_corr	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_corr	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ C O R R 
 #                    doc: Sat Oct 15 13:42:50 2011
-#                    dlm: Sun Apr  5 22:10:16 2015
+#                    dlm: Thu Apr 16 08:09:52 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 102 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 62 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -15,6 +15,7 @@
 #   Apr 12, 2012: - made re-entrant
 #	May 16, 2013: - adapted to file layout change
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -32,7 +33,6 @@
 while [ -z "$fields" ]
 do
 	read line
-	[ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -58,12 +58,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_corr
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_prof	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_prof	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ P R O F 
 #                    doc: Fri Oct 14 09:42:36 2011
-#                    dlm: Sun Apr  5 22:10:31 2015
+#                    dlm: Thu Apr 16 08:10:11 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 124 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 65 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -19,6 +19,7 @@
 #	May 15, 2013: - BUG: plot separation lines/shading did not work any more
 #   Oct 30, 2103: - got rid of non-portable echo -e
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -36,7 +37,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -61,12 +61,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_prof
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_prof_2beam	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_prof_2beam	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ P R O F _ 2 B E A M 
 #                    doc: Fri Oct 14 09:42:36 2011
-#                    dlm: Sun Apr  5 22:10:38 2015
+#                    dlm: Thu Apr 16 08:10:32 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 123 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 61 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -12,6 +12,7 @@
 #	Oct 30, 2103: - got rid of non-portable echo -e
 #	Nov  3, 2014: - adapted to updated layout of .prof file
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 # NOTES:
 #	- this version plots 2-beam solutions instead of final w
@@ -32,7 +33,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -57,12 +57,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_prof
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_residuals	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_residuals	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ R E S I D U A L S 
 #                    doc: Sat Oct 15 13:42:50 2011
-#                    dlm: Sun Apr  5 22:10:46 2015
+#                    dlm: Thu Apr 16 08:10:54 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 103 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 63 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -16,6 +16,7 @@
 #	Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
 #   Apr 12, 2012: - made re-entrant
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -33,7 +34,6 @@
 while [ -z "$fields" ]
 do
 	read line
-	[ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -59,12 +59,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_residuals
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_spec	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_spec	Thu Apr 16 10:31:09 2015 +0000
@@ -2,17 +2,20 @@
 #======================================================================
 #					 L W P L O T _ S P E C 
 #                    doc: Thu Sep  5 18:23:41 2013
-#                    dlm: Sun Apr  5 22:10:53 2015
+#                    dlm: Thu Apr 16 08:12:02 2015
 #                    (c) 2013 A.M. Thurnherr
-#                    uE-Info: 131 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 10 58 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
+# NB: THIS PLOTTING ROUTINE REQUIRES NON-PUBLIC ANTS TOOLS
+
 # HISTORY:
 #	Sep  5, 2013: - created from LWplot_prof
 #   Oct 30, 2103: - got rid of non-portable echo -e
 #	Nov  6, 2013: - add interpolation of missing values
 #	Jul 12, 2013: - added a -N to pgram to make it work with partial-depth casts
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -30,7 +33,6 @@
 while [ -z "$fields" ]
 do
 	read line
-    [ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -54,12 +56,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_spec
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/LWplot_w	Thu Apr 16 08:43:46 2015 -0400
+++ b/LWplot_w	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #					 L W P L O T _ W 
 #                    doc: Sat Oct 15 13:42:50 2011
-#                    dlm: Sun Apr  5 22:10:59 2015
+#                    dlm: Thu Apr 16 08:12:31 2015
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 103 26 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 64 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -17,6 +17,7 @@
 #	Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
 #   Apr 12, 2012: - made re-entrant
 #	Apr  5, 2015: - made fixbb optional
+#   Apr 16, 2015: - removed copy of input on stdout
 
 #--------------------------------------------------
 # Usage
@@ -34,7 +35,6 @@
 while [ -z "$fields" ]
 do
 	read line
-	[ ! -t 1 ] && echo "$line"
 	[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
 	[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
 	[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
@@ -60,12 +60,7 @@
 cd /tmp/$$
 
 TMPFILE=/tmp/$$.LWplot_w
-if [ ! -t 1 ]
-then
-	tee $TMPFILE
-else
-	cat > $TMPFILE
-fi
+cat > $TMPFILE
 
 [ -f .gmtdefaults4 ] ||
 	gmtset	PAPER_MEDIA letter+ \
--- a/SBE_w	Thu Apr 16 08:43:46 2015 -0400
+++ b/SBE_w	Thu Apr 16 10:31:09 2015 +0000
@@ -2,9 +2,9 @@
 #======================================================================
 #                    S B E _ W 
 #                    doc: Mon Nov  3 17:34:19 2014
-#                    dlm: Fri Nov  7 15:52:27 2014
+#                    dlm: Thu Apr 16 10:29:18 2015
 #                    (c) 2014 A.M. Thurnherr
-#                    uE-Info: 22 0 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 24 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 $antsSummary = 'pre-process SBE 9plus CTD data for LADCP_w';
@@ -20,8 +20,10 @@
 #				  - added no-valid-data error message
 #				  - modified binning criterion to allow any sampling
 #					frequency (not just divisors of 24)
+#	Apr 16, 2015: - disabled output activation unless ANTS tools are available
 
 ($ANTS) = (`which ANTSlib`   =~ m{^(.*)/[^/]*$});
+$ANTS_TOOLS_AVAILABLE = (`which list` ne '');
 
 require "$ANTS/ants.pl";
 require "$ANTS/fft.pl";
@@ -43,7 +45,8 @@
 
 $CNVfile = $ARGV[0];											# open CNV file
 open(F,&antsFileArg());
-&antsActivateOut();												# activate ANTS file
+&antsActivateOut()												# activate ANTS file
+	if ($ANTS_TOOLS_AVAILABLE);
 
 #----------------------------------------------------------------------
 # Read Data
--- a/time_lag.pl	Thu Apr 16 08:43:46 2015 -0400
+++ b/time_lag.pl	Thu Apr 16 10:31:09 2015 +0000
@@ -1,9 +1,9 @@
 #======================================================================
 #                    T I M E _ L A G . P L 
 #                    doc: Fri Dec 17 21:59:07 2010
-#                    dlm: Thu Apr 16 08:35:37 2015
+#                    dlm: Thu Apr 16 10:25:37 2015
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 286 27 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 63 0 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -54,6 +54,8 @@
 #	May 23, 2014: - BUG: $s range check required in mad_w()
 #   Apr 16, 2015: - turned output specifies into lists (re-design of
 #                   plotting sub-system)
+#				  - BUG: executable flag was not set on file output
+#				  - disabled active output when ANTS are not available
 
 # DIFFICULT STATIONS:
 #	NBP0901#131		this requires the search-radius doubling heuristic
@@ -249,9 +251,7 @@
 		goto RETRY;
 	}
 
-	if (@out_TL) && $scan_increment==1) {
-		progress("\tWriting time-lagging time series to ");
-	
+	if (@out_TL && $scan_increment==1) {
 		push(@elapsed_buf,@elapsed);								# buffer elapsed data in static scope
 		push(@so_buf,@so);											# scan offset
 		push(@mad_buf,@mad);										# mean absolute deviation
@@ -261,6 +261,7 @@
 			unless defined($elapsed_min_buf);
 
 		if ($last_lag_piece) {										# output all data
+			progress("\tWriting time-lagging time series to ");
 			my($saveParams) = $antsCurParams;
 			@antsNewLayout = ('elapsed.LADCP','scan_offset','mad','downcast');
 	
@@ -271,9 +272,10 @@
 			&antsAddParams('elapsed.bot',$LADCP{ENSEMBLE}[$LADCP_atbottom]->{ELAPSED});
 
 			foreach my $of (@out_TL) {
-				progress("$of ");
-				$of = ">$of" unless unless ($of =~ /^$|^\s*\|/);
+				progress("<$of> ");
+				$of = ">$of" unless ($of =~ /^$|^\s*\|/);
 		        open(STDOUT,$of) || croak("$of: $!\n");
+				undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
 
 				for (my($wi)=0; $wi<@elapsed_buf; $wi++) {
 					&antsOut($elapsed_buf[$wi],$so_buf[$wi],$mad_buf[$wi],