version after ECOGIG EN586 cruise
authorA.M. Thurnherr <athurnherr@yahoo.com>
Fri, 05 Aug 2016 10:35:20 -0400
changeset 29 f41d125405a6
parent 28 db6c3d13f8be
child 30 1a1a12d5edc1
version after ECOGIG EN586 cruise
HISTORY
ants.pl
antsutils.pl
libSBE.pl
libvec.pl
--- a/HISTORY
+++ b/HISTORY
@@ -1,15 +1,17 @@
 #======================================================================
 #                    H I S T O R Y 
 #                    doc: Thu May  7 13:12:05 2015
-#                    dlm: Tue Mar 29 14:57:38 2016
+#                    dlm: Fri Aug  5 10:34:27 2016
 #                    (c) 2015 A.M. Thurnherr
-#                    uE-Info: 61 37 NIL 0 0 72 0 2 4 NIL ofnI
+#                    uE-Info: 83 10 NIL 0 0 72 0 2 4 NIL ofnI
 #======================================================================
 
 May  7, 2015:
   	- V6.0 [ants.pl] [.hg/hgrc] 
 	- published for release of LADCPproc V1.2 (Slocum/Explorer processing)
 
+----------------------------------------
+
 May 17, 2015:
 	- V6.1 [ants.pl] [.hg/hgrc] 
 	- added $skip to cFFT to for LADCP_w_spec and binpgrams
@@ -29,6 +31,8 @@
 	- V6.2 [ants.pl] [.hg/hgrc] 
 	- published on Mercurial server for LADCP_w V1.0
 
+----------------------------------------
+
 Nov 19, 2015:
 	- [librand.pl] created
 
@@ -53,9 +57,28 @@
 	- improved [libGMT.pl] to check for gmt5
 	- published
 
+----------------------------------------
+
 Mar 19, 2016:
 	- significant bugs in [libSBE.pl]
 	
-Mar 29, 2106:
+Mar 29, 2016:
 	- V6.6 [ants.pl] [.hg/hgrc] 
 	- published for LADCP_w V1.2beta6
+
+----------------------------------------
+
+May 12, 2016:
+	- added div2 to [antsutils.pl]
+
+May 31, 2016:
+	- minor improvement to [libSBE.pl]
+
+Jul 29, 2016:
+	- [libvec.pl] mag_heading() was inconsistent
+	  with TRDI ADCP heading convention
+
+Aug  5, 2016:
+	- updated [HISTORY]
+	- V6.7 [ants.pl] [.hg/hgrc] 
+
--- a/ants.pl
+++ b/ants.pl
@@ -2,9 +2,9 @@
 #======================================================================
 #                    A N T S . P L 
 #                    doc: Fri Jun 19 14:01:06 1998
-#                    dlm: Tue Mar 29 14:57:11 2016
+#                    dlm: Fri Aug  5 10:34:49 2016
 #                    (c) 1998 A.M. Thurnherr
-#                    uE-Info: 22 34 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 28 21 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -20,11 +20,12 @@
 #  Mar 16, 2016: - updated to V6.4 (for LADCP_w 1.2beta5)
 #  Mar 17, 2016: - updated to V6.5
 #  Mar 29, 2016: - updated to V6.6
+#  Aug  5, 2016: - updated to V6.7
 
 exec($ENV{ANTS_PERL},$0,@ARGV),die("$ENV{ANTS_PERL}: $!")
     if (defined($ENV{ANTS_PERL}) && $^X ne $ENV{ANTS_PERL});
 
-$antsLibVersion = 6.6;
+$antsLibVersion = 6.7;
 
 die(sprintf("$0: obsolete library V%.1f; V%.1f required\n",
 	$antsLibVersion,$antsMinLibVersion))
--- a/antsutils.pl
+++ b/antsutils.pl
@@ -2,9 +2,9 @@
 #======================================================================
 #                    A N T S U T I L S . P L 
 #                    doc: Fri Jun 19 23:25:50 1998
-#                    dlm: Fri Jun 12 07:31:08 2015
+#                    dlm: Wed May 25 12:16:39 2016
 #                    (c) 1998 A.M. Thurnherr
-#                    uE-Info: 103 66 NIL 0 0 70 10 2 4 NIL ofnI
+#                    uE-Info: 104 31 NIL 0 0 70 10 2 4 NIL ofnI
 #======================================================================
 
 # Miscellaneous auxillary functions
@@ -101,6 +101,7 @@
 #	Jul 22, 2014: - removed support for antsFnrNegativeOk
 #	May 18, 2015: - added antsFindParam()
 #	Jun 21, 2015: - added antsParam(), modified antsRequireParam()
+#	May 12, 2016: - added &div2() to prevent division by zero errors
 
 # fnr notes:
 #	- matches field names starting with the string given, i.e. "sig" is
