equal
deleted
inserted
replaced
1 #!/usr/bin/perl |
1 #!/usr/bin/perl |
2 #====================================================================== |
2 #====================================================================== |
3 # E D I T P D 0 |
3 # E D I T P D 0 |
4 # doc: Mon Nov 25 20:24:31 2013 |
4 # doc: Mon Nov 25 20:24:31 2013 |
5 # dlm: Fri Feb 26 17:24:55 2016 |
5 # dlm: Tue Apr 12 21:45:31 2016 |
6 # (c) 2013 A.M. Thurnherr |
6 # (c) 2013 A.M. Thurnherr |
7 # uE-Info: 26 98 NIL 0 0 72 2 2 4 NIL ofnI |
7 # uE-Info: 235 46 NIL 0 0 72 2 2 4 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # edit RDI PD0 file, e.g. to replace pitch/roll/heading with external values |
10 # edit RDI PD0 file, e.g. to replace pitch/roll/heading with external values |
11 |
11 |
12 # NOTES: |
12 # NOTES: |
26 # basic BT data are swapped as well (not RL and not SIGNAL_STRENGTH) |
26 # basic BT data are swapped as well (not RL and not SIGNAL_STRENGTH) |
27 # |
27 # |
28 # earth2beam() transform beam to earth coordinates |
28 # earth2beam() transform beam to earth coordinates |
29 # does not handle bin-remapping |
29 # does not handle bin-remapping |
30 # input in beam coords required |
30 # input in beam coords required |
|
31 # |
|
32 # instrument2beam() transform instrument to earth coordinates |
|
33 # does not handle bin-remapping |
|
34 # input in instrument coords required |
31 # |
35 # |
32 # ensure_UL() overwrite transducer-orientation flag in data file |
36 # ensure_UL() overwrite transducer-orientation flag in data file |
33 # ensure_DL() |
37 # ensure_DL() |
34 # |
38 # |
35 # - -x notes: |
39 # - -x notes: |
52 # - updated getopts to current perl version |
56 # - updated getopts to current perl version |
53 # - adapted to [ADCP_tools_lib.pl] |
57 # - adapted to [ADCP_tools_lib.pl] |
54 # Feb 15, 2016: - added ensure_UL() ensure_DL() |
58 # Feb 15, 2016: - added ensure_UL() ensure_DL() |
55 # Feb 23, 2016: - added -k |
59 # Feb 23, 2016: - added -k |
56 # Feb 26, 2016: - added basic BT data to swap_beams() |
60 # Feb 26, 2016: - added basic BT data to swap_beams() |
|
61 # - added earth2beam() |
|
62 # Apr 12, 2016: - added instrument2beam() |
57 |
63 |
58 use Getopt::Std; |
64 use Getopt::Std; |
59 |
65 |
60 ($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+}); |
66 ($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+}); |
61 $ADCP_tools_minVersion = 1.4; |
67 $ADCP_tools_minVersion = 1.4; |
177 } |
183 } |
178 |
184 |
179 for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) { |
185 for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) { |
180 @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} = |
186 @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} = |
181 velEarthToBeam(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]}); |
187 velEarthToBeam(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]}); |
|
188 } |
|
189 |
|
190 return 1; |
|
191 } |
|
192 |
|
193 } |
|
194 |
|
195 # |
|
196 # transform instrument to beam coordinates |
|
197 # |
|
198 { my($checked); |
|
199 |
|
200 sub instrument2beam() |
|
201 { |
|
202 unless ($checked) { |
|
203 die("$ARGV[0]: instrument-coordinate data required\n") |
|
204 unless ($dta{INSTRUMENT_COORDINATES}); |
|
205 $dta{BEAM_COORDINATES} = 1; undef($dta{INSTRUMENT_COORDINATES}); |
|
206 $checked = 1; |
|
207 } |
|
208 |
|
209 for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) { |
|
210 @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} = |
|
211 velInstrumentToBeam(\%dta,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]}); |
|
212 } |
|
213 |
|
214 return 1; |
|
215 } |
|
216 |
|
217 } |
|
218 |
|
219 # |
|
220 # transform instrument to earth coordinates |
|
221 # |
|
222 { my($checked); |
|
223 |
|
224 sub instrument2earth() |
|
225 { |
|
226 unless ($checked) { |
|
227 die("$ARGV[0]: instrument-coordinate data required\n") |
|
228 unless ($dta{INSTRUMENT_COORDINATES}); |
|
229 $dta{BEAM_COORDINATES} = 1; undef($dta{INSTRUMENT_COORDINATES}); |
|
230 $checked = 1; |
|
231 } |
|
232 |
|
233 for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) { |
|
234 @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} = |
|
235 velInstrumentToEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]}); |
182 } |
236 } |
183 |
237 |
184 return 1; |
238 return 1; |
185 } |
239 } |
186 |
240 |