1 #!/usr/bin/perl |
1 #!/usr/bin/perl |
2 #====================================================================== |
2 #====================================================================== |
3 # P A T C H P D 0 |
3 # P A T C H P D 0 |
4 # doc: Tue Aug 23 20:00:15 2016 |
4 # doc: Tue Aug 23 20:00:15 2016 |
5 # dlm: Tue Apr 14 21:28:49 2020 |
5 # dlm: Mon Jul 12 20:43:08 2021 |
6 # (c) 2010 A.M. Thurnherr |
6 # (c) 2010 A.M. Thurnherr |
7 # uE-Info: 103 26 NIL 0 0 72 2 2 4 NIL ofnI |
7 # uE-Info: 24 37 NIL 0 0 72 2 2 4 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 $antsSummary = 'patch TRDI PD0 file with external attitude data'; |
10 $antsSummary = 'patch TRDI PD0 file with external attitude data'; |
11 |
11 |
12 # History: |
12 # HISTORY: |
13 # Aug 23, 2016: - exported from IMP+LADCP |
13 # Aug 23, 2016: - exported from IMP+LADCP |
14 # Aug 25, 2016: - completed basic structure |
14 # Aug 25, 2016: - completed basic structure |
15 # Nov 20, 2017: - major code cleanup |
15 # Nov 20, 2017: - major code cleanup |
16 # - added -d) to keep original data source id |
16 # - added -d) to keep original data source id |
17 # Dec 9, 2017: - added $antsSuppressCommonOptions = 1; |
17 # Dec 9, 2017: - added $antsSuppressCommonOptions = 1; |
19 # - BUG: not backward compatible with old IMP files any more |
19 # - BUG: not backward compatible with old IMP files any more |
20 # Jun 13, 2017: - added pitch and roll to -o |
20 # Jun 13, 2017: - added pitch and roll to -o |
21 # - BUG: ??? does -o handle pitch and roll ANOMALIES correctly? |
21 # - BUG: ??? does -o handle pitch and roll ANOMALIES correctly? |
22 # Jun 30, 2019: - -o did not work with single argument |
22 # Jun 30, 2019: - -o did not work with single argument |
23 # Apr 14, 2020: - adapted to use for moored ADCP data as well |
23 # Apr 14, 2020: - adapted to use for moored ADCP data as well |
|
24 # Jul 12, 2021: - beautified output |
24 |
25 |
25 # PATCH-FILE REQUIREMENTS (ANTS format) |
26 # PATCH-FILE REQUIREMENTS (ANTS format) |
26 # - %[L]ADCP_pitch.mu %[L]ADCP_roll.mu mean ADCP pitch and roll |
27 # - %[L]ADCP_pitch.mu %[L]ADCP_roll.mu mean ADCP pitch and roll |
27 # - %IM[UP]_hdg_offset heading offset of external IMU |
28 # - %IM[UP]_hdg_offset heading offset of external IMU |
28 # - [L]ADCP_ens ADCP ensemble number |
29 # - [L]ADCP_ens ADCP ensemble number |
199 $ADCP{ENSEMBLE}[1]->{DATA_SOURCE_ID} = 0xA0 |
200 $ADCP{ENSEMBLE}[1]->{DATA_SOURCE_ID} = 0xA0 |
200 unless ($ADCP{ENSEMBLE}[1]->{DATA_SOURCE_ID}&0xF0 == 0xA0); |
201 unless ($ADCP{ENSEMBLE}[1]->{DATA_SOURCE_ID}&0xF0 == 0xA0); |
201 |
202 |
202 writeData($outPD0,\%ADCP); # write new PD0 |
203 writeData($outPD0,\%ADCP); # write new PD0 |
203 |
204 |
204 my($verb) = $opt_k ? 'retained' : 'cleared'; |
205 if ($pr_missing+$hdg_missing) { |
205 printf(STDERR "$outPD0: %d pitch/roll & %d heading values $verb\n",$pr_missing,$hdg_missing) |
206 my($verb) = $opt_k ? 'retained' : 'cleared'; |
206 if ($pr_missing+$hdg_missing); |
207 printf(STDERR "$outPD0: "); |
|
208 if ($pr_missing) { |
|
209 printf(STDERR "%d pitch/roll ",$pr_missing); |
|
210 printf(STDERR "and ") if ($hdg_missing); |
|
211 } |
|
212 printf(STDERR "%d heading ",$hdg_missing) if ($hdg_missing); |
|
213 printf(STDERR "values $verb\n"); |
|
214 } |
207 |
215 |
208 exit(0); |
216 exit(0); |
209 |
217 |