listHdr
changeset 61 69192495f0db
parent 58 78607e2e8add
equal deleted inserted replaced
60:890e267a2d98 61:69192495f0db
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #======================================================================
     2 #======================================================================
     3 #                    L I S T H D R 
     3 #                    L I S T H D R 
     4 #                    doc: Sat Jan 18 18:41:49 2003
     4 #                    doc: Sat Jan 18 18:41:49 2003
     5 #                    dlm: Wed Mar 17 22:53:25 2021
     5 #                    dlm: Mon Oct 18 11:05:30 2021
     6 #                    (c) 2003 A.M. Thurnherr
     6 #                    (c) 2003 A.M. Thurnherr
     7 #                    uE-Info: 50 35 NIL 0 0 72 10 2 4 NIL ofnI
     7 #                    uE-Info: 117 41 NIL 0 0 72 10 2 4 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 # Print useful info from the RDI BB header
    10 # Print useful info from the RDI BB header
    11 
    11 
    12 # HISTORY:
    12 # HISTORY:
    46 # 	Jun 13, 2019: - removed BT_PRESENT flag support
    46 # 	Jun 13, 2019: - removed BT_PRESENT flag support
    47 #	Jun 26, 2019: - added comment to the effect that BT setup cannot be listed
    47 #	Jun 26, 2019: - added comment to the effect that BT setup cannot be listed
    48 #					with this utility any more
    48 #					with this utility any more
    49 #	Mar  6, 2021: - adapted to Nortek Signature data files
    49 #	Mar  6, 2021: - adapted to Nortek Signature data files
    50 #	Mar 17, 2021: - updated HISTORY
    50 #	Mar 17, 2021: - updated HISTORY
       
    51 #	Aug 23, 2021: - added power and bandwidth to -s output
    51 
    52 
    52 use Getopt::Std;
    53 use Getopt::Std;
    53 
    54 
    54 ($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+});
    55 ($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+});
    55 $ADCP_tools_minVersion = 2.1; 
    56 $ADCP_tools_minVersion = 2.1; 
    59     unless (&getopts('ls') && @ARGV);
    60     unless (&getopts('ls') && @ARGV);
    60 
    61 
    61 if ($opt_s) {
    62 if ($opt_s) {
    62 	print("#!/usr/bin/perl -S list\n");     
    63 	print("#!/usr/bin/perl -S list\n");     
    63 	chmod(0777&~umask,*STDOUT);
    64 	chmod(0777&~umask,*STDOUT);
    64 	print("#ANTS#FIELDS# {id} {serial_number} {transducer_frequency} {number_of_bins} {blanking_distance} {bin_length} {pulse_length}\n");
    65 	print("#ANTS#FIELDS# {id} {serial_number} {transducer_frequency} {max_power} {bandwidth}" .
       
    66 					   " {number_of_bins} {blanking_distance} {bin_length} {pulse_length}\n");
    65 }
    67 }
    66 
    68 
    67 while ($ARGV[0] ne '') {
    69 while ($ARGV[0] ne '') {
    68 	die("$ARGV[0]: No such file or directory\n")
    70 	die("$ARGV[0]: No such file or directory\n")
    69 		unless (-f $ARGV[0]);
    71 		unless (-f $ARGV[0]);
    76 		if ($id =~ /^\w{5}\d{3}\.\d{3}/) {								# leave just deployment name for std RDI files
    78 		if ($id =~ /^\w{5}\d{3}\.\d{3}/) {								# leave just deployment name for std RDI files
    77 			$id =~ s/00[0-9]\.000//;										
    79 			$id =~ s/00[0-9]\.000//;										
    78 			$id =~ s@^.*/([^/]+)@\1@;
    80 			$id =~ s@^.*/([^/]+)@\1@;
    79 		}
    81 		}
    80 		if ($valid) {
    82 		if ($valid) {
    81 			printf("%s %d %.1f %d %g %d %.1f\n",
    83 			printf("%s %d %.1f %d %s %d %g %d %.1f\n",
    82 				$id,$hdr{SERIAL_NUMBER},$hdr{BEAM_FREQUENCY},
    84 				$id,$hdr{SERIAL_NUMBER},$hdr{BEAM_FREQUENCY},
       
    85 				$hdr{TRANSMIT_POWER_MAX},($hdr{NARROW_BANDWIDTH} ? 'narrow' : 'wide'),
    83 				$hdr{N_BINS},$hdr{BLANKING_DISTANCE},$hdr{BIN_LENGTH},
    86 				$hdr{N_BINS},$hdr{BLANKING_DISTANCE},$hdr{BIN_LENGTH},
    84 	            $hdr{TRANSMITTED_PULSE_LENGTH});
    87 	            $hdr{TRANSMITTED_PULSE_LENGTH});
    85 	    } else {
    88 	    } else {
    86 			printf("%s [no complete ensemble in file]\n",$id);
    89 			printf("%s [no complete ensemble in file]\n",$id);
    87 	    }
    90 	    }
   109 	printf("\tLAG_LENGTH\t\t\t= %d\n",$hdr{LAG_LENGTH}) if $opt_l;
   112 	printf("\tLAG_LENGTH\t\t\t= %d\n",$hdr{LAG_LENGTH}) if $opt_l;
   110 	printf("\tN_DEMODS\t\t\t= %d\n",$hdr{N_DEMODS}) if $opt_l && defined($hdr{N_DEMODS});
   113 	printf("\tN_DEMODS\t\t\t= %d\n",$hdr{N_DEMODS}) if $opt_l && defined($hdr{N_DEMODS});
   111 	printf("\tSPEED_OF_SOUND\t\t\t= %d m/s [%s]\n",
   114 	printf("\tSPEED_OF_SOUND\t\t\t= %d m/s [%s]\n",
   112 				$hdr{SPEED_OF_SOUND},
   115 				$hdr{SPEED_OF_SOUND},
   113 				$hdr{SSPEED_CALCULATED} ? 'using measurements' : 'from settings');
   116 				$hdr{SSPEED_CALCULATED} ? 'using measurements' : 'from settings');
   114 	printf("\tAMBIGUITY_VELOCITY\t\t= %.1f m/s\n",
   117 	printf("\tAMBIGUITY_VELOCITY\t\t= %.2f m/s\n",
   115 				ambiguity_velocity($hdr{BEAM_FREQUENCY},$hdr{BEAM_ANGLE},$hdr{SPEED_OF_SOUND},$hdr{TRANSMIT_LAG_DISTANCE}))
   118 				ambiguity_velocity($hdr{BEAM_FREQUENCY},$hdr{BEAM_ANGLE},$hdr{SPEED_OF_SOUND},$hdr{TRANSMIT_LAG_DISTANCE}))
   116 					unless ($hdr{INSTRUMENT_TYPE} eq 'Signature');
   119 					unless ($hdr{INSTRUMENT_TYPE} eq 'Signature');
   117 
   120 
   118 	printf("\tEnvironmental Sensors\t\t: ");
   121 	printf("\tEnvironmental Sensors\t\t: ");
   119 	printf("PRESSURE ") 						if ($hdr{PRESSURE_SENSOR});
   122 	printf("PRESSURE ") 						if ($hdr{PRESSURE_SENSOR});