before adding dropped-scan correction to LADCP_w_CTD
authorA.M. Thurnherr <athurnherr@yahoo.com>
Tue, 27 Aug 2019 19:11:54 -0400
changeset 51 0f6d9e64cc4f
parent 50 84914596c635
child 52 4ccccbf69dfd
before adding dropped-scan correction to LADCP_w_CTD
LADCP_w_CTD
LADCP_w_ocean
defaults.pl
time_series.pl
--- a/LADCP_w_CTD	Tue Nov 27 17:00:50 2018 -0500
+++ b/LADCP_w_CTD	Tue Aug 27 19:11:54 2019 -0400
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L A D C P _ W _ C T D 
 #                    doc: Mon Nov  3 17:34:19 2014
-#                    dlm: Fri Oct  5 14:52:00 2018
+#                    dlm: Mon Apr 29 18:00:44 2019
 #                    (c) 2014 A.M. Thurnherr
-#                    uE-Info: 85 93 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 111 15 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 $antsSummary = 'pre-process SBE 9plus CTD data for LADCP_w';
@@ -83,7 +83,10 @@
 #				  - added plotting errors
 #				  - improved log message
 #				  - BUG: initial in-air scans were not handled correctly (nscans not updated)
-
+#	Mar 25, 2019: - changed error message to allow creating 1Hz from 4Hz file (SBE19)
+#				  - BUG: ITS was not set. How is this possible?????
+#	Apr 21, 2019: - modified code to allow production of 24Hz files (previous code required
+#					min 2 samples per bin, allowing for max 12Hz sampling rate)
 
 # NOTES:
 #	w_CTD is positive during the downcast to make the sign of the apparent
@@ -105,7 +108,7 @@
 
 $antsParseHeader = 0;											# usage
 $antsSuppressCommonOptions = 1;