@@ -147,6 +148,9 @@
 sub equal($$)
 { return (@_ >= 2) && (abs($_[0]-$_[1]) < $PRACTICALLY_ZERO); }
 
+sub div2($$)
+{ return $_[1] ? $_[0]/$_[1] : inf; }
+
 #----------------------------------------------------------------------
 # check whether given val is member of a set
 #	- set can either be an array or a comma-separated string
--- a/libSBE.pl
+++ b/libSBE.pl
@@ -1,9 +1,9 @@
 #======================================================================
 #                    L I B S B E . P L 
 #                    doc: Mon Nov  3 12:42:14 2014
-#                    dlm: Sat Mar 19 18:17:54 2016
+#                    dlm: Tue May 31 13:12:22 2016
 #                    (c) 2014 A.M. Thurnherr
-#                    uE-Info: 18 71 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 287 43 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -16,6 +16,7 @@
 #				  - solution for files with multiple conductivity units: ignore
 #				    all conducitivities with units not equal to the first cond var
 #				  - added $libSBE_quiet to suppress diagnostic messages
+#	May 31, 2016: - made successfully decoding lat/lon optional
 
 #----------------------------------------------------------------------
 # fname_SBE2std($)
@@ -267,19 +268,25 @@
 	
 		if (($hdr =~ /Latitude\s*[:=]\s*/) && !defined($lat)) {
 			($deg,$min,$NS) = split(/\s+/,$');
-			croak("$0: cannot decode latitude ($')\n")
-				unless ($NS eq 'N' || $NS eq 'S');
-			$lat = $deg + $min/60;
-			$lat *= -1 if ($NS eq 'S');
+			if ($NS eq 'N' || $NS eq 'S') {
+				$lat = $deg + $min/60;
+				$lat *= -1 if ($NS eq 'S');
+			} else {
+				print(STDERR "$0: WARNING: cannot decode latitude ($')\n");
+				$lat = nan;
+			}
 			&antsAddParams('lat',$lat);
 			next;
 		}
 		if (($hdr =~ /Longitude\s*[:=]\s*/) && !defined($lon)) {
 			($deg,$min,$EW) = split(/\s+/,$');
-			croak("$0: cannot decode longitude ($')\n")
-				unless ($EW eq 'E' || $EW eq 'W');
-			$lon = $deg + $min/60;
-			$lon *= -1 if ($EW eq 'W');
+			if ($EW eq 'E' || $EW eq 'W') {
+				$lon = $deg + $min/60;
+				$lon *= -1 if ($EW eq 'W');
+			} else {
+				print(STDERR "$0: WARNING: cannot decode longitude ($')\n");
+				$lon= nan;
+			}
 			&antsAddParams('lon',$lon);
 			next;
 		}
--- a/libvec.pl
+++ b/libvec.pl
@@ -1,9 +1,9 @@
 #======================================================================
 #                    L I B V E C . P L 
 #                    doc: Sat Mar 20 12:50:32 1999
-#                    dlm: Sun Jul  6 15:33:50 2014
+#                    dlm: Fri Jul 29 15:26:45 2016
 #                    (c) 1999 A.M. Thurnherr
-#                    uE-Info: 150 24 NIL 0 0 70 2 2 4 NIL ofnI
+#                    uE-Info: 42 32 NIL 0 0 70 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -36,6 +36,10 @@
 #	Nov 27, 2013: - added &angle_pos(), mag_heading()
 #	Mar  3, 2014: - made deg(), rad() handle nans
 #	Mar  4, 2014: - made some angle funs handle nans
+#	Jul 29, 2016: - BUG: mag_heading was inconsistent with ADCP headings
+#						 (previous version only used for 2014 CLIVAR P06
+#						 processing with IMP data with confused coord
+#						 system)
 
 require "$ANTS/libPOSIX.pl";	# acos()
 
@@ -146,13 +150,17 @@
 #----------------------------------------------------------------------
 # magnetic heading from magnetometers
 #	- atan2 handles all the singularities
-#	- without the minus, the heading turns the wrong way when comparing
-#	  IMP and WH300 data
+#	- the current version (7/29/2016) was verified with ECOGIG EN586
+#	  data, where the IMP Mk.3 rev 2 (i.e. with coordinate mapping
+#	  in the sensor board) on profiles 1-15 was accidentally installed
+#	  in a consistent orientation with the DL (very similar pitch/roll
+#	  measured by both instruments) => heading is directly comparable
 #----------------------------------------------------------------------
 
 sub mag_heading($$)
 {
-    return angle_pos(deg(-atan2($_[0],$_[1])));
+#    return angle_pos(deg(-atan2($_[0],$_[1])));	# used for 2014 CLIVAR P06 IMP processing with confused coord systems
+	return angle_pos(deg(atan2($_[1],$_[0])));
 }
 
 #----------------------------------------------------------------------