# HG changeset patch # User Andreas Thurnherr # Date 1614865133 18000 # Node ID 540d6574caca18189e3c614d5de62fd02047061d # Parent 21cf468fa8e0c0981c4806507a28a63d4f5fc63d adapted to Nortek diff --git a/RDI_PD0_IO.pl b/RDI_PD0_IO.pl --- a/RDI_PD0_IO.pl +++ b/RDI_PD0_IO.pl @@ -1,9 +1,9 @@ #====================================================================== # R D I _ P D 0 _ I O . P L # doc: Sat Jan 18 14:54:43 2003 -# dlm: Tue Apr 14 21:43:23 2020 +# dlm: Wed Mar 3 15:02:04 2021 # (c) 2003 A.M. Thurnherr -# uE-Info: 126 73 NIL 0 0 72 0 2 4 NIL ofnI +# uE-Info: 1047 82 NIL 0 0 72 2 2 4 NIL ofnI #====================================================================== # Read RDI PD0 binary data files (*.[0-9][0-9][0-9]) @@ -123,7 +123,9 @@ # progreass; not sure whether this merge is successful # - disabled duplicate ens detection, which turns reading into # O(N^2) process -# Apr 14, 2020: - BUG: WBPens did not work for ens# > 65535 (high byte) +# Apr 14, 2020: - BUG: WBPens did not work for ens# > 65535 (high byte) +# Mar 3, 2021: - adapted to Nortek PD0 files +# END OF HISTORY # FIRMWARE VERSIONS: # It appears that different firmware versions generate different file @@ -1030,21 +1032,26 @@ #-------------------- my($pctg_di) = WBRdtaIndex(0x0400); - die("no percent good data in ensemble #$ensNo\n") - unless defined($pctg_di); - - sysseek(WBRF,$start_ens+$WBRofs[$pctg_di],0) || die("$WBRcfn: $!"); - sysread(WBRF,$buf,2+$ndata) == 2+$ndata || die("$WBRcfn: $!"); - ($id,@dta) = unpack("vC$ndata",$buf); - - $id == 0x0400 || - die(sprintf($FmtErr,$WBRcfn,"Percent-Good Data",$id,$ensNo)); - - for ($i=0,$bin=0; $bin<$nbins; $bin++) { - for ($beam=0; $beam<4; $beam++,$i++) { - ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = $dta[$i]; - } - } + if (defined($pctg_di)) { + sysseek(WBRF,$start_ens+$WBRofs[$pctg_di],0) || die("$WBRcfn: $!"); + sysread(WBRF,$buf,2+$ndata) == 2+$ndata || die("$WBRcfn: $!"); + ($id,@dta) = unpack("vC$ndata",$buf); + $id == 0x0400 || + die(sprintf($FmtErr,$WBRcfn,"Percent-Good Data",$id,$ensNo)); + for ($i=0,$bin=0; $bin<$nbins; $bin++) { + for ($beam=0; $beam<4; $beam++,$i++) { + ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = $dta[$i]; + } + } + } else { + printf(STDERR "\nWARNING (RDI_PD0_IO): Percent-Good data missing from PD0 file\n") + if ($ens == 0); + for ($i=0,$bin=0; $bin<$nbins; $bin++) { + for ($beam=0; $beam<4; $beam++,$i++) { + ${$E}[$ens]->{PERCENT_GOOD}[$bin][$beam] = 100; # fake it + } + } + } #----------------------------------------- # Bottom-Track Data diff --git a/listEns b/listEns --- a/listEns +++ b/listEns @@ -2,9 +2,9 @@ #====================================================================== # L I S T E N S # doc: Sat Jan 18 18:41:49 2003 -# dlm: Sun Feb 28 15:46:21 2021 +# dlm: Wed Mar 3 15:35:40 2021 # (c) 2003 A.M. Thurnherr -# uE-Info: 351 1 NIL 0 0 72 2 2 4 NIL ofnI +# uE-Info: 239 14 NIL 0 0 72 2 2 4 NIL ofnI #====================================================================== $synopsis = 'list ensemble summaries (default), dump ensembles (-E), time-average ensembles (-T)'; @@ -62,6 +62,8 @@ # May 31, 2018: - BUG: -A was disabled by default # Feb 13, 2020: - added support for $readDataProgress # Feb 19, 2021: - BUG: -T did not handle new years correctly +# Mar 3, 2021: - BUG: debug statement left in place +# END OF HISTORY # Notes: # - -E/-B outputs data in earth coordinates, unless -b is set also @@ -234,7 +236,7 @@ open(P,">$file") || die("$file: $!\n"); print(P "#!/usr/bin/perl -S list\n"); - print(P "#ANTS#PARAMS# " . + printf(P "#ANTS#PARAMS# " . "date{$dta{ENSEMBLE}[$e]->{DATE}} " . "time{$dta{ENSEMBLE}[$e]->{TIME}} " . "soundspeed_correction{%s} " . @@ -531,8 +533,6 @@ } } # define output format -die("$yearbase") unless ($yearbase > 1900); - #---------------------------------------------------------------------- # Loop Over Ensembles #----------------------------------------------------------------------