equal
deleted
inserted
replaced
1 #====================================================================== |
1 #====================================================================== |
2 # R D I _ B B _ R E A D . P L |
2 # R D I _ B B _ R E A D . P L |
3 # doc: Sat Jan 18 14:54:43 2003 |
3 # doc: Sat Jan 18 14:54:43 2003 |
4 # dlm: Sun Aug 15 16:35:54 2010 |
4 # dlm: Thu May 12 10:50:34 2011 |
5 # (c) 2003 A.M. Thurnherr |
5 # (c) 2003 A.M. Thurnherr |
6 # uE-Info: 47 72 NIL 0 0 72 0 2 4 NIL ofnI |
6 # uE-Info: 48 61 NIL 0 0 72 0 2 4 NIL ofnI |
7 #====================================================================== |
7 #====================================================================== |
8 |
8 |
9 # Read RDI BroadBand Binary Data Files (*.[0-9][0-9][0-9]) |
9 # Read RDI BroadBand Binary Data Files (*.[0-9][0-9][0-9]) |
10 |
10 |
11 # HISTORY: |
11 # HISTORY: |
43 # conserve memory (no large arrays as retvals) |
43 # conserve memory (no large arrays as retvals) |
44 # Jun 4, 2008: - BUG: BB150 code was not considered on Sep 18, 2007 |
44 # Jun 4, 2008: - BUG: BB150 code was not considered on Sep 18, 2007 |
45 # Aug 15, 2010: - downgraded "unexpected number of data types" from error to warning |
45 # Aug 15, 2010: - downgraded "unexpected number of data types" from error to warning |
46 # - BUG: WBRcfn had not been set correctly |
46 # - BUG: WBRcfn had not been set correctly |
47 # - modified to allow processing files without time info |
47 # - modified to allow processing files without time info |
|
48 # May 12, 2011: - added code to report built-in-test errors |
48 |
49 |
49 # FIRMWARE VERSIONS: |
50 # FIRMWARE VERSIONS: |
50 # It appears that different firmware versions generate different file |
51 # It appears that different firmware versions generate different file |
51 # structures. Currently (Sep 2005) these routines have been tested |
52 # structures. Currently (Sep 2005) these routines have been tested |
52 # with the following firmware versions (as reported by [listhdr]): |
53 # with the following firmware versions (as reported by [listhdr]): |
277 # Read Data |
278 # Read Data |
278 #---------------------------------------------------------------------- |
279 #---------------------------------------------------------------------- |
279 |
280 |
280 my($WBRcfn); # current file name |
281 my($WBRcfn); # current file name |
281 my(@WBRofs); # data type offsets |
282 my(@WBRofs); # data type offsets |
|
283 my($BIT_errors) = 0; # built-in-test errors |
282 |
284 |
283 my($FmtErr) = "%s: illegal %s Id 0x%04x at ensemble %d"; |
285 my($FmtErr) = "%s: illegal %s Id 0x%04x at ensemble %d"; |
284 |
286 |
285 sub WBRhdr($) |
287 sub WBRhdr($) |
286 { |
288 { |
563 ${$E}[$ens]->{ADC_CONTAMINATION}) |
565 ${$E}[$ens]->{ADC_CONTAMINATION}) |
564 = unpack('vvvvvvvvCCCCCCCCCCCCCC',$buf); |
566 = unpack('vvvvvvvvCCCCCCCCCCCCCC',$buf); |
565 |
567 |
566 ${$E}[$ens]->{BUILT_IN_TEST_ERROR} = undef |
568 ${$E}[$ens]->{BUILT_IN_TEST_ERROR} = undef |
567 unless (${$E}[$ens]->{BUILT_IN_TEST_ERROR}); |
569 unless (${$E}[$ens]->{BUILT_IN_TEST_ERROR}); |
|
570 $BIT_errors++ if (${$E}[$ens]->{BUILT_IN_TEST_ERROR}); |
|
571 |
568 ${$E}[$ens]->{XDUCER_DEPTH} /= 10; |
572 ${$E}[$ens]->{XDUCER_DEPTH} /= 10; |
569 ${$E}[$ens]->{HEADING} /= 100; |
573 ${$E}[$ens]->{HEADING} /= 100; |
570 ${$E}[$ens]->{PITCH} = unpack('s',pack('S',${$E}[$ens]->{PITCH})) / 100; |
574 ${$E}[$ens]->{PITCH} = unpack('s',pack('S',${$E}[$ens]->{PITCH})) / 100; |
571 ${$E}[$ens]->{ROLL} = unpack('s',pack('S',${$E}[$ens]->{ROLL})) / 100; |
575 ${$E}[$ens]->{ROLL} = unpack('s',pack('S',${$E}[$ens]->{ROLL})) / 100; |
572 ${$E}[$ens]->{TEMPERATURE} = |
576 ${$E}[$ens]->{TEMPERATURE} = |
798 open(WBRF,$WBRcfn) || die("$WBRcfn: $!\n"); |
802 open(WBRF,$WBRcfn) || die("$WBRcfn: $!\n"); |
799 WBRhdr($dta); |
803 WBRhdr($dta); |
800 WBRens($dta->{N_BINS},$dta->{ENSEMBLE_BYTES}, |
804 WBRens($dta->{N_BINS},$dta->{ENSEMBLE_BYTES}, |
801 $dta->{BT_PRESENT},$dta->{DATA_FORMAT}, |
805 $dta->{BT_PRESENT},$dta->{DATA_FORMAT}, |
802 \@{$dta->{ENSEMBLE}}); |
806 \@{$dta->{ENSEMBLE}}); |
|
807 print(STDERR "$WBRcfn: $BIT_errors built-in-test errors\n") |
|
808 if ($BIT_errors); |
803 } |
809 } |
804 |
810 |
805 sub checkEnsemble($$) |
811 sub checkEnsemble($$) |
806 { |
812 { |
807 my($dta,$ens) = @_; |
813 my($dta,$ens) = @_; |