author | A.M. Thurnherr <athurnherr@yahoo.com> |
Sun, 21 Oct 2018 19:52:56 -0400 | |
changeset 43 | b63fa355644c |
parent 42 | 80d039881d2c |
child 48 | cdc74ebada81 |
permissions | -rwxr-xr-x |
0 | 1 |
#!/usr/bin/perl |
2 |
#====================================================================== |
|
3 |
# L I S T H D R |
|
4 |
# doc: Sat Jan 18 18:41:49 2003 |
|
43
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
5 |
# dlm: Tue Mar 20 12:18:03 2018 |
0 | 6 |
# (c) 2003 A.M. Thurnherr |
43
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
7 |
# uE-Info: 74 9 NIL 0 0 72 10 2 4 NIL ofnI |
0 | 8 |
#====================================================================== |
9 |
||
10 |
# Print useful info from the RDI BB header |
|
11 |
||
12 |
# HISTORY: |
|
13 |
# Jan 18, 2003: - incepted as a test for [WorkhorseBinRead.pl] |
|
14 |
# Jan 19, 2003: - continued |
|
15 |
# Feb 14, 2003: - added BT setup params |
|
16 |
# Mar 15, 2003: - added and removed BATTERY |
|
17 |
# Feb 24, 2004: - corrected TRANSMIT_LAG_DISTANCE units |
|
18 |
# Feb 26, 2004: - added ENSEMBLE_LENGTH |
|
19 |
# - added FIRMWARE |
|
20 |
# Mar 4, 2004: - added transducer orientation |
|
21 |
# Mar 30, 2004: - decified firmware output |
|
22 |
# Sep 14, 2005: - made BT data optional, dep. on NUMBER_OF_DATA_TYPES |
|
23 |
# - added DATA_FORMAT & related |
|
24 |
# Sep 15, 2005: - change BinRead library name |
|
25 |
# - compacted output format |
|
26 |
# Oct 30, 2005: - shuffled stuff, added DATA_FORMAT_VARIANT |
|
27 |
# Aug 21, 2006: - added CPU_SERIAL_NUMBER |
|
28 |
# - added usage error |
|
29 |
# Sep 19, 2007: - adapted to new [RDI_BB_Read.pl] (not tested) |
|
30 |
# Jul 9, 2008: - added output regarding available sensors |
|
10 | 31 |
# Mar 20, 2013: - removed DATA_FORMAT stuff |
32 |
# Mar 25, 2013: - added INSTRUMENT_TYPE stuff instead |
|
20 | 33 |
# Apr 24, 2014: - BUG: USE_3_BEAM_ON_LOW_CORR was reported in water-track setup |
34 |
# Jul 12, 2014: - BUG: did not work with multiple input files |
|
35 |
# - added -s)ummary option |
|
21 | 36 |
# Sep 9, 2014: - adapted to files with >7 data types |
29 | 37 |
# - BUG: usage message was not produced on empty arglist |
30 | 38 |
# Jan 9, 2016: - added support for PRODUCER data field |
29 | 39 |
# - updated getopts to current perl version |
40 |
# - updated IO library name |
|
31 | 41 |
# - adapted to [ADCP_tools_lib.pl] |
37 | 42 |
# Nov 9, 2016: - BUG: no error on missing files |
39 | 43 |
# Aug 7, 2017: - added LAG_LENGTH |
44 |
# - added AMBIGUITY_VELOCITY |
|
45 |
# Aug 8, 2017: - added -l)ong listing |
|
0 | 46 |
|
29 | 47 |
use Getopt::Std; |
48 |
||
31 | 49 |
($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+}); |
42 | 50 |
$ADCP_tools_minVersion = 2.1; |
31 | 51 |
require "$ADCP_TOOLS/ADCP_tools_lib.pl"; |
0 | 52 |
|
39 | 53 |
die("Usage: $0 [-s)ummary] [-l)ong listing] <PD0 file[...]>\n") |
54 |
unless (&getopts('ls') && @ARGV); |
|
20 | 55 |
|
56 |
if ($opt_s) { |
|
57 |
print("#!/usr/bin/perl -S list\n"); |
|
58 |
chmod(0777&~umask,*STDOUT); |
|
59 |
print("#ANTS#FIELDS# {id} {serial_number} {transducer_frequency} {number_of_bins} {blanking_distance} {bin_length} {pulse_length}\n"); |
|
60 |
} |
|
0 | 61 |
|
37 | 62 |
while ($ARGV[0] ne '') { |
63 |
die("$ARGV[0]: No such file or directory\n") |
|
64 |
unless (-f $ARGV[0]); |
|
65 |
||
42 | 66 |
my($valid) = readHeader($ARGV[0],\%hdr,$opt_s); |
20 | 67 |
print("$ARGV[0]:\n") unless ($opt_s); |
68 |
||
69 |
if ($opt_s) { # summary ANTS output |
|
70 |
my($id) = $ARGV[0]; |
|
43
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
71 |
if ($id =~ /^\w{5}\d{3}\.\d{3}/) { # leave just deployment name for std RDI files |
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
72 |
$id =~ s/00[0-9]\.000//; |
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
73 |
$id =~ s@^.*/([^/]+)@\1@; |
b63fa355644c
commit to merge with changes from EN620
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
42
diff
changeset
|
74 |
} |
42 | 75 |
if ($valid) { |
76 |
printf("%s %d %.1f %d %g %d %.1f\n", |
|
77 |
$id,$hdr{SERIAL_NUMBER},$hdr{BEAM_FREQUENCY}, |
|
78 |
$hdr{N_BINS},$hdr{BLANKING_DISTANCE},$hdr{BIN_LENGTH}, |
|
79 |
$hdr{TRANSMITTED_PULSE_LENGTH}); |
|
80 |
} else { |
|
81 |
printf("%s [no complete ensemble in file]\n",$id); |
|
82 |
} |
|
20 | 83 |
shift; |
84 |
next; |
|
85 |
} |
|
86 |
||
0 | 87 |
shift; |
88 |
print(" Instrument Characteristics:\n"); |
|
89 |
||
31 | 90 |
printf("\tPRODUCER\t\t\t= %s\n",$hdr{PRODUCER}); |
10 | 91 |
if (defined($hdr{SERIAL_NUMBER})) { |
92 |
printf("\tINSTRUMENT\t\t\t= %s #%d\n",$hdr{INSTRUMENT_TYPE},$hdr{SERIAL_NUMBER}); |
|
93 |
} else { |
|
94 |
printf("\tINSTRUMENT_TYPE\t\t\t= %s\n",$hdr{INSTRUMENT_TYPE}); |
|
95 |
} |
|
96 |
printf("\tCPU_SERIAL_NUMBER\t\t= %s\n",$hdr{CPU_SERIAL_NUMBER}) |
|
39 | 97 |
if ($opt_l && ($hdr{INSTRUMENT_TYPE} ne 'Explorer')); |
0 | 98 |
printf("\tFIRMWARE\t\t\t= %d.%d\n",$hdr{CPU_FW_VER},$hdr{CPU_FW_REV}); |
39 | 99 |
printf("\tBEAM_FREQUENCY\t\t\t= %.1f kHz\n",$hdr{BEAM_FREQUENCY}); |
100 |
printf("\tBEAM_ANGLE\t\t\t= %d deg\n",$hdr{BEAM_ANGLE}) if $opt_l; |
|
101 |
printf("\tN_BEAMS\t\t\t\t= %d\n",$hdr{N_BEAMS}) if $opt_l; |
|
102 |
printf("\tTRANSMIT_LAG_DISTANCE\t\t= %g m\n",$hdr{TRANSMIT_LAG_DISTANCE}) if $opt_l; |
|
103 |
printf("\tLAG_LENGTH\t\t\t= %d\n",$hdr{LAG_LENGTH}) if $opt_l; |
|
104 |
printf("\tN_DEMODS\t\t\t= %d\n",$hdr{N_DEMODS}) if $opt_l && defined($hdr{N_DEMODS}); |
|
105 |
printf("\tSPEED_OF_SOUND\t\t\t= %d m/s [%s]\n", |
|
106 |
$hdr{SPEED_OF_SOUND}, |
|
107 |
$dta->{SPEED_OF_SOUND_CALCULATED} ? 'from sensors' : 'from settings'); |
|
108 |
printf("\tAMBIGUITY_VELOCITY\t\t= %g m/s\n", |
|
109 |
ambiguity_velocity($hdr{BEAM_FREQUENCY},$hdr{BEAM_ANGLE},$hdr{SPEED_OF_SOUND},$hdr{TRANSMIT_LAG_DISTANCE})); |
|
0 | 110 |
|
111 |
printf("\tSensors\t\t\t\t: "); |
|
112 |
printf("PRESSURE ") if ($hdr{PRESSURE_SENSOR_AVAILABLE}); |
|
113 |
printf("CONDUCTIVITY ") if ($hdr{CONDUCTIVITY_SENSOR_AVAILABLE}); |
|
114 |
printf("TEMPERATURE ") if ($hdr{TEMPERATURE_SENSOR_AVAILABLE}); |
|
115 |
printf("COMPASS ") if ($hdr{COMPASS_AVAILABLE}); |
|
116 |
printf("PITCH ") if ($hdr{PITCH_SENSOR_AVAILABLE}); |
|
117 |
printf("ROLL ") if ($hdr{ROLL_SENSOR_AVAILABLE}); |
|
118 |
print("\n"); |
|
119 |
||
39 | 120 |
if ($opt_l) { |
121 |
printf("\tFlags\t\t\t\t: "); |
|
122 |
printf("XDUCER_HEAD_ATTACHED ") if ($hdr{XDUCER_HEAD_ATTACHED}); |
|
123 |
printf("CONVEX_BEAM_PATTERN ") if ($hdr{CONVEX_BEAM_PATTERN}); |
|
124 |
printf("CONCAVE_BEAM_PATTERN ") if ($hdr{CONCAVE_BEAM_PATTERN}); |
|
125 |
print("\n"); |
|
126 |
} |
|
0 | 127 |
|
39 | 128 |
if ($opt_l) { |
129 |
print(" File Format:\n"); |
|
130 |
printf("\tNUMBER_OF_DATA_TYPES\t\t= %d\n",$hdr{NUMBER_OF_DATA_TYPES}); |
|
131 |
printf("\tFIXED_LEADER_BYTES\t\t= %3d bytes\n",$hdr{FIXED_LEADER_BYTES}); |
|
132 |
printf("\tENSEMBLE_BYTES\t\t\t= %3d bytes\n",$hdr{ENSEMBLE_BYTES}); |
|
133 |
printf("\tHEADER_BYTES\t\t\t= %3d bytes\n",$hdr{HEADER_BYTES}); |
|
134 |
printf("\tVARIABLE_LEADER_BYTES\t\t= %3d bytes\n",$hdr{VARIABLE_LEADER_BYTES}); |
|
135 |
printf("\tVELOCITY_DATA_BYTES\t\t= %3d bytes\n",$hdr{VELOCITY_DATA_BYTES}) |
|
136 |
if defined($hdr{VELOCITY_DATA_BYTES}); |
|
137 |
printf("\tCORRELATION_DATA_BYTES\t\t= %3d bytes\n",$hdr{CORRELATION_DATA_BYTES}) |
|
138 |
if defined($hdr{CORRELATION_DATA_BYTES}); |
|
139 |
printf("\tECHO_INTENSITY_DATA_BYTES\t= %3d bytes\n",$hdr{ECHO_INTENSITY_DATA_BYTES}) |
|
140 |
if defined($hdr{ECHO_INTENSITY_DATA_BYTES}); |
|
141 |
printf("\tPERCENT_GOOD_DATA_BYTES\t\t= %3d bytes\n",$hdr{PERCENT_GOOD_DATA_BYTES}) |
|
142 |
if defined($hdr{PERCENT_GOOD_DATA_BYTES}); |
|
143 |
printf("\tBT_DATA_BYTES\t\t\t= %3d bytes\n",$hdr{BT_DATA_BYTES}) |
|
144 |
if ($hdr{BT_PRESENT}); |
|
145 |
} |
|
0 | 146 |
|
147 |
print(" Coordinate System:\n"); |
|
148 |
||
149 |
printf("\tHEADING_ALIGNMENT_CORRECTION\t\t= %g deg\n", |
|
150 |
$hdr{HEADING_ALIGNMENT_CORRECTION}) |
|
151 |
if defined($hdr{HEADING_ALIGNMENT_CORRECTION}); |
|
152 |
printf("\tHEADING_BIAS_CORRECTION\t\t= %g deg\n", |
|
153 |
$hdr{HEADING_BIAS_CORRECTION}) |
|
154 |
if defined($hdr{HEADING_BIAS_CORRECTION}); |
|
155 |
print("\tFlags\t\t\t\t: "); |
|
156 |
printf("BEAM_COORDINATES ") if ($hdr{BEAM_COORDINATES}); |
|
157 |
printf("INSTRUMENT_COORDINATES ") if ($hdr{INSTRUMENT_COORDINATES}); |
|
158 |
printf("SHIP_COORDINATES ") if ($hdr{SHIP_COORDINATES}); |
|
159 |
printf("EARTH_COORDINATES ") if ($hdr{EARTH_COORDINATES}); |
|
160 |
printf("PITCH_AND_ROLL_USED ") if ($hdr{PITCH_AND_ROLL_USED}); |
|
161 |
printf("BIN_MAPPING_ALLOWED ") if ($hdr{ALLOW_BIN_MAPPING}); |
|
18 | 162 |
printf("USE_3_BEAM_ON_LOW_CORR ") if ($hdr{USE_3_BEAM_ON_LOW_CORR}); |
0 | 163 |
print("\n"); |
164 |
||
165 |
||
166 |
if ($hdr{SPEED_OF_SOUND_CALCULATED}) { |
|
167 |
print(" Speed-of-Sound Sensors Used:\n"); |
|
168 |
printf("\tPRESSURE_SENSOR_USED\n") if ($hdr{PRESSURE_SENSOR_USED}); |
|
169 |
printf("\tCOMPASS_USED\n") if ($hdr{COMPASS_USED}); |
|
170 |
printf("\tPITCH_SENSOR_USED\n") if ($hdr{PITCH_SENSOR_USED}); |
|
171 |
printf("\tROLL_SENSOR_USED\n") if ($hdr{ROLL_SENSOR_USED}); |
|
172 |
printf("\tCONDUCTIVITY_SENSOR_USED\n") |
|
173 |
if ($hdr{CONDUCTIVITY_SENSOR_USED}); |
|
174 |
printf("\tTEMPERATURE_SENSOR_USED\n") |
|
175 |
if ($hdr{TEMPERATURE_SENSOR_USED}); |
|
176 |
print("\n"); |
|
177 |
} |
|
178 |
||
179 |
||
180 |
print(" Bin Setup:\n"); |
|
181 |
printf("\tN_BINS\t\t\t\t= %d\n", $hdr{N_BINS}); |
|
182 |
printf("\tBLANKING_DISTANCE\t\t= %g m\n", $hdr{BLANKING_DISTANCE}); |
|
183 |
printf("\tDISTANCE_TO_BIN1_CENTER\t\t= %g m\n", |
|
184 |
$hdr{DISTANCE_TO_BIN1_CENTER}); |
|
185 |
printf("\tBIN_LENGTH\t\t\t= %g m\n", $hdr{BIN_LENGTH}); |
|
186 |
printf("\tTRANSMITTED_PULSE_LENGTH\t= %g m\n", |
|
187 |
$hdr{TRANSMITTED_PULSE_LENGTH}); |
|
39 | 188 |
printf("\tRL_FIRST_BIN\t\t\t= %d\n", $hdr{RL_FIRST_BIN}) if $opt_l; |
189 |
printf("\tRL_LAST_BIN\t\t\t= %d\n", $hdr{RL_LAST_BIN}) if $opt_l; |
|
0 | 190 |
|
191 |
||
192 |
print(" Water-Track Setup:\n"); |
|
193 |
printf("\tPINGS_PER_ENSEMBLE\t\t= %d\n", $hdr{PINGS_PER_ENSEMBLE}); |
|
194 |
printf("\tTIME_BETWEEN_PINGS\t\t= %g s\n",$hdr{TIME_BETWEEN_PINGS}); |
|
195 |
printf("\tTRANSMIT_POWER\t\t\t= %d\n", $hdr{TRANSMIT_POWER}); |
|
196 |
printf("\tMIN_CORRELATION\t\t\t= %d\n", $hdr{MIN_CORRELATION}); |
|
197 |
printf("\tMIN_PERCENT_GOOD\t\t= %d %%\n", $hdr{MIN_PERCENT_GOOD}); |
|
198 |
printf("\tMAX_ERROR_VELOCITY\t\t= %g m/s\n", |
|
199 |
$hdr{MAX_ERROR_VELOCITY}); |
|
200 |
printf("\tFALSE_TARGET_THRESHOLD\t\t= %d\n", |
|
201 |
$hdr{FALSE_TARGET_THRESHOLD}) |
|
202 |
if defined($hdr{FALSE_TARGET_THRESHOLD}); |
|
203 |
printf("\tFlags\t\t\t\t: "); |
|
204 |
printf("NARROW_BANDWIDTH ") if ($hdr{NARROW_BANDWIDTH}); |
|
205 |
printf("WIDE_BANDWIDTH ") if ($hdr{WIDE_BANDWIDTH}); |
|
206 |
printf("TRANSMIT_POWER_HIGH ") if ($hdr{TRANSMIT_POWER_HIGH}); |
|
207 |
print("\n"); |
|
208 |
||
209 |
#---------------------------------------------------------------------- |
|
210 |
||
21 | 211 |
if ($hdr{BT_PRESENT}) { |
0 | 212 |
print(" Bottom-Track Setup:\n"); |
213 |
printf("\tBT_MODE\t\t\t\t= %d\n", $hdr{BT_MODE}); |
|
214 |
printf("\tBT_PINGS_PER_ENSEMBLE\t\t= %d\n", |
|
215 |
$hdr{BT_PINGS_PER_ENSEMBLE}); |
|
216 |
printf("\tBT_TIME_BEFORE_REACQUIRE\t= %g s\n", |
|
217 |
$hdr{BT_TIME_BEFORE_REACQUIRE}); |
|
218 |
printf("\tBT_MIN_CORRELATION\t\t= %d\n",$hdr{BT_MIN_CORRELATION}); |
|
219 |
printf("\tBT_MIN_EVAL_AMPLITUDE\t\t= %d\n", |
|
220 |
$hdr{BT_MIN_EVAL_AMPLITUDE}); |
|
221 |
printf("\tBT_MIN_PERCENT_GOOD\t\t= %d %%\n", |
|
222 |
$hdr{BT_MIN_PERCENT_GOOD}); |
|
223 |
printf("\tBT_MAX_ERROR_VELOCITY\t\t= %g m/s\n", |
|
224 |
$hdr{BT_MAX_ERROR_VELOCITY}) |
|
225 |
if defined($hdr{BT_MAX_ERROR_VELOCITY}); |
|
226 |
printf("\tBT_RL_MIN_SIZE\t\t\t= %g m\n", $hdr{BT_RL_MIN_SIZE}); |
|
227 |
printf("\tBT_RL_NEAR\t\t\t= %g m\n", $hdr{BT_RL_NEAR}); |
|
228 |
printf("\tBT_RL_FAR\t\t\t= %g m\n", $hdr{BT_RL_FAR}); |
|
229 |
printf("\tBT_MAX_TRACKING_DEPTH\t\t= %g m\n" |
|
230 |
, $hdr{BT_MAX_TRACKING_DEPTH}); |
|
231 |
} |
|
232 |
} |
|
233 |
||
234 |