.
--- a/INDEX
+++ b/INDEX
@@ -1,9 +1,9 @@
======================================================================
I N D E X
doc: Wed Jun 18 09:46:58 1997
- dlm: Mon Aug 5 12:16:56 2013
+ dlm: Tue Nov 19 10:23:18 2013
(c) 1997 Andreas Thurnherr
- uE-Info: 135 78 NIL 0 0 72 2 2 4 NIL ofnI
+ uE-Info: 49 58 NIL 0 0 72 2 2 4 NIL ofnI
======================================================================
NOTES:
@@ -45,7 +45,8 @@
[.interp.spline] spline interpolation
[.interp.nnbr] nearest-neighbor
[.interp.ADCP] RDI ADCP velocity sampling (triangular instrument response)
-[waterdepth]!!! get water depth from Smith and Sandwell topography
+[waterdepth]!!! get water depth from Smith and Sandwell topography
+[WKBscale]!!! apply WKB scaling to velocity profiles
[xover] get crossover stations
[xpgrams]!!! extract pgrams from [binpgrams] [LADCPfs] output for plotting
[yoyo] splits yoyo file into individual casts
--- a/libstats.pl
+++ b/libstats.pl
@@ -1,9 +1,9 @@
#======================================================================
# L I B S T A T S . P L
# doc: Wed Mar 24 13:59:27 1999
-# dlm: Mon Jun 10 21:10:04 2013
+# dlm: Sun Nov 24 23:23:11 2013
# (c) 1999 A.M. Thurnherr
-# uE-Info: 106 0 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 192 1 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -32,6 +32,8 @@
# - added sum()
# Apr 26, 2012: - BUG: std() did not allow nan as stddev input
# Oct 15, 2012: - added max_i(), min_i()
+# Nov 24, 2013: - renamed N to ndata
+# - added fdiff()
require "$ANTS/libfuns.pl";
@@ -50,6 +52,7 @@
#----------------------------------------------------------------------
# calc standard stats from vector of vals
+# - used, e.g., in [rfilt]
#----------------------------------------------------------------------
sub min(@)
@@ -92,7 +95,7 @@
return $max>-9e99 ? $max_i : nan;
}
-sub N(@)
+sub ndata(@)
{
my($N) = 0;
for (my($i)=0; $i<=$#_; $i++) { $N++ if (numberp($_[$i])); }
@@ -183,6 +186,12 @@
return ($n>0) ? $sum/$n : nan;
}
+sub fdiff(@) # finite difference, e.g. for [rfilt]
+{
+ return (numberp($_[0]) && numberp($_[$#_])) ? $_[$#_] - $_[0] : nan;
+}
+
+
#----------------------------------------------------------------------
# &bootstrap(nDraw,cLim,statFun,val[,...])
# nDraw number of synthetic samples to draw
--- a/libvec.pl
+++ b/libvec.pl
@@ -1,9 +1,9 @@
#======================================================================
-# . . / A N T S L I B / L I B V E C . P L
+# L I B V E C . P L
# doc: Sat Mar 20 12:50:32 1999
-# dlm: Mon Jun 11 11:12:06 2012
+# dlm: Wed Nov 27 23:46:31 2013
# (c) 1999 A.M. Thurnherr
-# uE-Info: 35 69 NIL 0 0 70 2 2 4 NIL ofnI
+# uE-Info: 36 53 NIL 0 0 70 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -33,6 +33,7 @@
# Apr 22, 2010: - added angle_ts()
# Jun 5, 2012: - added &closestPointOnStraightLine()
# Jun 11, 2012: - addeed $t output to &closestPointOnStraightLine()
+# Nov 27, 2013: - added &angle_pos(), mag_heading()
require "$ANTS/libPOSIX.pl"; # acos()
@@ -141,10 +142,24 @@
sub vel_v(@) { return &cartesian_y($_[0],90-$_[1]); }
#----------------------------------------------------------------------
+# magnetic heading from magnetometer; losely based on info found on-line;
+# note that mag_x = mag_y = 0 is singularity
+#----------------------------------------------------------------------
+
+sub mag_heading($$)
+{
+ if ($_[1] != 0) { return 270 - deg(atan2($_[0],$_[1])); }
+ elsif ($_[0] < 0) { return 180; }
+ else { return 0; }
+}
+
+#----------------------------------------------------------------------
# &angle(val)
# return angle in range [-180,180]
+# &angle_pos(val)
+# return angle in range [0,360]
# &angle_diff(ref_dir,dir)
-# return rotation between two angles
+# return rotation between two angles in range [-180,180]
# &rotation_ts(dir)
# return time series of rotation
# &angle_ts(dir)
@@ -159,6 +174,12 @@
return $val;
}
+sub angle_pos(@)
+{
+ my($val) = angle(@_);
+ return ($val < 0) ? 360+$val : $val;
+}
+
sub angle_diff(@)
{
my($m,$s) = &antsFunUsage(2,"ff","<minuend> <subtrahend>",@_);