-&antsUsage('ai:l:orp:qs:v:w:',1,
+&antsUsage('ac:i:l:orp:qs:v:w:',1,
 	'[-v)erbosity <level[0]>]',
 	'[use -a)lternate sensor pair]',
 	'[-r)etain all data (no editing)] [allow infinite -o)utliers]',
@@ -147,8 +150,10 @@
 	($nfields,$nscans,$sampint,$badval,$ftype,$lat,$lon) =			# decode SBE header 
 		SBE_parseHeader(F,0,0); 									# SBE field names, no time check
 	
-	_croak("$CNVfile: unexpected sampling interval $sampint\n")
-		unless (abs($sampint-1/24) < 1e-5);
+#	_croak("$CNVfile: unexpected sampling interval $sampint s\n")
+#		unless (abs($sampint-1/24) < 1e-5);
+	_croak("$CNVfile: insufficient time resolution ($sampint s) for ${opt_s}Hz time series\n")
+		if (round(1/$sampint/$opt_s) < 1);
 
 	if (defined($opt_l)) {											# set/override station location with -l
 		my($slat,$slon) = split('[,/]',$opt_l);
@@ -163,10 +168,12 @@
 	&antsAddParams('lat',$lat);
 	&antsAddParams('lon',$lon);
 	
-	$pressF = fnr('prDM');
+	$pressF = fnrNoErr('prdM');										# pressure; SBE19plus
+	$pressF = fnr('prDM') unless defined($pressF);					# SBE 9plus
 	
 	if ($opt_a) {													# temp/cond alternate sensor pair
 		$tempF	= fnr('t190C');
+		&antsAddParams('ITS',90);
 		$condF	= fnrNoErr('c1S/m');
 		if (defined($condF)) {
 			$condHistRes = 20;										# 0.2 S/m bins
@@ -175,7 +182,9 @@
 			$condHistRes = 2;										# 2.0 mS/cm bins
 		}
 	} else {														# primary sensor pair
-		$tempF	= fnr('t090C');
+		$tempF  = fnrNoErr('tv290C');								# SBE 19plus
+		$tempF	= fnr('t090C') unless defined($tempF);				# SBE 9plus
+		&antsAddParams('ITS',90);
 		$condF	= fnrNoErr('c0S/m');
 		if (defined($condF)) {
 			$condHistRes = 20;
--- a/LADCP_w_ocean	Tue Nov 27 17:00:50 2018 -0500
+++ b/LADCP_w_ocean	Tue Aug 27 19:11:54 2019 -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: Tue Nov 27 14:04:39 2018
+#                    dlm: Sun Apr 21 14:16:03 2019
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 282 15 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 298 81 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # TODO:
@@ -293,6 +293,9 @@
 #				  - replaced $PPI_seabed_editing_required by &PPI_seabed_editing_required
 #				  - BUG: surface PPI editing code could not be enabled; added &PPI_surface_editing_required
 #	Nov  2, 2018: - BUG: for 3-beam solutions, residual{12,34} with affected beam was wrong
+#	Apr 12, 2019: - added logfile error message for non-existing file
+#	Apr 18, 2019: - added addtional RDI coordinate transformation %PARAMs
+#	Apr 21, 2019: - BUG: removed duplicate warning about lacking water-depth info
 # HISTORY END
 
 # CTD REQUIREMENTS
@@ -575,6 +578,8 @@
 #---------------------------
 
 progress("Reading LADCP data from <$LADCP_file>...\n");
+error("cannot open <$LADCP_file> for reading\n")
+	unless (-r $LADCP_file);
 readData($LADCP_file,\%LADCP);
 &antsAddDeps($LADCP_file);
 if ($LADCP{BEAM_COORDINATES}) {
@@ -725,7 +730,10 @@
 	$RDI_Coords::binMapping = 'none';
 }
 
-&antsAddParams('RDI_Coords::binMapping',$RDI_Coords::binMapping);		# finally, bin mapping is known
+&antsAddParams('RDI_Coords::binMapping', 	    $RDI_Coords::binMapping,		# finally, bin mapping is known
+			   'RDI_Coords::minValidVels',      $RDI_Coords::minValidVels,
+			   'RDI_Coords::beamTransformation',$RDI_Coords::beamTransformation);
+
 
 #-------------------------------------------------------------------
 # Calculate earth velocities
@@ -1363,7 +1371,8 @@
 			($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,$water_depth);
         	progress("\t$nvrm velocities from $nerm ensembles removed\n");
         } else {
-			warning(2,"unknown water depth --- cannot edit UL data for sidelobe interference from seabed\n");
+#			WARNING ALREADY PRODUCED ABOVE
+#			warning(2,"unknown water depth --- cannot edit UL data for sidelobe interference from seabed\n");
         }
         &antsAddParams('sidelobe_editing','surface+seabed','vessel_draft',$vessel_draft);
     } else {
--- a/defaults.pl	Tue Nov 27 17:00:50 2018 -0500
+++ b/defaults.pl	Tue Aug 27 19:11:54 2019 -0400
@@ -1,9 +1,9 @@
 #======================================================================
 #                    D E F A U L T S . P L 
 #                    doc: Tue Oct 11 17:11:21 2011
-#                    dlm: Wed May  2 14:11:50 2018
+#                    dlm: Wed Apr 17 11:30:31 2019
 #                    (c) 2011 A.M. Thurnherr
-#                    uE-Info: 308 44 NIL 0 0 72 0 2 4 NIL ofnI
+#                    uE-Info: 343 41 NIL 0 0 72 0 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -332,12 +332,15 @@
 # differnces between the UL and DL data could be due to tilt-
 # sensor differences, rather than due to instrument type.
 
+$max_hspeed_300kHz = 0.55; # m/s
+$max_hspeed_150kHz = 0.35; # m/s
+
 sub max_hspeed()
 {
 	if (abs($LADCP{BEAM_FREQUENCY}-300) <= 25) {		# 300kHz Workhorse
-		$max_hspeed = 0.55;	# meters/second
+		$max_hspeed = $max_hspeed_300kHz;
 	} elsif (abs($LADCP{BEAM_FREQUENCY}-150) <= 25) {	# 150kHz Workhorse
-		$max_hspeed = 0.35;	# meters/second
+		$max_hspeed = $max_hspeed_150kHz;
 	} else {
 		warning(2,"unknown horizontal speed limit for this instrument frequency ($LADCP{BEAM_FREQUENCY} kHz)\n");
 		$max_hspeed = 9e99;
--- a/time_series.pl	Tue Nov 27 17:00:50 2018 -0500
+++ b/time_series.pl	Tue Aug 27 19:11:54 2019 -0400
@@ -1,9 +1,9 @@
 #======================================================================
 #                    T I M E _ S E R I E S . P L 
 #                    doc: Sun May 23 16:40:53 2010
-#                    dlm: Wed May  2 11:23:48 2018
+#                    dlm: Sun Apr 21 14:13:05 2019
 #                    (c) 2010 A.M. Thurnherr
-#                    uE-Info: 24 57 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 25 56 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -22,6 +22,7 @@
 #				  - BUG: gap heuristic could not deal with P06#025
 #	May  1, 2018: - added reflr u and v calculations
 #				  - BUG: reflr u and v calcs did not work
+#	Apr 21, 2019: - improved surface gap warning message
 
 # NOTES:
 #	- resulting DEPTH field based on integrated w without any sound speed correction
@@ -107,8 +108,9 @@
 					last;				
             } elsif ((abs($depth) < 10) ||											# shallow gap at the beginning
             		 ($depth == $max_depth)) {										# biased in-air data
-						warning(1,"long surface gap (%ds) --- restarting at ens#$dta->{ENSEMBLE}[$e]->{NUMBER}\n",$dt);
-						warning(1,"[depth = $depth, max_depth = $max_depth]\n");
+            		 	my($md) = defined($max_depth) ? sprintf('%d',$max_depth) : 'undefined';
+						warning(1,"long surface gap (%ds) --- restarting at ens#$dta->{ENSEMBLE}[$e]->{NUMBER} " .
+								  "[depth = %d m; max_depth = $md]\n",$dt,$depth);
 						$firstgood = $lastgood = $e;
 						undef($atbottom); undef($max_depth);
 						$depth = 0;