author | A.M. Thurnherr <athurnherr@yahoo.com> |
Tue, 20 May 2014 09:08:19 -0400 | |
changeset 27 | ec8873454890 |
parent 26 | d778b73f2a43 |
child 28 | 79bf60e97208 |
permissions | -rwxr-xr-x |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
2 |
#====================================================================== |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
3 |
# L A D C P P R O C |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
4 |
# doc: Thu Sep 16 20:36:10 2010 |
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
5 |
# dlm: Tue May 20 09:01:32 2014 |
8 | 6 |
# (c) 2010 A.M. Thurnherr |
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
7 |
# uE-Info: 96 0 NIL 0 0 72 10 2 4 NIL ofnI |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
8 |
#====================================================================== |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
9 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
10 |
# NOTES: |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
11 |
# - the shear-method editing in this code is based on Eric Firing's merge.c |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
12 |
# - as described in [LADCPproc.backscatter], there are three different codes |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
13 |
# for correcting echo amplitudes for attenuation loss & beam spreading |
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
14 |
# - comments starting with ## are taken verbatim from the original |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
15 |
# implementations |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
16 |
# - the basic idea of the time lagging implemented in this code is similar |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
17 |
# to the one implemented in Martin Visbeck's bestlag.m |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
18 |
# - for SeaBird files: |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
19 |
# - CTD elapsed time is estimated from recno * CTD{sampint} |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
20 |
# - first elapsed time is added on output |
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
21 |
# - output time: |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
22 |
# - is from CTD to allow yoyo processing without loss of time information |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
23 |
# - to obtain LADCP time, add %LADCP_time_lag to CTD time |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
24 |
# - %LADCP_time_lag can be used for -l |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
25 |
# - -i is different: it should be set to the number that is added to |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
26 |
# LADCP_elapsed to get the CTD time, i.e. |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
27 |
# -%LADCP_time_lag |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
28 |
# - CTD{elapsed} is undefined for records before instrument is in the water |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
29 |
# - ITS-90 temp field in degC required |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
30 |
# - salin field prequired |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
31 |
# - pressure field in dbar required |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
32 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
33 |
# HISTORY: |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
34 |
# Sep 16, 2010: - incepted |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
35 |
# Oct 13, 2010: - first working version |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
36 |
# Oct 14, 2010: - renamed from LADCPshear |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
37 |
# Oct 19, 2010: - added -a)coustic backscatter profiles |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
38 |
# Oct 20, 2010: - added -2)dary CTD sensors |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
39 |
# Oct 23, 2010: - added magnetic-declination correction |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
40 |
# Oct 26, 2010: - added tilt calculation |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
41 |
# Dec 9, 2010: - added support for ASCII CTD files |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
42 |
# Dec 10, 2010: - change -w) default to 120s |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
43 |
# - changed nshear output to 0 from nan when there are no samples |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
44 |
# Dec 27, 2010: - changed sign of -l to accept lag output from [LADCP_w] |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
45 |
# Jan 10, 2011: - -o => -k added new -o |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
46 |
# - added code to fill CTD sound vel gaps |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
47 |
# Jan 22, 2011: - added -g) lat,lon |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
48 |
# - added -c)ompass corr |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
49 |
# Jun 15, 2011: - added mean backscatter profile to default output |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
50 |
# Jul 7, 2011: - added support for $BT_* processing parameters |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
51 |
# - replaced old per-bin acoustic backscatter profile output by |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
52 |
# acoustic backscatter depth-time-series |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
53 |
# - disabled seabed and acoustic backscatter code when not required (e.g. UL) |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
54 |
# - made non-diagnostic output terser |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
55 |
# Jul 11, 2011: - changed default output to .tds and added -p)rofile option |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
56 |
# Jul 14, 2011: - added -u)se D[eines1999][V[isbeck2004]] |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
57 |
# Jul 15, 2011: - changed output bin# to 1-based in -a output |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
58 |
# - added T[hurnherr11] -u)se option |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
59 |
# - added $CTD{first_elapsed} |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
60 |
# Jul 27, 2011: - replaced ndata by nsamp |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
61 |
# Feb 5, 2012: - added profile max depth consistency check |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
62 |
# Feb 19, 2912: - added elapsed time to shear profile output |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
63 |
# - replaced "nshear" output field by "nsamp" |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
64 |
# - BUG: bottom of profiles was incorrect when dc max depth > uc max depth |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
65 |
# - BUG: profile depth consistency check did not work for partial-depth yoyo casts |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
66 |
# Apr 10, 2012: - changed default backscatter correction to Deines (1999) |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
67 |
# - improved and relaxed depth consistency check |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
68 |
# Apr 11, 2012: - BUG: double comma that did not affect the output |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
69 |
# - BUG: code had assumed, but not ensured, that first CTD scan is valid |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
70 |
# Apr 13, 2012: - removed -s argument from dependencies |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
71 |
# Apr 17, 2012: - BAD BUG: magdec code call was bad and did not return correct value. ever. |
10 | 72 |
# Apr 18, 2012: - replaced Sv.n by Sv.nsamp |
11 | 73 |
# May 16, 2012: - adapted to ANTSlib V5.0 |
12 | 74 |
# - added support for -r)DI BT data |
13 | 75 |
# - added $LADCP{MEAN_DT} from vertical-velocity code |
76 |
# May 17, 2012: - significantly relaxed profile-range consistency check (from 20% to 50%) |
|
77 |
# which is required for Dan Torres' shallow casts |
|
78 |
# - added version info |
|
16 | 79 |
# May 18, 2012: - reduced "implausibly short cast" threshold to 5 min because of Dan's shallow casts |
80 |
# Jun 13, 2012: - added CTD_depth to tds output |
|
18 | 81 |
# Oct 28, 2012: - added -z |
19 | 82 |
# Mar 16, 2013: - BUG: usage message had a -p)PI flag |
20 | 83 |
# Jun 5, 2013: - added $bad_beam support |
84 |
# Jun 25, 2013: - added %PARAMS used for spectral correction |
|
85 |
# - adapted to new ::-PARAM convention |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
86 |
# Sep 25, 2013: - BUG: %PARAM magnetic_declination did not have LADCPproc:: prefix |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
87 |
# - added CTD lat/lon info to most output files (but not BT) |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
88 |
# - BUG: moved %water_depth to common %PARAMs |
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
89 |
# Feb 22, 2014: - modified diagnostics output |
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
90 |
# Mar 19, 2014: - moved code to set LADCP_time_lag %PARAM into main prog so it is |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
91 |
# set, even when -l is used |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
92 |
# - added pitch, roll, hdg to -t output |
26
d778b73f2a43
before beginning to use instrument tilt in distance calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
93 |
# Mar 20, 2014: - BUG: wrong number of samples were recorded when upcast had no |
d778b73f2a43
before beginning to use instrument tilt in distance calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
94 |
# valid data whatsoever |
d778b73f2a43
before beginning to use instrument tilt in distance calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
95 |
# - added support for $LADCP_max_gap |
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
96 |
# May 20, 2014: - merged laptop with whoosher versions (folded in Feb 22 change) |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
97 |
|
11 | 98 |
($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$}); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
99 |
($PERL_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
100 |
($LADCPPROC) = ($0 =~ m{^(.*)/[^/]*$}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
101 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
102 |
require "$ANTS/ants.pl"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
103 |
require "$ANTS/libEOS83.pl"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
104 |
require "$ANTS/libstats.pl"; |
13 | 105 |
require "$LADCPPROC/LADCPproc.version"; |
1 | 106 |
require "$LADCPPROC/LADCPproc.loadCTD"; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
107 |
require "$LADCPPROC/LADCPproc.bestLag"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
108 |
require "$LADCPPROC/LADCPproc.BT"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
109 |
require "$LADCPPROC/LADCPproc.backscatter"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
110 |
require "$LADCPPROC/LADCPproc.UHcode"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
111 |
require "$PERL_TOOLS/RDI_BB_Read.pl"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
112 |
require "$PERL_TOOLS/RDI_Coords.pl"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
113 |
require "$PERL_TOOLS/RDI_Utils.pl"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
114 |
|
19 | 115 |
$ANTSLIBS = $LADCPPROC; # for -L libraries |
116 |
||
13 | 117 |
$antsSummary = "$version -- process LADCP data to get shear, time series"; |
118 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
119 |
$antsParseHeader = 0; |
18 | 120 |
&antsUsage('24a:b:c:df:g:i:kl:n:o:p:rs:t:u:w:z',2, |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
121 |
'[use -2)dary CTD sensor pair]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
122 |
'[require -4)-beam LADCP solutions]', |
12 | 123 |
'[use -r)DI bottom-track data]', |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
124 |
'[-s)etup <file>] [-g)ps <lat,lon>]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
125 |
'[-c)ompass-corr <offset,cos-fac,sin-fac>]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
126 |
'[-o)utput grid <resolution[5m]>]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
127 |
'[-i)nitial LADCP time lag <guestimate>]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
128 |
'[-l)ag LADCP <by>] [auto-lag -w)indow <size[120s]>] [-n) <auto-lag windows[20]]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
129 |
'[correct echo amplitude -u)sing D[eines99]|V[isbeck04]|T[hurnherr11]|n[ocorr]', |
18 | 130 |
'[-d)iagnostic screen output] [-z)oom through problems]', |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
131 |
'output: [shear-p)rofile <file>] [-t)ime series <file>] [-f)lag <file>] [-b)ottom-track <file>]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
132 |
' [-a)coustic backscatter <dts-file] [bottom-trac-k) profs]', |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
133 |
'<RDI file> <SeaBird file>'); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
134 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
135 |
$RDI_Coords::minValidVels = 4 if ($opt_4); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
136 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
137 |
&antsFloatOpt($opt_l); |
1 | 138 |
&antsCardOpt(\$opt_w,120); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
139 |
# old default of -w 30 does not work if there are significant ambiguity-velocity |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
140 |
# problems, as is the case, e.g., with 2010_DIMES_US2 station 142 |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
141 |
# old default of -w 60 did not work for DIMES_UK2 station 4 (DL), possibly again |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
142 |
# related to ambiguity velocity |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
143 |
&antsCardOpt(\$opt_n,20); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
144 |
#&antsFileOpt($opt_s); # DON'T, AS THIS WILL ADD AN UNWANTED DEPENDCY |
1 | 145 |
&antsFloatOpt($opt_i); |
4 | 146 |
&antsCardOpt(\$opt_o,5); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
147 |
|
6 | 148 |
if (defined($opt_u)) { |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
149 |
croak("$0: cannot decode -u $opt_u\n") |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
150 |
unless ($opt_u =~ /^[dDvVtTn]/); |
6 | 151 |
} else { |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
152 |
$opt_u = 'Deines99'; |
6 | 153 |
} |
154 |
||
2 | 155 |
if (defined($opt_g)) { |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
156 |
($CTD{stn_lat},$CTD{stn_lon}) = split(',',$opt_g); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
157 |
croak("$0: cannot decode -g $opt_g\n") |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
158 |
unless numberp($CTD{stn_lat}) && numberp($CTD{stn_lon}); |
2 | 159 |
} |
160 |
||
161 |
if (defined($opt_c)) { |
|
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
162 |
($CC_offset,$CC_cos_fac,$CC_sin_fac) = split(',',$opt_c); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
163 |
croak("$0: cannot decode -c $opt_c\n") |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
164 |
unless numberp($CC_offset) && numberp($CC_cos_fac) && numberp($CC_sin_fac); |
2 | 165 |
} |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
166 |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
167 |
$LADCP_file = &antsFileArg(); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
168 |
$CTD_file = &antsFileArg(); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
169 |
|
20 | 170 |
&antsAddParams('LADCPproc::LADCP_file',$LADCP_file,'LADCPproc::CTD_file',$CTD_file); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
171 |
&antsActivateOut(); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
172 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
173 |
#---------------------------------------------------------------------- |
1 | 174 |
# Step 1: Read LADCP Data |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
175 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
176 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
177 |
print(STDERR "Reading LADCP data ($LADCP_file)..."); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
178 |
readData($LADCP_file,\%LADCP); |
3 | 179 |
printf(STDERR "\n\t%d ensembles",scalar(@{$LADCP{ENSEMBLE}})) if ($opt_d); |
180 |
print(STDERR "\n"); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
181 |
|
20 | 182 |
&antsAddParams('LADCPproc::bin_length',$LADCP{BIN_LENGTH}); |
183 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
184 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
185 |
# Step 2: Set Processing Parameters |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
186 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
187 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
188 |
print(STDERR "Setting processing parameters...\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
189 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
190 |
printf(STDERR "\tloading $LADCPPROC/LADCPproc.defaults...\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
191 |
require "$LADCPPROC/LADCPproc.defaults"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
192 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
193 |
if (defined($opt_s)) { |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
194 |
print(STDERR "\tloading $opt_s...\n"); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
195 |
require $opt_s; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
196 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
197 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
198 |
if ($LADCP{BLANKING_DISTANCE} == 0) { |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
199 |
print(STDERR "\t\tBLANKING_DISTANCE == 0 => excluding all data from bin 1\n") |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
200 |
if ($opt_d); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
201 |
$wbin_start = 2 unless ($wbin_start > 2); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
202 |
$ubin_start = 2 unless ($ubin_start > 2); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
203 |
$shbin_start = 2 unless ($shbin_start > 2); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
204 |
$BT_bin_start = 2 unless ($BT_bin_start > 2); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
205 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
206 |
|
20 | 207 |
&antsAddParams('LADCPproc::instrument_orientation', |
208 |
$LADCP{ENSEMBLE}[0]->{XDUCER_FACING_UP} ? 'UL' : 'DL'); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
209 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
210 |
$SHEAR_PREGRID_DZ = 20; |
4 | 211 |
$GRID_DZ = $opt_o; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
212 |
|
20 | 213 |
&antsAddParams('LADCPproc::vertical_resolution',$GRID_DZ); |
214 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
215 |
#---------------------------------------------------------------------- |
1 | 216 |
# Step 3: Read CTD data |
217 |
#---------------------------------------------------------------------- |
|
218 |
||
219 |
print(STDERR "Reading CTD data ($CTD_file)..."); |
|
220 |
readCTD($CTD_file,\%CTD); |
|
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
221 |
printf(STDERR "\n\t%d scans (%.1fs sample interval)",scalar(@{$CTD{press}}),$CTD{sampint}) if ($opt_d); |
3 | 222 |
print(STDERR "\n"); |
1 | 223 |
|
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
224 |
my($year) = substr($LADCP{ENSEMBLE}[0]->{DATE},6,4); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
225 |
my($month) = substr($LADCP{ENSEMBLE}[0]->{DATE},0,2); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
226 |
my($day ) = substr($LADCP{ENSEMBLE}[0]->{DATE},3,2); |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
227 |
my($magdec,$maginc,$h_strength,$v_strength) = split('\s+',`magdec $CTD{stn_lon} $CTD{stn_lat} $year $month $day`); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
228 |
|
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
229 |
croak("$0: unknown magnetic declination\n") |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
230 |
unless defined($magdec); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
231 |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
232 |
&antsAddParams('LADCPproc::magnetic_declination',$magdec); |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
233 |
|
1 | 234 |
#---------------------------------------------------------------------- |
235 |
# Step 4: Pre-Process CTD & LADCP Data |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
236 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
237 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
238 |
printf(STDERR "Pre-processing data..."); |
3 | 239 |
printf(STDERR "\n\tCTD...") if ($opt_d); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
240 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
241 |
#------------------------ |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
242 |
# clean CTD pressure data |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
243 |
#------------------------ |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
244 |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
245 |
my($pSpikes) = 0; |
1 | 246 |
for (my($r)=1; $r<@{$CTD{press}}; $r++) { |
247 |
$pSpikes++,$CTD{press}[$r]=nan |
|
248 |
if (abs($CTD{press}[$r]-$CTD{press}[$r-1])/$CTD{sampint} > 2); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
249 |
} |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
250 |
print(STDERR "\n\t\t$pSpikes CTD pressure spikes removed") |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
251 |
if ($pSpikes>0 && $opt_d); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
252 |
|
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
253 |
#----------------------------------- |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
254 |
# trim "preamble" without valid data |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
255 |
#----------------------------------- |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
256 |
|
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
257 |
my($r) = 0; |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
258 |
until (numberp($CTD{press}[$r]) && numberp($CTD{temp}[$r]) && numberp($CTD{salin}[$r])) { $r++ } |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
259 |
splice(@{$CTD{press}},0,$r); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
260 |
splice(@{$CTD{temp}},0,$r); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
261 |
splice(@{$CTD{salin}},0,$r); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
262 |
print(STDERR "\n\t\t$r leading CTD scans without valid data removed") |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
263 |
if ($r>0 && $opt_d); |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
264 |
|
7 | 265 |
#-------------------------------------------------- |
266 |
# calculate w and find deepest & shallowest records |
|
267 |
#-------------------------------------------------- |
|
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
268 |
|
1 | 269 |
$CTD{maxpress} = -9e99; |
7 | 270 |
$CTD{minpress} = 9e99; |
1 | 271 |
for (my($r)=1; $r<@{$CTD{press}}-1; $r++) { |
272 |
$CTD{w}[$r] = 0.99*($CTD{press}[$r+1] - $CTD{press}[$r-1]) / (2*$CTD{sampint}); |
|
273 |
if ($CTD{press}[$r] > $CTD{maxpress}) { |
|
274 |
$CTD{maxpress} = $CTD{press}[$r]; |
|
275 |
$CTD{atbottom} = $r; |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
276 |
} |
7 | 277 |
if ($CTD{press}[$r] < $CTD{minpress}) { |
278 |
$CTD{minpress} = $CTD{press}[$r]; |
|
279 |
$CTD{attop} = $r; |
|
280 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
281 |
} |
9
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
282 |
printf(STDERR "\n\t\tmin/max pressure [%d/%ddbar] at scans#%d/%d", |
48b2d27aaebf
after fixing bad magdec bug
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
8
diff
changeset
|
283 |
$CTD{minpress},$CTD{maxpress},$CTD{attop},$CTD{atbottom}) |
1 | 284 |
if $opt_d; |
285 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
286 |
#---------------------------------------------------------------------- |
1 | 287 |
# Step 4b: Pre-Process LADCP Data |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
288 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
289 |
|
3 | 290 |
print(STDERR "\n\tLADCP...") if ($opt_d); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
291 |
|
19 | 292 |
#------------------------------------------------- |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
293 |
# transform to earth coordinates if required |
20 | 294 |
# - discard data from a particular beam if requested |
19 | 295 |
# - save beam_vels for later (e.g. wake) editing |
296 |
#------------------------------------------------- |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
297 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
298 |
$U = 0; # velocity indices |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
299 |
$V = 1; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
300 |
$W = 2; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
301 |
$E = 3; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
302 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
303 |
$LADCP{HEADING_BIAS} = -$magdec; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
304 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
305 |
if ($LADCP{BEAM_COORDINATES}) { |
20 | 306 |
if ($opt_d) { |
307 |
print(STDERR "\n\t\ttransforming beam to Earth coordinates..."); |
|
308 |
print(STDERR "\n\t\t\tdiscarding data from beam $bad_beam...") |
|
309 |
if ($bad_beam); |
|
310 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
311 |
for (my($ens)=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
312 |
$LADCP{ENSEMBLE}[$ens]->{TILT} = &angle_from_vertical($LADCP{ENSEMBLE}[$ens]->{PITCH},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
313 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
20 | 314 |
if ($bad_beam) { |
315 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$bad_beam-1]); |
|
316 |
undef($LADCP{ENSEMBLE}[$ens]->{BT_VELOCITY}[$bin][$bad_beam-1]); |
|
317 |
} |
|
19 | 318 |
@{$LADCP{ENSEMBLE}[$ens]->{BEAM_VEL}[$bin]} = @{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]}; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
319 |
@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]} = |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
320 |
velInstrumentToEarth(\%LADCP,$ens,velBeamToInstrument(\%LADCP,@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]})); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
321 |
@{$LADCP{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$bin]} = # fake it to fool ref_lr_w |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
322 |
(0,0,0,defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$W]) ? 100 : 0); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
323 |
} |
12 | 324 |
@{$LADCP{ENSEMBLE}[$ens]->{BT_VELOCITY}} = |
325 |
velInstrumentToEarth(\%LADCP,$ens,velBeamToInstrument(\%LADCP,@{$LADCP{ENSEMBLE}[$ens]->{BT_VELOCITY}})); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
326 |
} |
12 | 327 |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
328 |
$LADCP{BEAM_COORDINATES} = 0; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
329 |
$LADCP{EARTH_COORDINATES} = 1; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
330 |
unless ($opt_4) { |
1 | 331 |
print(STDERR "\n\t\t\t3-beam solutions: $RDI_Coords::threeBeam_1 $RDI_Coords::threeBeam_2 $RDI_Coords::threeBeam_3 $RDI_Coords::threeBeam_4\n") |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
332 |
if ($opt_d); |
20 | 333 |
&antsAddParams('LADCPproc::3_beam_solutions',"$RDI_Coords::threeBeam_1 $RDI_Coords::threeBeam_2 $RDI_Coords::threeBeam_3 $RDI_Coords::threeBeam_4"); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
334 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
335 |
} elsif ($LADCP{EARTH_COORDINATES}) { |
2 | 336 |
if ($opt_d) { |
337 |
if ($opt_c) { |
|
338 |
printf(STDERR "\n\t\tcalculating tilt and correcting for compass error and magnetic declination of %.1f deg...\n",$magdec); |
|
339 |
} else { |
|
340 |
printf(STDERR "\n\t\tcalculating tilt and correcting for magnetic declination of %.1f deg...\n",$magdec); |
|
341 |
} |
|
342 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
343 |
for (my($ens)=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
344 |
$LADCP{ENSEMBLE}[$ens]->{TILT} = &angle_from_vertical($LADCP{ENSEMBLE}[$ens]->{PITCH},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
2 | 345 |
my($hdg) = rad($LADCP{ENSEMBLE}[$ens]->{HEADING}); |
346 |
$LADCP{HEADING_BIAS} = ($CC_offset + $CC_cos_fac*cos($hdg) + $CC_sin_fac*sin($hdg)) - $magdec |
|
347 |
if ($opt_c); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
348 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
349 |
@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]} = |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
350 |
velApplyHdgBias(\%LADCP,$ens,@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
351 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
352 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
353 |
} else { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
354 |
croak("$0: can only handle beam or earth coordinates\n") |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
355 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
356 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
357 |
#------------------------------------------------------ |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
358 |
# construct a depth-vs-time "profile" from the raw data |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
359 |
#------------------------------------------------------ |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
360 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
361 |
print(STDERR "\t\tconstructing profile time series...") |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
362 |
if ($opt_d); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
363 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
364 |
($LADCP_start,$LADCP_end,$LADCP_bottom,$w_gap_time,$zErr,$maxz) = |
27
ec8873454890
1) merge with laptop version; 2) add comments about PPI
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
365 |
mk_prof(\%LADCP,0,undef,1,6,70,0.1,$LADCP_max_gap); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
366 |
croak("\n$LADCP_file: no good ensembles found\n") |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
367 |
unless defined($LADCP_start); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
368 |
|
13 | 369 |
my($cast_duration) = $LADCP{ENSEMBLE}[$LADCP_end]->{UNIX_TIME} - |
370 |
$LADCP{ENSEMBLE}[$LADCP_start]->{UNIX_TIME}; |
|
371 |
croak("$0: implausibly short cast ($cast_duration seconds)\n") |
|
14 | 372 |
unless ($cast_duration > 300); |
13 | 373 |
$LADCP{MEAN_DT} = $cast_duration / ($LADCP_end-$LADCP_start-1); |
374 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
375 |
if ($opt_d) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
376 |
printf(STDERR "\n\t\t\tStart of cast : %s (#%5d) at %6.1fm\n", |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
377 |
$LADCP{ENSEMBLE}[$LADCP_start]->{TIME}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
378 |
$LADCP{ENSEMBLE}[$LADCP_start]->{NUMBER}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
379 |
$LADCP{ENSEMBLE}[$LADCP_start]->{DEPTH}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
380 |
printf(STDERR "\t\t\tBottom of cast : %s (#%5d) at %6.1fm\n", |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
381 |
$LADCP{ENSEMBLE}[$LADCP_bottom]->{TIME}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
382 |
$LADCP{ENSEMBLE}[$LADCP_bottom]->{NUMBER}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
383 |
$LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH}); |
13 | 384 |
printf(STDERR "\t\t\tEnd of cast : %s (#%5d) at %6.1fm\n", |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
385 |
$LADCP{ENSEMBLE}[$LADCP_end]->{TIME}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
386 |
$LADCP{ENSEMBLE}[$LADCP_end]->{NUMBER}, |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
387 |
$LADCP{ENSEMBLE}[$LADCP_end]->{DEPTH}); |
13 | 388 |
printf(STDERR "\t\t\tAvg ping interval: %.1fs",$LADCP{MEAN_DT}); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
389 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
390 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
391 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
392 |
|
8 | 393 |
my($LADCP_prof_range) = $LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH} - |
394 |
min($LADCP{ENSEMBLE}[$LADCP_start]->{DEPTH},$LADCP{ENSEMBLE}[$LADCP_end]->{DEPTH}); |
|
13 | 395 |
my($CTD_prof_range) = $CTD{maxpress} - $CTD{minpress}; |
18 | 396 |
croak(sprintf("$0: LADCP profile depth range (%dm) inconsistent with max CTD pressure range (%ddbar) [-z to disable]\n", |
13 | 397 |
$LADCP_prof_range,$CTD_prof_range)) |
18 | 398 |
if (!$opt_z && abs($LADCP_prof_range-0.99*$CTD_prof_range) > |
399 |
max(0.2*0.99*$CTD_prof_range,abs($LADCP{ENSEMBLE}[$LADCP_end]->{DEPTH}),50)); |
|
6 | 400 |
|
19 | 401 |
#---------------------------------------------------------------- |
402 |
# call edit function |
|
403 |
# - e.g. for wake editing |
|
404 |
# - this is done here, because during step 5 the velocities are |
|
405 |
# sound-speed corrected, i.e. |
|
406 |
#---------------------------------------------------------------- |
|
407 |
||
408 |
&edit_LADCP_vels() |
|
409 |
if (exists(&edit_LADCP_vels)); |
|
410 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
411 |
#---------------------------------------------------------------------- |
1 | 412 |
# Step 5: Add CTD to LADCP Data & correct velocities for sound speed |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
413 |
# - {DEPTH} field is overwritten! |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
414 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
415 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
416 |
print(STDERR "Matching CTD to LADCP time series..."); |
17 | 417 |
print(STDERR "\n") if defined($opt_l); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
418 |
|
1 | 419 |
$opt_l = defined($opt_l) ? -$opt_l : &lagLADCP2CTD(); |
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
420 |
&antsAddParams('LADCPproc::LADCP_time_lag',-$opt_l); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
421 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
422 |
print(STDERR "Associating CTD data with LADCP ensembles..."); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
423 |
|
3 | 424 |
for (my($min_depth)=9e99,my($ens)=$LADCP_start; $ens<=$LADCP_end; $ens++) { |
425 |
my($lastSvel); |
|
1 | 426 |
my($r) = int(($LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME} - $opt_l) / $CTD{sampint}); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
427 |
if ($r < 0 && $ens == $LADCP_start) { |
1 | 428 |
$r = int(($LADCP{ENSEMBLE}[++$ens]->{ELAPSED_TIME} - $opt_l) / $CTD{sampint}) |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
429 |
while ($r < 0); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
430 |
printf(STDERR "\n\tCTD data begin with instrument already in water => skipping %ds of LADCP data", |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
431 |
$LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME}-$LADCP{ENSEMBLE}[$LADCP_start]->{ELAPSED_TIME}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
432 |
$LADCP_start = $ens; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
433 |
} |
1 | 434 |
if ($r > $#{$CTD{press}}) { |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
435 |
printf(STDERR "\n\tCTD data end while instrument is still in water => truncating %ds of LADCP data", |
3 | 436 |
$LADCP{ENSEMBLE}[$LADCP_end]->{ELAPSED_TIME}-$LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME}) |
437 |
if ($opt_d); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
438 |
$LADCP_end = $ens - 1; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
439 |
last; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
440 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
441 |
my($dr); |
1 | 442 |
for ($dr=0; !numberp($CTD{press}[$r+$dr]); $dr--) {} |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
443 |
$LADCP{ENSEMBLE}[$ens]->{DEPTH} = depth($CTD{press}[$r+$dr],$CTD{stn_lat}); |
3 | 444 |
if ($LADCP{ENSEMBLE}[$ens]->{DEPTH} < $min_depth) { |
445 |
$min_depth = $LADCP{ENSEMBLE}[$ens]->{DEPTH}; |
|
446 |
$LADCP_top = $ens; |
|
447 |
} |
|
1 | 448 |
$LADCP{ENSEMBLE}[$ens]->{CTD_W} = $CTD{w}[$r]; |
449 |
$LADCP{ENSEMBLE}[$ens]->{CTD_TEMP} = $CTD{temp}[$r]; |
|
450 |
$LADCP{ENSEMBLE}[$ens]->{CTD_SVEL} = sVel($CTD{salin}[$r],$CTD{temp}[$r],$CTD{press}[$r+$dr]); |
|
451 |
if (numberp($LADCP{ENSEMBLE}[$ens]->{CTD_SVEL})) { |
|
452 |
$lastSvel = $LADCP{ENSEMBLE}[$ens]->{CTD_SVEL}; |
|
453 |
} else { |
|
454 |
$LADCP{ENSEMBLE}[$ens]->{CTD_SVEL} = $lastSvel; |
|
455 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
456 |
my($sscorr) = $LADCP{ENSEMBLE}[$ens]->{CTD_SVEL} / $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
457 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
458 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$W]); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
459 |
$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$U] *= $sscorr; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
460 |
$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$V] *= $sscorr; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
461 |
$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$W] *= $sscorr; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
462 |
} |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
463 |
$LADCP{ENSEMBLE}[$ens]->{CTD_LAT} = $CTD{lat}[$r]; |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
464 |
$LADCP{ENSEMBLE}[$ens]->{CTD_LON} = $CTD{lon}[$r]; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
465 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
466 |
|
20 | 467 |
&antsAddParams('LADCPproc::min_depth',round($LADCP{ENSEMBLE}[$LADCP_top]->{DEPTH}), |
468 |
'LADCPproc::max_depth',round($LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH}), |
|
469 |
'LADCPproc::start_date',$LADCP{ENSEMBLE}[$LADCP_start]->{DATE}, |
|
470 |
'LADCPproc::start_time',$LADCP{ENSEMBLE}[$LADCP_start]->{TIME}, |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
471 |
'LADCPproc::start_lat',$LADCP{ENSEMBLE}[$LADCP_start]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
472 |
'LADCPproc::start_lon',$LADCP{ENSEMBLE}[$LADCP_start]->{CTD_LON}, |
20 | 473 |
'LADCPproc::bottom_date',$LADCP{ENSEMBLE}[$LADCP_bottom]->{DATE}, |
474 |
'LADCPproc::bottom_time',$LADCP{ENSEMBLE}[$LADCP_bottom]->{TIME}, |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
475 |
'LADCPproc::bottom_lat',$LADCP{ENSEMBLE}[$LADCP_bottom]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
476 |
'LADCPproc::bottom_lon',$LADCP{ENSEMBLE}[$LADCP_bottom]->{CTD_LON}, |
20 | 477 |
'LADCPproc::end_date',$LADCP{ENSEMBLE}[$LADCP_end]->{DATE}, |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
478 |
'LADCPproc::end_time',$LADCP{ENSEMBLE}[$LADCP_end]->{TIME}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
479 |
'LADCPproc::end_lat',$LADCP{ENSEMBLE}[$LADCP_end]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
480 |
'LADCPproc::end_lon',$LADCP{ENSEMBLE}[$LADCP_end]->{CTD_LON}); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
481 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
482 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
483 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
484 |
#---------------------------------------------------------------------- |
1 | 485 |
# Step 6: Calculate Acoustic Backscatter Profile |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
486 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
487 |
|
3 | 488 |
print(STDERR "Calculating acoustic backscatter profiles..."); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
489 |
mk_backscatter_profs($LADCP_start,$LADCP_end); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
490 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
491 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
492 |
#---------------------------------------------------------------------- |
1 | 493 |
# Step 7: Find Seabed |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
494 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
495 |
|
3 | 496 |
if ($LADCP{ENSEMBLE}[$LADCP_start]->{XDUCER_FACING_DOWN}) { |
497 |
||
498 |
print(STDERR "Finding seabed..."); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
499 |
|
3 | 500 |
print(STDERR "\n\tin acoustic backscatter profiles...") if ($opt_d); |
501 |
($water_depth,$sig_water_depth) = |
|
502 |
find_backscatter_seabed($LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH}); |
|
12 | 503 |
printf(STDERR "\n\t\twater depth = %d(+-%.1f)m",$water_depth,$sig_water_depth) |
504 |
if ($opt_d); |
|
3 | 505 |
|
506 |
print(STDERR "\n\tin RDI BT data...") if ($opt_d); |
|
507 |
($BT_water_depth,$sig_BT_water_depth) = |
|
508 |
find_seabed(\%LADCP,$LADCP_bottom,$LADCP{BEAM_COORDINATES}); |
|
509 |
if (defined($BT_water_depth)) { |
|
12 | 510 |
printf(STDERR "\n\t\twater depth = %d(+-%.1f)m",$BT_water_depth,$sig_BT_water_depth) |
511 |
if ($opt_d); |
|
512 |
} else { |
|
513 |
printf(STDERR "\n\t\tno seabed found") if ($opt_d); |
|
3 | 514 |
} |
515 |
||
12 | 516 |
if ($opt_r) { # use RDI BT data |
517 |
$water_depth = $BT_water_depth; |
|
518 |
$sig_water_depth = $sig_BT_water_depth; |
|
519 |
} |
|
520 |
$min_hab = $water_depth - $LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH}; |
|
521 |
||
522 |
if (defined($water_depth)) { |
|
523 |
printf(STDERR "\n\twater depth = %d(+-%.1f)m",$water_depth,$sig_water_depth); |
|
524 |
printf(STDERR "\n\tclosest approach = %dmab",$min_hab); |
|
525 |
} else { |
|
3 | 526 |
print(STDERR "\n\tno seabed found\n"); |
527 |
print(STDERR "\n\tunknown water depth => PPI editing disabled\n") |
|
528 |
if ($opt_d); |
|
529 |
$clip_margin = 0; |
|
530 |
} |
|
531 |
||
532 |
print(STDERR "\n"); |
|
533 |
||
534 |
} else { # UPLOOKER |
|
535 |
$water_depth = $sig_water_depth = $min_hab = nan; |
|
536 |
print(STDERR "Uplooker data => PPI editing disabled\n") |
|
537 |
if ($opt_d); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
538 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
539 |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
540 |
&antsAddParams('LADCPproc::water_depth',round($water_depth), |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
541 |
'LADCPproc::water_depth.sig',round($sig_water_depth)); |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
542 |
|
19 | 543 |
#----------------------------------------------------------------------- |
544 |
# Step 8: Edit Data & also produce depth-time-series output via callback |
|
545 |
#----------------------------------------------------------------------- |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
546 |
|
4 | 547 |
print(STDERR "Calculating shear profiles & producing time-depth-series (.tds) output..."); |
548 |
||
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
549 |
@antsNewLayout = ('ens','elapsed','CTD_depth','downcast','CTD_lat','CTD_lon','depth','u_z','v_z','w_z'); |
16 | 550 |
|
4 | 551 |
#-------------------------------------------------------------------------------- |
552 |
# callback routine to output .tds data, called once each for down-/upcasts after |
|
553 |
# shear has been gridded. Note that only the nominal (bin center) depth is known |
|
16 | 554 |
# for each sample at this stage of processing. |
555 |
#------------------------------------------------------------------------------- |
|
4 | 556 |
|
557 |
sub outTDseries($) |
|
558 |
{ |
|
16 | 559 |
my($downcast) = @_; # also use local [uvw]sh_vals[][] |
4 | 560 |
|
561 |
if ($downcast) { |
|
562 |
my($mingi); |
|
563 |
for ($mingi=0; $mingi<@ush_vals; $mingi++) { |
|
564 |
last if @{$ush_vals[$mingi]}; |
|
565 |
} |
|
20 | 566 |
&antsAddParams('LADCPproc::min_ens',$LADCP_start,'LADCPproc::min_elapsed',$LADCP{ENSEMBLE}[$LADCP_start]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
567 |
'LADCPproc::max_ens',$LADCP_end,'LADCPproc::max_elapsed',$LADCP{ENSEMBLE}[$LADCP_end]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
|
568 |
'LADCPproc::min_depth',depthOfGI($mingi),'LADCPproc::max_depth',depthOfGI($#ens_vals)); |
|
4 | 569 |
for (my($gi)=0; $gi<@ush_vals; $gi++) { |
6 | 570 |
for (my($i)=0; $i<@{$ush_vals[$gi]}; $i++){ |
16 | 571 |
&antsOut($ens_vals[$gi][$i], |
572 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
|
573 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{DEPTH},$downcast, |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
574 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
575 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{CTD_LON}, |
16 | 576 |
depthOfGI($gi),$ush_vals[$gi][$i],$vsh_vals[$gi][$i],$wsh_vals[$gi][$i]); |
4 | 577 |
} |
578 |
} |
|
579 |
} else { |
|
580 |
for (my($gi)=$#ush_vals; $gi>=0; $gi--) { |
|
581 |
for (my($i)=0; $i<@{$ush_vals[$gi]}; $i++) { |
|
16 | 582 |
&antsOut($ens_vals[$gi][$i], |
583 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
|
584 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{DEPTH},$downcast, |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
585 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
586 |
$LADCP{ENSEMBLE}[$ens_vals[$gi][$i]]->{CTD_LON}, |
16 | 587 |
depthOfGI($gi),$ush_vals[$gi][$i],$vsh_vals[$gi][$i],$wsh_vals[$gi][$i]); |
4 | 588 |
} |
589 |
} |
|
590 |
} |
|
591 |
} # sub outDSseries |
|
592 |
||
593 |
#-------------------------------------------------------------------------------- |
|
16 | 594 |
# end of callback routine |
595 |
#-------------------------------------------------------------------------------- |
|
4 | 596 |
|
16 | 597 |
|
598 |
$commonParams = $antsCurParams; # PARAMs added up to now are common to all output files |
|
4 | 599 |
|
20 | 600 |
&antsAddParams('LADCPproc::ubin_start',$ubin_start,'LADCPproc::ubin_end',$ubin_end, # record processing params |
601 |
'LADCPproc::wbin_start',$wbin_start,'LADCPproc::wbin_end',$wbin_end, |
|
602 |
'LADCPproc::shbin_start',$shbin_start,'LADCPproc::shbin_end',$shbin_end, |
|
603 |
'LADCPproc::w_ref_bin',$w_ref_bin,'LADCPproc::w_dif',$w_dif, |
|
604 |
'LADCPproc::wake_hd_dif',$wake_hd_dif,'LADCPproc::wake_ang_min',$wake_ang_min, |
|
605 |
'LADCPproc::min_wake_w',$min_wake_w,'LADCPproc::n_wake_bins',$n_wake_bins, |
|
606 |
'LADCPproc::e_max',$e_max,'LADCPproc::min_cor',$min_cor, |
|
607 |
'LADCPproc::max_shdev',$max_shdev,'LADCPproc::max_shdev_sum',$max_shdev_sum, |
|
608 |
'LADCPproc::min_hab',round($min_hab),'LADCPproc::PPI_editing_enabled',$PPI_editing_enabled, |
|
609 |
'LADCPproc::clip_margin',$clip_margin,'LADCPproc::first_clip_bin',$first_clip_bin, |
|
610 |
'LADCPproc::Svbin_start',$Svbin_start,'LADCPproc::Svbin_end',$Svbin_end, |
|
611 |
'LADCPproc::BT_bin_start',$BT_bin_start,'LADCPproc::BT_bin_search_above',$BT_bin_search_above, |
|
612 |
'LADCPproc::BT_max_bin_spread',$BT_max_bin_spread,'LADCPproc::BT_max_w_difference',$BT_max_w_difference, |
|
4 | 613 |
); |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
614 |
if (defined($BT_min_depth)) { # BT-related params |
20 | 615 |
&antsAddParams('LADCPproc::BT_min_depth',$BT_min_depth,'LADCPproc::BT_max_depth',$BT_max_depth); |
4 | 616 |
} else { |
20 | 617 |
&antsAddParams('LADCPproc::BT_max_depth_error',$BT_max_depth_error); |
4 | 618 |
} |
619 |
$fullParams = $antsCurParams; |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
620 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
621 |
$LADCP_start = 1 if ($LADCP_start == 0); # ensure that there is previous ensemble |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
622 |
|
3 | 623 |
print(STDERR "\n\tdowncast...") if ($opt_d); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
624 |
edit_velocity($LADCP_start,$LADCP_bottom); # downcast |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
625 |
calc_shear($LADCP_start,$LADCP_bottom,$SHEAR_PREGRID_DZ,0); # pre-grid shear @SHEAR_PREGRID_DZm resolution |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
626 |
calc_shear($LADCP_start,$LADCP_bottom,$GRID_DZ,1); # calculate final gridded shear profile |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
627 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
628 |
@dc_sh_n = @sh_n; # save downcast results |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
629 |
@dc_ush_mu = @ush_mu; @dc_ush_sig = @ush_sig; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
630 |
@dc_vsh_mu = @vsh_mu; @dc_vsh_sig = @vsh_sig; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
631 |
@dc_wsh_mu = @wsh_mu; @dc_wsh_sig = @wsh_sig; |
7 | 632 |
@dc_esh_mu = @esh_mu; |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
633 |
@dc_lash_mu = @lash_mu; @dc_losh_mu = @losh_mu; |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
634 |
|
3 | 635 |
print(STDERR "\n\tupcast...") if ($opt_d); |
26
d778b73f2a43
before beginning to use instrument tilt in distance calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
636 |
@sh_n=@ush_mu=@ush_sig=@vsh_mu=@vsh_sig=@wsh_mu=@wsh_sig=@esh_mu=@lash_mu=@losh_mu=undef; |
d778b73f2a43
before beginning to use instrument tilt in distance calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
637 |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
638 |
edit_velocity($LADCP_end,$LADCP_bottom); # upcast |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
639 |
calc_shear($LADCP_end,$LADCP_bottom,$SHEAR_PREGRID_DZ,0); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
640 |
calc_shear($LADCP_end,$LADCP_bottom,$GRID_DZ,1); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
641 |
|
1 | 642 |
@uc_sh_n = @sh_n; # save upcast results |
643 |
@uc_ush_mu = @ush_mu; @uc_ush_sig = @ush_sig; |
|
644 |
@uc_vsh_mu = @vsh_mu; @uc_vsh_sig = @vsh_sig; |
|
645 |
@uc_wsh_mu = @wsh_mu; @uc_wsh_sig = @wsh_sig; |
|
7 | 646 |
@uc_esh_mu = @esh_mu; |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
647 |
@uc_lash_mu = @lash_mu; @uc_losh_mu = @losh_mu; |
1 | 648 |
|
3 | 649 |
print(STDERR "\n\tcombined...") if ($opt_d); |
7 | 650 |
my($nsh) = (@dc_ush_mu > @uc_ush_mu) ? scalar(@dc_ush_mu) : scalar(@uc_ush_mu); |
651 |
for (my($gi)=0; $gi<$nsh; $gi++) { |
|
652 |
if (($gi<@dc_ush_mu&&$dc_sh_n[$gi]>0) && ($gi<@uc_ush_mu&&$uc_sh_n[$gi]>0)) { |
|
1 | 653 |
$sh_n[$gi] = $dc_sh_n[$gi] + $uc_sh_n[$gi]; |
654 |
$ush_mu[$gi] = ($dc_sh_n[$gi]*$dc_ush_mu[$gi] + $uc_sh_n[$gi]*$uc_ush_mu[$gi]) / $sh_n[$gi]; |
|
655 |
$vsh_mu[$gi] = ($dc_sh_n[$gi]*$dc_vsh_mu[$gi] + $uc_sh_n[$gi]*$uc_vsh_mu[$gi]) / $sh_n[$gi]; |
|
656 |
$wsh_mu[$gi] = ($dc_sh_n[$gi]*$dc_wsh_mu[$gi] + $uc_sh_n[$gi]*$uc_wsh_mu[$gi]) / $sh_n[$gi]; |
|
7 | 657 |
$esh_mu[$gi] = ($dc_sh_n[$gi]*$dc_esh_mu[$gi] + $uc_sh_n[$gi]*$uc_esh_mu[$gi]) / $sh_n[$gi]; |
1 | 658 |
$ush_sig[$gi] = sqrt(($dc_sh_n[$gi]*$dc_ush_sig[$gi]**2 + $uc_sh_n[$gi]*$uc_ush_sig[$gi]**2) / $sh_n[$gi]); |
659 |
$vsh_sig[$gi] = sqrt(($dc_sh_n[$gi]*$dc_vsh_sig[$gi]**2 + $uc_sh_n[$gi]*$uc_vsh_sig[$gi]**2) / $sh_n[$gi]); |
|
660 |
$wsh_sig[$gi] = sqrt(($dc_sh_n[$gi]*$dc_wsh_sig[$gi]**2 + $uc_sh_n[$gi]*$uc_wsh_sig[$gi]**2) / $sh_n[$gi]); |
|
7 | 661 |
} elsif ($gi < @dc_ush_mu && $dc_sh_n[$gi] > 0) { |
1 | 662 |
$sh_n[$gi] = $dc_sh_n[$gi]; |
7 | 663 |
$ush_mu[$gi] = $dc_ush_mu[$gi]; $vsh_mu[$gi] = $dc_vsh_mu[$gi]; $wsh_mu[$gi] = $dc_wsh_mu[$gi]; $esh_mu[$gi] = $dc_esh_mu[$gi]; |
664 |
$ush_sig[$gi] = $dc_ush_sig[$gi]; $vsh_sig[$gi] = $dc_vsh_sig[$gi]; $wsh_sig[$gi] = $dc_wsh_sig[$gi]; |
|
665 |
} elsif ($gi < @uc_ush_mu && $uc_sh_n[$gi] > 0) { |
|
1 | 666 |
$sh_n[$gi] = $uc_sh_n[$gi]; |
7 | 667 |
$ush_mu[$gi] = $uc_ush_mu[$gi]; $vsh_mu[$gi] = $uc_vsh_mu[$gi]; $wsh_mu[$gi] = $uc_wsh_mu[$gi]; $esh_mu[$gi] = $uc_esh_mu[$gi]; |
668 |
$ush_sig[$gi] = $uc_ush_sig[$gi]; $vsh_sig[$gi] = $uc_vsh_sig[$gi]; $wsh_sig[$gi] = $uc_wsh_sig[$gi]; |
|
1 | 669 |
} else { |
670 |
$sh_n[$gi] = 0; |
|
7 | 671 |
$ush_mu[$gi] = $vsh_mu[$gi] = $wsh_mu[$gi] = $esh_mu[$gi] = nan; |
1 | 672 |
$ush_sig[$gi] = $vsh_sig[$gi] = $wsh_sig[$gi] = nan; |
673 |
} |
|
674 |
} |
|
675 |
||
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
676 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
677 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
678 |
#---------------------------------------------------------------------- |
1 | 679 |
# Step 9: Get bottom track profile |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
680 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
681 |
|
3 | 682 |
if ($LADCP{ENSEMBLE}[$LADCP_start]->{XDUCER_FACING_DOWN}) { |
683 |
print(STDERR "Getting BT profile..."); |
|
684 |
getBTprof($LADCP_start,$LADCP_end); |
|
685 |
print(STDERR "\n"); |
|
686 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
687 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
688 |
#---------------------------------------------------------------------- |
4 | 689 |
# Step 10: Write Output Profiles if requested |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
690 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
691 |
|
4 | 692 |
if (defined($opt_p)) { |
693 |
||
694 |
print(STDERR "Writing shear profiles..."); |
|
695 |
||
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
696 |
@antsNewLayout = ('depth','dc_elapsed','dc_lat','dc_lon','dc_nsamp','dc_u_z','dc_u_z.sig','dc_v_z','dc_v_z.sig','dc_w_z','dc_w_z.sig', |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
697 |
'uc_elapsed','uc_lat','uc_lon','uc_nsamp','uc_u_z','uc_u_z.sig','uc_v_z','uc_v_z.sig','uc_w_z','uc_w_z.sig', |
10 | 698 |
'elapsed','nsamp','u_z','u_z.sig','v_z','v_z.sig','w_z','w_z.sig','Sv','Sv.nsamp'); |
4 | 699 |
|
700 |
&antsOut('EOF'); |
|
701 |
close(STDOUT); |
|
702 |
open(STDOUT,">$opt_p") || croak("$opt_p: $!\n"); |
|
703 |
||
704 |
$antsCurParams = $fullParams; |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
705 |
|
7 | 706 |
for (my($gi)=0; $gi<$nsh; $gi++) { |
4 | 707 |
&antsOut(depthOfGI($gi), # depth in center of bin |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
708 |
$dc_esh_mu[$gi],$dc_lash_mu[$gi],$dc_losh_mu[$gi], # downcast |
7 | 709 |
numberp($dc_sh_n[$gi])?$dc_sh_n[$gi]:0, |
4 | 710 |
$dc_ush_mu[$gi],$dc_ush_sig[$gi], |
711 |
$dc_vsh_mu[$gi],$dc_vsh_sig[$gi], |
|
712 |
$dc_wsh_mu[$gi],$dc_wsh_sig[$gi], |
|
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
713 |
$uc_esh_mu[$gi],$uc_lash_mu[$gi],$uc_losh_mu[$gi], # upcast |
7 | 714 |
numberp($uc_sh_n[$gi])?$uc_sh_n[$gi]:0, |
4 | 715 |
$uc_ush_mu[$gi],$uc_ush_sig[$gi], |
716 |
$uc_vsh_mu[$gi],$uc_vsh_sig[$gi], |
|
717 |
$uc_wsh_mu[$gi],$uc_wsh_sig[$gi], |
|
7 | 718 |
$esh_mu[$gi],$sh_n[$gi], # combined |
4 | 719 |
$ush_mu[$gi],$ush_sig[$gi], |
720 |
$vsh_mu[$gi],$vsh_sig[$gi], |
|
721 |
$wsh_mu[$gi],$wsh_sig[$gi], |
|
722 |
$nSv_prof[$gi]?$sSv_prof[$gi]/$nSv_prof[$gi]:nan, |
|
723 |
$nSv_prof[$gi], |
|
724 |
); |
|
725 |
} |
|
726 |
||
727 |
print(STDERR "\n"); |
|
728 |
} # if -p |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
729 |
|
3 | 730 |
#--------------------------------------- |
731 |
# Acoustic backscatter depth-time-series |
|
732 |
#--------------------------------------- |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
733 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
734 |
if (defined($opt_a)) { |
3 | 735 |
print(STDERR "Writing acoustic backscatter depth-time-series to <$opt_a>..."); |
736 |
||
737 |
||
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
738 |
@antsNewLayout = ('ens','elapsed','CTD_depth','CTD_lat','CTD_lon','depth','bin','downcast', |
3 | 739 |
'Sv_beam1','Sv_beam2','Sv_beam3','Sv_beam4','Sv.median'); |
740 |
&antsOut('EOF'); |
|
741 |
close(STDOUT); |
|
742 |
open(STDOUT,">$opt_a") || croak("$opt_a: $!\n"); |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
743 |
|
3 | 744 |
$antsCurParams = $commonParams; |
20 | 745 |
&antsAddParams('LADCPproc::min_elapsed',$LADCP{ENSEMBLE}[$LADCP_start]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
746 |
'LADCPproc::max_elapsed',$LADCP{ENSEMBLE}[$LADCP_end]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
|
747 |
'LADCPproc::min_depth',$LADCP{ENSEMBLE}[$LADCP_top]->{XDUCER_FACING_UP} ? |
|
3 | 748 |
&depthOfBin($LADCP_top,$LADCP{N_BINS}-1) : $LADCP{ENSEMBLE}[$LADCP_top]->{DEPTH}, |
20 | 749 |
'LADCPproc::max_depth',$LADCP{ENSEMBLE}[$LADCP_bottom]->{XDUCER_FACING_UP} ? |
3 | 750 |
$LADCP{ENSEMBLE}[$LADCP_bottom]->{DEPTH} : &depthOfBin($LADCP_bottom,$LADCP{N_BINS}-1) |
751 |
); |
|
752 |
||
753 |
for (my($ens)=$LADCP_start; $ens<=$LADCP_end; $ens++) { |
|
754 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
755 |
&antsOut($LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
6 | 756 |
$LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
3 | 757 |
$LADCP{ENSEMBLE}[$ens]->{DEPTH}, |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
758 |
$LADCP{ENSEMBLE}[$ens]->{CTD_LAT},$LADCP{ENSEMBLE}[$ens]->{CTD_LON}, |
6 | 759 |
&depthOfBin($ens,$bin),$bin+1, |
3 | 760 |
($ens <= $LADCP_bottom) ? 1 : 0, |
761 |
@{$LADCP{ENSEMBLE}[$ens]->{SV}[$bin]}, |
|
762 |
median(@{$LADCP{ENSEMBLE}[$ens]->{SV}[$bin]}) |
|
763 |
); |
|
764 |
} |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
765 |
} |
3 | 766 |
|
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
767 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
768 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
769 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
770 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
771 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
772 |
if (defined($opt_t)) { |
3 | 773 |
print(STDERR "Writing time series to <$opt_t>..."); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
774 |
|
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
775 |
@antsNewLayout = ('ens','elapsed','depth','CTD_lat','CTD_lon','CTD_w','LADCP_w','pitch','roll','hdg'); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
776 |
&antsOut('EOF'); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
777 |
$antsCurParams = $commonParams; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
778 |
close(STDOUT); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
779 |
open(STDOUT,">$opt_t") || croak("$opt_t: $!\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
780 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
781 |
for (my($ens)=$LADCP_start; $ens<=$LADCP_end; $ens++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
782 |
&antsOut($LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
6 | 783 |
$LADCP{ENSEMBLE}[$ens]->{ELAPSED_TIME}+$CTD{first_elapsed}-$opt_l, |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
784 |
$LADCP{ENSEMBLE}[$ens]->{DEPTH}, |
22
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
785 |
$LADCP{ENSEMBLE}[$ens]->{CTD_LAT}, |
f6635c0384b7
beginning of DIMES US5 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
786 |
$LADCP{ENSEMBLE}[$ens]->{CTD_LON}, |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
787 |
$LADCP{ENSEMBLE}[$ens]->{CTD_W}, |
25
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
788 |
$LADCP{ENSEMBLE}[$ens]->{W}, |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
789 |
$LADCP{ENSEMBLE}[$ens]->{PITCH}, |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
790 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
791 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
91bd907db97f
before debugging weird nsamp problem
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
22
diff
changeset
|
792 |
); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
793 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
794 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
795 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
796 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
797 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
798 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
799 |
if (defined($opt_b)) { |
3 | 800 |
print(STDERR "Writing bottom-track data to <$opt_b>..."); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
801 |
|
6 | 802 |
@antsNewLayout = ('depth','u','v','w','u.sig','v.sig','w.sig','nsamp'); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
803 |
&antsOut('EOF'); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
804 |
$antsCurParams = $commonParams; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
805 |
close(STDOUT); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
806 |
open(STDOUT,">$opt_b") || croak("$opt_b: $!\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
807 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
808 |
my($skipped); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
809 |
for (my($gi)=0; $gi<@BT_nsamp; $gi++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
810 |
$skipped = 1 if ($BT_nsamp[$gi] > 0); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
811 |
next unless ($skipped); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
812 |
&antsOut(depthOfGI($gi),$BTu[$gi],$BTv[$gi],$BTw[$gi],$BTu_sig[$gi],$BTv_sig[$gi],$BTw_sig[$gi],$BT_nsamp[$gi]); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
813 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
814 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
815 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
816 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
817 |
#---------------------------------------------------------------------- |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
818 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
819 |
if (defined($opt_f)) { |
3 | 820 |
print(STDERR "Writing data flags to <$opt_f>..."); |
0
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
821 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
822 |
@antsNewLayout = ('ens'); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
823 |
for (my($i)=1; $i<=$LADCP{N_BINS}; $i++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
824 |
$antsNewLayout[$i] = "bin$i"; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
825 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
826 |
&antsOut('EOF'); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
827 |
$antsCurParams = $commonParams; |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
828 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
829 |
close(STDOUT); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
830 |
open(STDOUT,">$opt_f") || croak("$opt_f: $!\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
831 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
832 |
&antsPrintHeaders(STDOUT,@antsNewLayout); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
833 |
for (my($ens)=$LADCP_start; $ens<=$LADCP_end; $ens++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
834 |
printf('%4d ',$LADCP{ENSEMBLE}[$ens]->{NUMBER}); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
835 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
836 |
printf("%02x ",$edit_flags[$ens][$bin]); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
837 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
838 |
print($opt_R); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
839 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
840 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
841 |
print(STDERR "\n"); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
842 |
} |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
843 |
|
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
844 |
&antsExit(); |
de00d0f32431
initial version to process P403 yoyo
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
diff
changeset
|
845 |