equal
deleted
inserted
replaced
1 #!/usr/bin/perl |
1 #!/usr/bin/perl |
2 #====================================================================== |
2 #====================================================================== |
3 # L I S T E N S |
3 # L I S T E N S |
4 # doc: Sat Jan 18 18:41:49 2003 |
4 # doc: Sat Jan 18 18:41:49 2003 |
5 # dlm: Thu May 12 10:46:46 2011 |
5 # dlm: Wed Mar 20 11:52:46 2013 |
6 # (c) 2003 A.M. Thurnherr |
6 # (c) 2003 A.M. Thurnherr |
7 # uE-Info: 37 99 NIL 0 0 72 2 2 4 NIL ofnI |
7 # uE-Info: 38 45 NIL 0 0 72 2 2 4 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # Print useful info from the ensemble list or dump ensembles to |
10 # Print useful info from the ensemble list or dump ensembles to |
11 # separate files. |
11 # separate files. |
12 |
12 |
33 # Jul 30, 2009: - NaN => nan |
33 # Jul 30, 2009: - NaN => nan |
34 # Aug 15, 2010: - BUG: usage typo |
34 # Aug 15, 2010: - BUG: usage typo |
35 # Dec 10, 2010: - changed ANTS output to time/date instead of UNIX time |
35 # Dec 10, 2010: - changed ANTS output to time/date instead of UNIX time |
36 # Jan 5, 2011: - added -b |
36 # Jan 5, 2011: - added -b |
37 # May 12, 2011: - disabled error exit on built-in-test errors when ensembles are dumped to stdout |
37 # May 12, 2011: - disabled error exit on built-in-test errors when ensembles are dumped to stdout |
|
38 # Mar 20, 2013: - removed DATA_FORMAT stuff |
38 |
39 |
39 # Notes: |
40 # Notes: |
40 # - -E outputs data in earth coordinates, unless -b is set also |
41 # - -E outputs data in earth coordinates, unless -b is set also |
41 # - -E output is always in ANTS format, ignoring -A |
42 # - -E output is always in ANTS format, ignoring -A |
42 # - no soundspeed correction |
43 # - no soundspeed correction |
109 |
110 |
110 if ($opt_A) { # select output fmt: ANTS |
111 if ($opt_A) { # select output fmt: ANTS |
111 unless ($opt_Q) { |
112 unless ($opt_Q) { |
112 printf("#ANTS#PARAMS# N_ensembles{%d}\n",scalar(@{$dta{ENSEMBLE}})); |
113 printf("#ANTS#PARAMS# N_ensembles{%d}\n",scalar(@{$dta{ENSEMBLE}})); |
113 print('#ANTS#FIELDS# {ens} {time} {xducer_up} {temp} {hdg} {pitch} {roll} {XMIT_VOLTAGE} {XMIT_CURRENT}'); |
114 print('#ANTS#FIELDS# {ens} {time} {xducer_up} {temp} {hdg} {pitch} {roll} {XMIT_VOLTAGE} {XMIT_CURRENT}'); |
114 print(' {ESW}') if ($dta{DATA_FORMAT} eq 'WH300'); |
115 print(' {ESW}') if ($dta{FIXED_LEADER_BYTES} >= 53); |
115 print("$addLayout\n"); |
116 print("$addLayout\n"); |
116 } |
117 } |
117 |
118 |
118 $dumpEns = sub ($) |
119 $dumpEns = sub ($) |
119 { |
120 { |
129 $dta{ENSEMBLE}[$e]->{ROLL}, |
130 $dta{ENSEMBLE}[$e]->{ROLL}, |
130 $dta{ENSEMBLE}[$e]->{ADC_XMIT_VOLTAGE}, |
131 $dta{ENSEMBLE}[$e]->{ADC_XMIT_VOLTAGE}, |
131 $dta{ENSEMBLE}[$e]->{ADC_XMIT_CURRENT}, |
132 $dta{ENSEMBLE}[$e]->{ADC_XMIT_CURRENT}, |
132 ); |
133 ); |
133 printf(' %08X',$dta{ENSEMBLE}[$e]->{ERROR_STATUS_WORD}) |
134 printf(' %08X',$dta{ENSEMBLE}[$e]->{ERROR_STATUS_WORD}) |
134 if ($dta{DATA_FORMAT} eq 'WH300'); |
135 if ($dta{FIXED_LEADER_BYTES} >= 53); |
135 foreach my $f (@addFields) { |
136 foreach my $f (@addFields) { |
136 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
137 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
137 $fn = $f unless defined($fn); |
138 $fn = $f unless defined($fn); |
138 my($v) = eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi"); |
139 my($v) = eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi"); |
139 print(defined($v) ? " $v" : " nan"); |
140 print(defined($v) ? " $v" : " nan"); |
220 close(P); |
221 close(P); |
221 } |
222 } |
222 |
223 |
223 } else { # neither ANTS nor ens files |
224 } else { # neither ANTS nor ens files |
224 unless ($opt_Q) { |
225 unless ($opt_Q) { |
225 if ($dta{DATA_FORMAT} eq 'WH300') { |
226 if ($dta{FIXED_LEADER_BYTES} >= 53) { |
226 printf(" # Date Time XD Temp Headng Pitch Roll vels(bin1) ESW$addLayout\n"); |
227 printf(" # Date Time XD Temp Headng Pitch Roll vels(bin1) ESW$addLayout\n"); |
227 printf("-----------------------------------------------------------------------\n"); |
228 printf("-----------------------------------------------------------------------\n"); |
228 } else { |
229 } else { |
229 printf(" # Date Time XD Temp Headng Pitch Roll vels(bin1)$addLayout\n"); |
230 printf(" # Date Time XD Temp Headng Pitch Roll vels(bin1)$addLayout\n"); |
230 printf("-------------------------------------------------------------------\n"); |
231 printf("-------------------------------------------------------------------\n"); |
245 $dta{ENSEMBLE}[$e]->{PITCH}, |
246 $dta{ENSEMBLE}[$e]->{PITCH}, |
246 $dta{ENSEMBLE}[$e]->{ROLL}, |
247 $dta{ENSEMBLE}[$e]->{ROLL}, |
247 $dta{ENSEMBLE}[$e]->{BIN1VELS}, |
248 $dta{ENSEMBLE}[$e]->{BIN1VELS}, |
248 ); |
249 ); |
249 printf(' 0x%08X',$dta{ENSEMBLE}[$e]->{ERROR_STATUS_WORD}) |
250 printf(' 0x%08X',$dta{ENSEMBLE}[$e]->{ERROR_STATUS_WORD}) |
250 if ($dta{DATA_FORMAT} eq 'WH300'); |
251 if ($dta{FIXED_LEADER_BYTES} >= 53); |
251 foreach my $f (@addFields) { |
252 foreach my $f (@addFields) { |
252 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
253 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
253 $fn = $f unless defined($fn); |
254 $fn = $f unless defined($fn); |
254 my($v) = eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi"); |
255 my($v) = eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi"); |
255 print(defined($v) ? " $v" : " nan"); |
256 print(defined($v) ? " $v" : " nan"); |