1 #====================================================================== |
1 #====================================================================== |
2 # R D I _ P D 0 _ I O . P L |
2 # R D I _ P D 0 _ I O . P L |
3 # doc: Sat Jan 18 14:54:43 2003 |
3 # doc: Sat Jan 18 14:54:43 2003 |
4 # dlm: Tue Apr 14 21:43:23 2020 |
4 # dlm: Wed Mar 3 15:02:04 2021 |
5 # (c) 2003 A.M. Thurnherr |
5 # (c) 2003 A.M. Thurnherr |
6 # uE-Info: 126 73 NIL 0 0 72 0 2 4 NIL ofnI |
6 # uE-Info: 1047 82 NIL 0 0 72 2 2 4 NIL ofnI |
7 #====================================================================== |
7 #====================================================================== |
8 |
8 |
9 # Read RDI PD0 binary data files (*.[0-9][0-9][0-9]) |
9 # Read RDI PD0 binary data files (*.[0-9][0-9][0-9]) |
10 |
10 |
11 # HISTORY: |
11 # HISTORY: |
121 # Feb 13, 2020: - added support for $readDataProgress (to Jun 13 version) |
121 # Feb 13, 2020: - added support for $readDataProgress (to Jun 13 version) |
122 # Apr 12, 2020: - merged laptop and whoosher versions which both implemented |
122 # Apr 12, 2020: - merged laptop and whoosher versions which both implemented |
123 # progreass; not sure whether this merge is successful |
123 # progreass; not sure whether this merge is successful |
124 # - disabled duplicate ens detection, which turns reading into |
124 # - disabled duplicate ens detection, which turns reading into |
125 # O(N^2) process |
125 # O(N^2) process |
126 # Apr 14, 2020: - BUG: WBPens did not work for ens# > 65535 (high byte) |
126 # Apr 14, 2020: - BUG: WBPens did not work for ens# > 65535 (high byte) |
|
127 # Mar 3, 2021: - adapted to Nortek PD0 files |
|
128 # END OF HISTORY |
127 |
129 |
128 # FIRMWARE VERSIONS: |
130 # FIRMWARE VERSIONS: |
129 # It appears that different firmware versions generate different file |
131 # It appears that different firmware versions generate different file |
130 # structures. Currently (Sep 2005) these routines have been tested |
132 # structures. Currently (Sep 2005) these routines have been tested |
131 # with the following firmware versions (as reported by [listHdr]): |
133 # with the following firmware versions (as reported by [listHdr]): |
1028 #-------------------- |
1030 #-------------------- |
1029 # Percent Good Data |
1031 # Percent Good Data |
1030 #-------------------- |
1032 #-------------------- |
1031 |
1033 |
1032 my($pctg_di) = WBRdtaIndex(0x0400); |
1034 my($pctg_di) = WBRdtaIndex(0x0400); |
1033 die("no percent good data in ensemble #$ensNo\n") |
1035 if (defined($pctg_di)) { |
1034 unless defined($pctg_di); |
1036 sysseek(WBRF,$start_ens+$WBRofs[$pctg_di],0) || die("$WBRcfn: $!"); |
1035 |
1037 sysread(WBRF,$buf,2+$ndata) == 2+$ndata || die("$WBRcfn: $!"); |
1036 sysseek(WBRF,$start_ens+$WBRofs[$pctg_di],0) || die("$WBRcfn: $!"); |
1038 ($id,@dta) = unpack("vC$ndata",$buf); |
1037 sysread(WBRF,$buf,2+$ndata) == 2+$ndata || die("$WBRcfn: $!"); |
1039 $id == 0x0400 || |
1038 ($id,@dta) = unpack("vC$ndata",$buf); |
1040 die(sprintf($FmtErr,$WBRcfn,"Percent-Good Data",$id,$ensNo)); |
1039 |
1041 for ($i=0,$bin=0; $bin<$nbins; $bin++) { |
1040 $id == 0x0400 || |
1042 for ($beam=0; $beam<4; $beam++,$i++) { |
1041 die(sprintf($FmtErr,$WBRcfn,"Percent-Good Data",$id,$ensNo)); |
1043 ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = $dta[$i]; |
1042 |
1044 } |
1043 for ($i=0,$bin=0; $bin<$nbins; $bin++) { |
1045 } |
1044 for ($beam=0; $beam<4; $beam++,$i++) { |
1046 } else { |
1045 ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = $dta[$i]; |
1047 printf(STDERR "\nWARNING (RDI_PD0_IO): Percent-Good data missing from PD0 file\n") |
1046 } |
1048 if ($ens == 0); |
1047 } |
1049 for ($i=0,$bin=0; $bin<$nbins; $bin++) { |
|
1050 for ($beam=0; $beam<4; $beam++,$i++) { |
|
1051 ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = 100; # fake it |
|
1052 } |
|
1053 } |
|
1054 } |
1048 |
1055 |
1049 #----------------------------------------- |
1056 #----------------------------------------- |
1050 # Bottom-Track Data |
1057 # Bottom-Track Data |
1051 # - scan through remaining data types |
1058 # - scan through remaining data types |
1052 #----------------------------------------- |
1059 #----------------------------------------- |