listBins
changeset 18 bb7bb9f83db9
parent 13 b176da8559b3
child 21 0b5bbe60131c
--- a/listBins
+++ b/listBins
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L I S T B I N S 
 #                    doc: Fri Aug 25 15:57:05 2006
-#                    dlm: Wed Aug  7 10:04:28 2013
+#                    dlm: Tue Apr 22 12:39:09 2014
 #                    (c) 2006 A.M. Thurnherr
-#                    uE-Info: 48 46 NIL 0 0 72 2 2 4 NIL ofnI
+#                    uE-Info: 50 45 NIL 0 0 72 2 2 4 NIL ofnI
 #======================================================================
 
 # Split data file into per-bin time series.
@@ -46,6 +46,8 @@
 #	Apr 29, 2013: - cosmetics
 #				  - added warning on missing -S
 #	Aug  7, 2013: - BUG: -w did not respect -d
+#   Mar  4, 2014: - added support for missing PITCH/ROLL/HEADING
+#	Apr 22, 2014: - BUG: extraneous semicolon
 
 # General Notes:
 #	- everything (e.g. beams) is numbered from 1
@@ -174,9 +176,9 @@
 		print(P "$dta{ENSEMBLE}[$e]->{DATE} ");
 		print(P "$dta{ENSEMBLE}[$e]->{TIME} ");
 		printf(P "%d ",$dta{ENSEMBLE}[$e]->{UNIX_TIME}-$t0);
-		print(P "$dta{ENSEMBLE}[$e]->{HEADING} ");
-		print(P "$dta{ENSEMBLE}[$e]->{PITCH} ");
-		print(P "$dta{ENSEMBLE}[$e]->{ROLL} ");
+		print(P defined($dta{ENSEMBLE}[$e]->{HEADING}) ? "$dta{ENSEMBLE}[$e]->{HEADING} " : 'nan ');
+		print(P defined($dta{ENSEMBLE}[$e]->{PITCH}) ? "$dta{ENSEMBLE}[$e]->{PITCH} " : 'nan ');
+		print(P defined($dta{ENSEMBLE}[$e]->{ROLL}) ? "$dta{ENSEMBLE}[$e]->{ROLL} " : 'nan ');
 		print(P "$dta{ENSEMBLE}[$e]->{HEADING_STDDEV} ");
 		print(P "$dta{ENSEMBLE}[$e]->{PITCH_STDDEV} ");
 		print(P "$dta{ENSEMBLE}[$e]->{ROLL_STDDEV} ");
@@ -250,8 +252,10 @@
 	next if (defined($first_ens) &&
 			 $dta{ENSEMBLE}[$e]->{NUMBER} < $first_ens);
 
-	$dta{ENSEMBLE}[$e]->{PITCH} -= $P{pitch_bias};
-	$dta{ENSEMBLE}[$e]->{ROLL}  -= $P{roll_bias};
+	$dta{ENSEMBLE}[$e]->{PITCH} -= $P{pitch_bias}
+		if defined($dta{ENSEMBLE}[$e]->{PITCH});
+	$dta{ENSEMBLE}[$e]->{ROLL}  -= $P{roll_bias}
+		if defined($dta{ENSEMBLE}[$e]->{ROLL});
 
 	$P{first_ens} = $dta{ENSEMBLE}[$e]->{NUMBER},$fe = $e
 		unless defined($P{first_ens});