start of FZ1
authorA.M. Thurnherr <athurnherr@yahoo.com>
Sun, 06 Jul 2014 14:55:35 -0400
changeset 6 b965580e8782
parent 5 7d6e11d484ec
child 7 f7b4692ad805
child 11 56799f01321a
start of FZ1
antsutils.pl
libRDI_Coords.pl
libvec.pl
--- 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: Thu Sep  5 21:53:55 2013
+#                    dlm: Fri May 23 17:48:00 2014
 #                    (c) 1998 A.M. Thurnherr
-#                    uE-Info: 99 38 NIL 0 0 70 10 2 4 NIL ofnI
+#                    uE-Info: 100 55 NIL 0 0 70 10 2 4 NIL ofnI
 #======================================================================
 
 # Miscellaneous auxillary functions
@@ -97,6 +97,7 @@
 #	Jun 12, 2012: - added &compactList()
 #	Dec 17, 2012: - added default to antsLoadModel()
 #	Sep  5, 2013: - FINALLY: added $pi
+#	May 23, 2014: - made ismember understand "123,1-10"
 
 # fnr notes:
 #	- matches field names starting with the string given, i.e. "sig" is
@@ -157,6 +158,8 @@
 	for (my($i)=0; $i<@set; $i++) {
 		if (numberp($val) && numberp($set[$i])) {
 			return 1 if ($val == $set[$i]);
+		} elsif (numberp($val) && ($set[$i] =~ m{-}) && numberp($`) && numberp($')) {
+			return 1 if (ismember($val,$`..$'));
 		} else {
 			return 1 if ($val eq $set[$i]);
 		}
new file mode 120000
--- /dev/null
+++ b/libRDI_Coords.pl
@@ -0,0 +1,1 @@
+/Data/src/Oceanography/ADCP_tools/libRDI_Coords.pl
\ No newline at end of file
--- 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: Wed Nov 27 23:46:31 2013
+#                    dlm: Wed May 21 21:26:22 2014
 #                    (c) 1999 A.M. Thurnherr
-#                    uE-Info: 36 53 NIL 0 0 70 2 2 4 NIL ofnI
+#                    uE-Info: 39 0 NIL 0 0 70 2 2 4 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -34,6 +34,8 @@
 #	Jun  5, 2012: - added &closestPointOnStraightLine()
 #	Jun 11, 2012: - addeed $t output to &closestPointOnStraightLine()
 #	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
 
 require "$ANTS/libPOSIX.pl";	# acos()
 
@@ -46,14 +48,14 @@
 
 sub rad(@)
 {
-	my($d) = &antsFunUsage(1,"f","<deg>",@_);
-	return $d/180 * $PI;
+	my($d) = &antsFunUsage(1,".","<deg>",@_);
+	return numberp($d) ? $d/180 * $PI : nan;
 }
 
 sub deg(@)
 {
-	my($r) = &antsFunUsage(1,"f","<rad>",@_);
-	return $r/$PI * 180;
+	my($r) = &antsFunUsage(1,".","<rad>",@_);
+	return numberp($r) ? $r/$PI * 180 : nan;
 }
 	
 
@@ -168,7 +170,8 @@
 
 sub angle(@)
 {
-	my($val) = &antsFunUsage(1,"f","<val>",@_);
+	my($val) = &antsFunUsage(1,".","<val>",@_);
+	return nan unless numberp($val);
 	$val += 360 while ($val < -180);
 	$val -= 360 while ($val > 180);
 	return $val;
@@ -177,12 +180,14 @@
 sub angle_pos(@)
 {
 	my($val) = angle(@_);
+	return nan unless numberp($val);
 	return ($val < 0) ? 360+$val : $val;
 }
 
 sub angle_diff(@)
 {
-	my($m,$s) = &antsFunUsage(2,"ff","<minuend> <subtrahend>",@_);
+	my($m,$s) = &antsFunUsage(2,"..","<minuend> <subtrahend>",@_);
+	return nan unless numbersp($m,$s);
 	return angle($m-$s);
 }