author | A.M. Thurnherr <athurnherr@yahoo.com> |
Sat, 15 Oct 2011 23:23:57 -0400 | |
changeset 4 | e681262d0fd7 |
parent 3 | 9c021fdea1ff |
child 5 | 509cc9966b68 |
permissions | -rwxr-xr-x |
0 | 1 |
#!/usr/bin/perl |
2 |
#====================================================================== |
|
3 |
# L A D C P _ W |
|
4 |
# doc: Fri Dec 17 18:11:13 2010 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
5 |
# dlm: Sat Oct 15 22:44:29 2011 |
0 | 6 |
# (c) 2010 A.M. Thurnherr |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
7 |
# uE-Info: 810 0 NIL 0 0 72 2 2 4 NIL ofnI |
0 | 8 |
#====================================================================== |
9 |
||
10 |
# TODO: |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
11 |
# detection so that editing stats make sense |
2 | 12 |
# - make timelagging work for short casts (make sure 10% is not more than half window size) |
13 |
# - own seabed detection (P403) |
|
14 |
# - make upcast-flag valid for yoyo casts |
|
15 |
# - make diagnostic output 3-beam field work for Earth coordinates |
|
16 |
# - remove water-depth from BT code, which is not really used and a bit of an outlier |
|
17 |
# because mean and stddev are used instead of median/mad |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
18 |
# ? use instrument tilt in sidelobe editing? |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
19 |
# ? remove profile-binning code but add option to output BT-referenced data |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
20 |
# ? read assumed ADCP soundspeed from data file, instead of assuming 1500m/s |
0 | 21 |
|
22 |
$antsSummary = 'calculate vertical velocities from LADCP & CTD time series'; |
|
23 |
||
24 |
# HISTORY: |
|
25 |
# Dec 17, 2010: - created from [mergeCTD+LADCP] |
|
26 |
# Dec 18, 2010: - made to work |
|
27 |
# Dec 19, 2010: - improved considerably |
|
28 |
# Dec 20, 2010: - onward |
|
29 |
# - BUG: depth-binning was off by 1 bin?! |
|
30 |
# - added binning correction for instrument tilt |
|
31 |
# Dec 21, 2010: - added -h (seafloor depth) |
|
32 |
# Dec 22, 2010: - BUG: had not applied soundspeed-correction to w |
|
33 |
# - debugged opt_d |
|
34 |
# Dec 23, 2010: - continued implementation of soundspeed corrections |
|
35 |
# Dec 24, 2010: - added winch_w, wave_w |
|
36 |
# - removed beampair velocities from code |
|
37 |
# Dec 25, 2010: - adapted for surface-wave correction in terms of acceleration (CTD_w_t) |
|
38 |
# - removed elapsed_mismatch |
|
39 |
# - removed winch_w, wave_w |
|
40 |
# Dec 26, 2010: - made -p output layout independent of -x to avoid Makefile problems |
|
41 |
# Dec 30, 2010: - cleaned up some |
|
42 |
# - folded-in backscatter calculation from shear method |
|
43 |
# - folded-in BT calculation from shear method |
|
44 |
# Dec 31, 2010: - added weighted mean w profile to output |
|
45 |
# Jan 2, 2010: - BUG: BT_w.mad could bomb with division by 0 |
|
46 |
# - BUG: division by zero if no valid data |
|
47 |
# Jan 5, 2010: - adapted to allow for gaps in CTD time series |
|
1 | 48 |
# Feb 16, 2011: - cosmetics |
2 | 49 |
# Jun 22, 2011: - cosmetics |
50 |
# Jun 23, 2011: - disabled error on large rms reflr w |
|
51 |
# - added -l |
|
52 |
# - removed CTD headers from output |
|
53 |
# Jun 26, 2011: - added -u |
|
54 |
# - changed package correction from acceleration to velocity, because of |
|
55 |
# Stan's Antarctic data set where accelerations are zero but package effects are |
|
56 |
# there |
|
57 |
# Jul 2, 2011: - increased tilt default to 15 degrees |
|
58 |
# Jul 3, 2011: - replaced old package-velocity correction -x code by new beamvel correction |
|
59 |
# - removed -p |
|
60 |
# - replaced -d by residual (diagnostics) output |
|
61 |
# Jul 4, 2011: - saved a snapshot in [Jul_04_2011] |
|
62 |
# - removed output of binned profile (but not calculation code, which is required for residual) |
|
63 |
# - BUG: firstGoodEns or lastGoodEns could end up in a reflr_w gap when valid LADCP data begin |
|
64 |
# or end with CTD in water |
|
65 |
# - moved rarely used option -s to -k |
|
66 |
# - added -s)kip <ens> option |
|
67 |
# - had to very very slightly relax an assertion (by 1e-10 seconds...) |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
68 |
# Aug 3, 2011: - added -z)ap to truncate range, based on Stan's 2009 data set (017-019 most clearly) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
69 |
# obs that final 2 velocities are outliers; could be due to color bar, should check with |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
70 |
# residuals |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
71 |
# Sep 22, 2011: - removed (commented out) CTD acceleration |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
72 |
# - added basename to Parameter File Matching |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
73 |
# Sep 23, 2011: - cosmetics (lots) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
74 |
# - added -d) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
75 |
# Oct 6, 2011: - removed old commented-out code (CTD acceleration & old -x) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
76 |
# - renamed time-series field names |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
77 |
# - added uncorrected reflr w to time-series output |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
78 |
# Oct 10, 2011: - BUG: LADCP_w in .tds output had not been soundspeed corrected |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
79 |
# - removed -x |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
80 |
# - added "false-positives" editing filter |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
81 |
# Oct 11, 2011: - adapted to the new parameter file, removing a few options |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
82 |
# Oct 12, 2011: - added surface-layer editing |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
83 |
# - made %min/max_depth/elapsed more accurate |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
84 |
# Oct 13, 2011: - fiddled |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
85 |
# Oct 14, 2011: - renamed .prof fields from .N to .nsamp |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
86 |
# - added %output_basename |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
87 |
# - removed all ">" from open to allow use in pipelines |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
88 |
# - made <run-label> argument optional |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
89 |
# - replaced stdout output by $w_out |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
90 |
# - renamed _out to out_; output_basename to out_basename |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
91 |
# Oct 15, 2011: - added editWOutliers() |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
92 |
# - added step to remove single-ping noise |
0 | 93 |
|
94 |
# CTD REQUIREMENTS |
|
95 |
# - elapsed elapsed seconds; see note below |
|
96 |
# - depth |
|
97 |
# - ss sound speed |
|
98 |
# - w ddepth/dt |
|
99 |
# - temp OPTIONAL; used for backscatter calculation (i.e. not very important) |
|
100 |
||
101 |
# NUMERICAL OPTIONS |
|
102 |
# - the first option in the list cannot be numerical! |
|
103 |
# - if need be, use -v 1 as a dummy option |
|
104 |
||
105 |
# ELAPSED TIMES |
|
106 |
# - there are 2 different elapsed times used in this program: |
|
107 |
# 1) elapsed based on firstgoodens in the LADCP time series |
|
108 |
# 2) CTD elapsed time |
|
109 |
# - CTD elapsed time does not have to start with zero! |
|
110 |
# - do not use the Seabird elapsed field, which is only reported to |
|
111 |
# 3 significant digits, causing significant jitter in dt; however, |
|
112 |
# at least up to 2010 Seabird simply calculates elapsed time by |
|
113 |
# assuming a 24Hz sampling rate and no record drop; therefore, |
|
114 |
# it is best to calculate elapsed time as %RECNO/24 |
|
115 |
# - the elapsed field of the output is the elapsed time from the CTD |
|
116 |
# file; this is required in order to be able to compare the times |
|
117 |
# from the uplooker and downlooker-derived vertical velocity |
|
118 |
# profiles |
|
119 |
# - as a result, a profile only starts with elapsed==0 if the CTD |
|
120 |
# is turned on when the LADCP is already in the water |
|
121 |
||
2 | 122 |
# OUTPUT |
123 |
# - default is "long" output with all the data; required to generate Visbeck-type plots |
|
124 |
# - residuals are calculated with respect to down-/upcast medians in binned profiles |
|
125 |
# - -p requests old profile output |
|
126 |
# - BT-referenced profiles are only found in -p output |
|
127 |
# - equivalence, assuming -o 10: |
|
128 |
# 1) 004DL.prof dc_w depth |
|
129 |
# 2) bindata -Sdowncast:1 -Fw.median,depth -n 20 depth 0 1000 10 004DL.w |
|
130 |
||
0 | 131 |
# VELOCITY AMBIGUITY ERRORS |
132 |
# - quite extensive tests with DIMES US2 station 146, which has a lot of |
|
133 |
# ambiguity velocity errors, reveal that -m 1 catches those errors |
|
134 |
# quite nicely |
|
135 |
# - even when the errors are not filtered with -m 1, they do not |
|
136 |
# affect the w profiles, as long as the median bin values are used |
|
137 |
||
138 |
($WCALC) = ($0 =~ m{^(.*)/[^/]*$}); |
|
139 |
($ANTS) = (`which list` =~ m{^(.*)/[^/]*$}); |
|
140 |
($PERL_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$}); |
|
141 |
||
142 |
require "$ANTS/ants.pl"; |
|
143 |
require "$ANTS/libstats.pl"; |
|
144 |
require "$WCALC/edit_data.pl"; |
|
145 |
require "$WCALC/time_series.pl"; |
|
146 |
require "$WCALC/time_lag.pl"; |
|
147 |
require "$WCALC/find_seabed.pl"; |
|
148 |
require "$WCALC/svel_corrections.pl"; |
|
149 |
require "$WCALC/acoustic_backscatter.pl"; |
|
150 |
require "$WCALC/bottom_tracking.pl"; |
|
151 |
require "$PERL_TOOLS/RDI_BB_Read.pl"; |
|
152 |
require "$PERL_TOOLS/RDI_Coords.pl"; |
|
153 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
154 |
#------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
155 |
# Usage |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
156 |
#------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
157 |
|
2 | 158 |
@ARGS = @ARGV; # save opts & arguments |
159 |
||
0 | 160 |
$antsParseHeader = 0; |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
161 |
&antsUsage('3:4a:b:c:e:g:h:i:k:m:n:o:qs:t:uv:w:x:',1, |
0 | 162 |
'[-v)erbosity <level[1]>]', |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
163 |
'[-q)uick (no single-ping denoising)]', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
164 |
'[require -4)-beam solutions]', |
0 | 165 |
'[-c)orrelation <min[70]>] [-t)ilt <max[10deg]> [-e)rr-vel <max[0.1m/s]>]', |
166 |
'[-h water <depth>]', |
|
167 |
'[max LADCP time-series -g)ap <length[60s]>]', |
|
168 |
'[-m)ax vertical <velocity[1m/s]>', |
|
169 |
'[-a)djust CTD depth <by[0m]>]', |
|
2 | 170 |
'[-i)nitial CTD time offset <guestimate> [-u)se as final]]', |
0 | 171 |
'[calculate -n) <lags,lags[10,100]>] [lag -w)indow <sz,sz[240s,20s]>]', |
172 |
'[require top-3) lags to account for <frac[0.6]> of all]', |
|
173 |
'[valid LADCP -b)ins <bin[2],bin[*]>', |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
174 |
'[-o)utput bin <resolution[10m]>] [-k) require <min[20]> samples]', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
175 |
'[e-x)ecute <perl-expr>]', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
176 |
'<station-id> [run-label]'); |
0 | 177 |
|
2 | 178 |
&antsFloatOpt($opt_i); # externally supplied lag |
179 |
&antsUsageError() if ($opt_u && !defined($opt_i)); |
|
180 |
||
181 |
&antsCardOpt(\$opt_s,0); # skip # initial ensembles |
|
182 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
183 |
$STN = &antsCardArg(); # station id |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
184 |
$RUN = $ARGV[0],shift if (@ARGV); # run label |
0 | 185 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
186 |
#----------------------------- |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
187 |
# Handle Processing Parameters |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
188 |
#----------------------------- |
0 | 189 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
190 |
require "$WCALC/defaults.pl"; # load default/option parameters |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
191 |
require "$processing_param_file"; # load processing parameters |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
192 |
eval($opt_x) if defined($opt_x); # eval cmd-line expression to override anything |
0 | 193 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
194 |
croak("$0: \$out_basename undefined\n") # all plotting routines use this |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
195 |
unless defined($out_basename); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
196 |
&antsAddParams('out_basename',$out_basename); |
0 | 197 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
198 |
$out_w = ">$out_w" unless ($out_w =~ /^$|^\s*\|/); # make sure O_CREAT is set unless it's a pipe |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
199 |
$out_TL = ">$out_TL" unless ($out_TL =~ /^$|^\s*\|/); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
200 |
$out_TLhist = ">$out_TLhist" unless ($out_TLhist =~ /^$|^\s*\|/); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
201 |
$out_LADCPtis = ">$out_LADCPtis" unless ($out_LADCPtis =~ /^$|^\s*\|/); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
202 |
$out_profile = ">$out_profile" unless ($out_profile =~ /^$|^\s*\|/); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
203 |
$out_timeseries = ">$out_timeseries" unless ($out_timeseries =~ /^$|^\s*\|/); |
2 | 204 |
|
0 | 205 |
#---------------------------------------------------------------------- |
206 |
# Screen Logging |
|
207 |
# - warning levels: |
|
208 |
# 0 probably unimportant, e.g. nonsensical parameters that probably won't affect solution |
|
209 |
# 1 may be somewhat important |
|
210 |
# 2 important |
|
211 |
#---------------------------------------------------------------------- |
|
212 |
||
213 |
sub progress(@) |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
214 |
{ printf(STDERR @_) if ($verbosity_level > 1); } |
0 | 215 |
|
216 |
sub info(@) |
|
217 |
{ |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
218 |
print(STDERR ($verbosity_level > 1) ? "\t" : "$LADCP_file: "); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
219 |
printf(STDERR @_) if ($verbosity_level > 0); |
0 | 220 |
} |
221 |
||
222 |
sub warning(@) |
|
223 |
{ |
|
224 |
my($lvl,@msg) = @_; |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
225 |
return if ($verbosity_level == 0); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
226 |
print(STDERR "\n") if ($verbosity_level > 1); |
0 | 227 |
print(STDERR "WARNING (level $lvl): "); |
228 |
printf(STDERR @msg); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
229 |
print(STDERR "\n") if ($verbosity_level > 1); |
0 | 230 |
} |
231 |
||
232 |
sub debugmsg(@) |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
233 |
{ printf(STDERR @_) if ($verbosity_level > 2); } |
0 | 234 |
|
235 |
#---------------- |
|
236 |
# Read LADCP data |
|
237 |
#---------------- |
|
238 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
239 |
progress("Reading LADCP data from <$LADCP_file>...\n"); |
0 | 240 |
readData($LADCP_file,\%LADCP); |
241 |
progress("\t%d ensembles\n",scalar(@{$LADCP{ENSEMBLE}})); |
|
242 |
||
243 |
croak("$LADCP_file: not enough LADCP bins ($LADCP{N_BINS}) for choice of -r\n") |
|
244 |
unless ($LADCP{N_BINS} >= $refLr_lastBin); |
|
245 |
||
246 |
croak("$0: first reference-layer bin outside valid range\n") |
|
247 |
unless ($refLr_firstBin>=1 && $refLr_firstBin<=$LADCP{N_BINS}); |
|
248 |
croak("$0: last reference-layer bin outside valid range\n") |
|
249 |
unless ($refLr_lastBin>=1 && $refLr_lastBin<=$LADCP{N_BINS}); |
|
250 |
croak("$0: first reference-layer bin > last reference-layer bin\n") |
|
251 |
unless ($refLr_firstBin <= $refLr_lastBin); |
|
252 |
||
253 |
$LADCP_lastBin = $LADCP{N_BINS}-1 |
|
254 |
if ($LADCP_lastBin eq '*'); |
|
255 |
croak("$0: first valid LADCP bin outside valid range\n") |
|
256 |
unless ($LADCP_firstBin>=1 && $LADCP_firstBin<=$LADCP{N_BINS}); |
|
257 |
croak("$0: last valid LADCP bin outside valid range\n") |
|
258 |
unless ($LADCP_lastBin>=1 && $LADCP_lastBin<=$LADCP{N_BINS}); |
|
259 |
croak("$0: first valid LADCP bin > last valid LADCP bin\n") |
|
260 |
unless ($LADCP_firstBin <= $LADCP_lastBin); |
|
261 |
||
262 |
warning(0,"first reference-layer bin < first valid LADCP bin\n") |
|
263 |
unless ($refLr_firstBin >= $LADCP_firstBin); |
|
264 |
warning(0,"last reference-layer bin > last valid LADCP bin\n") |
|
265 |
unless ($refLr_lastBin <= $LADCP_lastBin); |
|
266 |
||
267 |
warning(1,"if at all, bin 1 should not be used for short blank-after-transmit values\n") |
|
268 |
if ($LADCP{BLANKING_DISTANCE}<$LADCP{BIN_LENGTH} && $refLr_firstBin==1); |
|
269 |
||
270 |
#------------------------------------------------------------ |
|
271 |
# Edit beam-velocity data |
|
272 |
# 1) correlation threshold |
|
273 |
# 2) tilt threshold (also sets TILT field in all ensembles) |
|
274 |
#------------------------------------------------------------ |
|
275 |
||
276 |
if ($LADCP{BEAM_COORDINATES}) { |
|
277 |
progress("Editing beam-velocity data...\n"); |
|
278 |
$nvv = $cte = 0; |
|
279 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
280 |
$nvv += countValidBeamVels($ens); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
281 |
$cte += editCorr($ens,$min_correlation); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
282 |
$pte += editTilt($ens,$max_tilt); |
0 | 283 |
} |
284 |
croak("$LADCP_file: no valid data\n") unless ($nvv > 0); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
285 |
progress("\tcorrelation threshold (-c %d counts): %d velocites removed (%d%% of total)\n",$min_correlation,$cte,round(100*$cte/$nvv)); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
286 |
progress("\tattitude threshold (-t %d deg): %d velocites removed (%d%% of total)\n",$max_tilt,$pte,round(100*$pte/$nvv)); |
0 | 287 |
} else { |
288 |
progress("Editing velocity data...\n"); |
|
289 |
$nvv = $cte = 0; |
|
290 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
291 |
$nvv += countValidBeamVels($ens); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
292 |
$cte += editCorr_Earthcoords($ens,$min_correlation); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
293 |
$pte += editTilt($ens,$max_tilt); |
0 | 294 |
} |
295 |
croak("$LADCP_file: no valid data\n") unless ($nvv > 0); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
296 |
progress("\tcorrelation threshold (-c %d counts): %d velocites removed (%d%% of total)\n",$min_correlation,$cte,round(100*$cte/$nvv)); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
297 |
progress("\tattitude threshold (-t %d deg): %d velocites removed (%d%% of total)\n",$max_tilt,$pte,round(100*$pte/$nvv)); |
0 | 298 |
} |
299 |
||
300 |
#------------------------------------------------------------------- |
|
301 |
# Calculate earth velocities |
|
302 |
# - this is done for all bins (not just valid ones), to allow |
|
303 |
# useless possibility that invalid bins are used for reflr calcs |
|
304 |
# - also calculate separate beam-pair velocities |
|
305 |
# - the UNEDITED velocities are saved for the BT calculations |
|
306 |
# (W is required, U & V are only used for stats that have not |
|
307 |
# been very useful so far) |
|
308 |
#------------------------------------------------------------------- |
|
309 |
||
310 |
if ($LADCP{BEAM_COORDINATES}) { |
|
311 |
progress("Calculating earth-coordinate velocities...\n"); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
312 |
progress("\tdiscarding velocities from beam $discard_velocities_from_beam\n") |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
313 |
if ($discard_velocities_from_beam); |
0 | 314 |
$nvw = 0; |
315 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
316 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
317 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$discard_velocities_from_beam-1]) |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
318 |
if ($discard_velocities_from_beam); |
0 | 319 |
($LADCP{ENSEMBLE}[$ens]->{U}[$bin], |
320 |
$LADCP{ENSEMBLE}[$ens]->{V}[$bin], |
|
321 |
$LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
|
322 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin]) = |
|
323 |
velInstrumentToEarth(\%LADCP,$ens, |
|
324 |
velBeamToInstrument(\%LADCP, |
|
325 |
@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]})); |
|
326 |
$nvw += defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
327 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH} = |
|
328 |
gimbal_pitch($LADCP{ENSEMBLE}[$ens]->{PITCH},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
329 |
$LADCP{ENSEMBLE}[$ens]->{U_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{U}[$bin]; |
|
330 |
$LADCP{ENSEMBLE}[$ens]->{V_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V}[$bin]; |
|
331 |
$LADCP{ENSEMBLE}[$ens]->{W_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin]; |
|
332 |
} |
|
333 |
} |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
334 |
progress("\t$nvw valid velocities in bins $LADCP_firstBin-$LADCP_lastBin\n"); |
0 | 335 |
progress("\t3-beam solutions : $RDI_Coords::threeBeam_1 " . |
336 |
"$RDI_Coords::threeBeam_2 " . |
|
337 |
"$RDI_Coords::threeBeam_3 " . |
|
338 |
"$RDI_Coords::threeBeam_4\n") |
|
339 |
unless ($opt_4); |
|
340 |
} else { |
|
341 |
progress("Counting valid vertical velocities...\n"); |
|
342 |
$nvw = 0; |
|
343 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
344 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
345 |
($LADCP{ENSEMBLE}[$ens]->{U}[$bin], |
|
346 |
$LADCP{ENSEMBLE}[$ens]->{V}[$bin], |
|
347 |
$LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
|
348 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin]) = @{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]}; |
|
349 |
$nvw += defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
350 |
$LADCP{ENSEMBLE}[$ens]->{U_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{U}[$bin]; |
|
351 |
$LADCP{ENSEMBLE}[$ens]->{V_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V}[$bin]; |
|
352 |
$LADCP{ENSEMBLE}[$ens]->{W_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin]; |
|
353 |
} |
|
354 |
} |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
355 |
progress("\t$nvw valid velocities in bins $LADCP_firstBin-$LADCP_lastBin\n"); |
0 | 356 |
} |
357 |
||
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
358 |
croak("$LADCP_file: insufficient valid velocities\n") unless ($nvw > 1000); |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
359 |
|
0 | 360 |
#---------------------------------------------- |
361 |
# S1 STEP: Edit earth-coordinate -velocity data |
|
362 |
# 1) error-velocity threshold |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
363 |
# 2) vertical-velocity outliers |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
364 |
# 3) false-positives |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
365 |
# 4) truncate range |
0 | 366 |
#---------------------------------------------- |
367 |
||
368 |
progress("Editing earth-coordinate velocity data...\n"); |
|
369 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
370 |
$evte = $trte = $fpte = $wote = 0; |
0 | 371 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
372 |
$evte += editErrVel($ens,$max_allowed_errvel); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
373 |
$wote += editWOutliers($ens); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
374 |
$fpte += editFalsePositives($ens); |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
375 |
$trte += editTruncRange($ens,$truncate_farthest_valid_bins) if ($truncate_farthest_valid_bins > 0); |
0 | 376 |
} |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
377 |
progress("\terror-velocity threshold (-e %.1f m/s): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
378 |
$max_allowed_errvel,$evte,round(100*$evte/$nvw)); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
379 |
progress("\tvertical-velocity outliers: %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
380 |
$wote,round(100*$wote/$nvw)); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
381 |
progress("\t\"false-positives\" filter: %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
382 |
$fpte,round(100*$fpte/$nvw)); |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
383 |
progress("\trange truncation (-z %d bins): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
384 |
$truncate_farthest_valid_bins,$trte,round(100*$trte/$nvw)) |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
385 |
if ($truncate_farthest_valid_bins > 0); |
0 | 386 |
|
387 |
#---------------------------- |
|
388 |
# Calculate LADCP time series |
|
389 |
#---------------------------- |
|
390 |
||
391 |
progress("Calculating LADCP time-series...\n"); |
|
392 |
||
393 |
($firstGoodEns,$lastGoodEns,$LADCP_atbottom,$LADCP_w_gap_time) = |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
394 |
calcLADCPts(\%LADCP,$opt_s,$refLr_firstBin,$refLr_lastBin,$max_LADCP_reflr_vel_gap); |
0 | 395 |
croak("$LADCP_file: no good ensembles\n") |
396 |
unless defined($firstGoodEns) && ($lastGoodEns-$firstGoodEns > 0); |
|
397 |
||
398 |
my($cast_duration) = $LADCP{ENSEMBLE}[$lastGoodEns]->{ELAPSED} - |
|
399 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{ELAPSED}; |
|
400 |
croak("$0: implausibly short cast ($cast_duration seconds)\n") |
|
401 |
unless ($cast_duration > 600); |
|
402 |
||
403 |
$LADCP{MEAN_DT} = $cast_duration / ($lastGoodEns-$firstGoodEns-1); |
|
404 |
||
405 |
progress("\tStart of cast : %s (#%5d)\n", |
|
406 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{TIME}, |
|
407 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{NUMBER}); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
408 |
progress("\tBottom of cast : %s (#%5d) @ dz=%6dm\n", |
0 | 409 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{TIME}, |
410 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{NUMBER}, |
|
411 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{DEPTH}); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
412 |
progress("\tEnd of cast : %s (#%5d) @ dz=%6dm\n", |
0 | 413 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{TIME}, |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
414 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{NUMBER}, |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
415 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{DEPTH}); |
0 | 416 |
progress("\tCast duration : %.1f hours (pinging for %.1f hours)\n", |
417 |
$cast_duration / 3600, |
|
418 |
($LADCP{ENSEMBLE}[$#{$LADCP{ENSEMBLE}}]->{UNIX_TIME} - |
|
419 |
$LADCP{ENSEMBLE}[0]->{UNIX_TIME}) / 3600); |
|
420 |
progress("\tMean ping interval: %.1f seconds\n",$LADCP{MEAN_DT}); |
|
421 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
422 |
if (defined($out_LADCPtis)) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
423 |
progress("Writing LADCP-timeseries to <$out_LADCPtis>...\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
424 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
425 |
@antsNewLayout = ('elapsed','reflr_w','reflr_w.stddev','reflr_w.nsamp','depth'); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
426 |
close(STDOUT); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
427 |
open(STDOUT,"$out_LADCPtis") || croak("$out_LADCPtis: $!\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
428 |
for (my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
429 |
&antsOut($LADCP{ENSEMBLE}[$ens]->{ELAPSED}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
430 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
431 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_STDDEV}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
432 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NSAMP}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
433 |
$LADCP{ENSEMBLE}[$ens]->{DEPTH}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
434 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
435 |
&antsOut('EOF'); close(STDOUT); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
436 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
437 |
|
0 | 438 |
#-------------- |
439 |
# Read CTD data |
|
440 |
#-------------- |
|
441 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
442 |
progress("Reading CTD data from <$CTD_file>...\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
443 |
open(STDIN,$CTD_file) || croak("$CTD_file: $!\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
444 |
croak("$CTD_file: no data\n") unless (&antsIn()); |
2 | 445 |
undef($antsOldHeaders); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
446 |
($CTD_elapsed,$CTD_depth,$CTD_svel,$CTD_w) = &fnr('elapsed','depth','ss','w'); |
0 | 447 |
$CTD_temp = &fnrNoErr('temp'); |
448 |
||
449 |
$CTD_maxdepth = -1; |
|
450 |
||
451 |
do { |
|
452 |
croak("$0: cannot deal with non-numeric CTD elapsed time\n") |
|
453 |
unless &antsNumbers($CTD_elapsed); |
|
454 |
push(@{$CTD{ELAPSED}},$ants_[0][$CTD_elapsed]); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
455 |
push(@{$CTD{DEPTH}}, $ants_[0][$CTD_depth]+$CTD_neg_press_offset); |
0 | 456 |
push(@{$CTD{SVEL}}, $ants_[0][$CTD_svel]); |
457 |
push(@{$CTD{W}}, $ants_[0][$CTD_w]); |
|
458 |
push(@{$CTD{TEMP}}, $ants_[0][$CTD_temp]) if defined($CTD_temp); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
459 |
if ($ants_[0][$CTD_depth]+$CTD_neg_press_offset > $CTD_maxdepth) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
460 |
$CTD_maxdepth = $ants_[0][$CTD_depth]+$CTD_neg_press_offset; |
0 | 461 |
$CTD_atbottom = $#{$CTD{DEPTH}}; |
462 |
} |
|
463 |
} while (&antsIn()); |
|
464 |
||
465 |
$CTD{DT} = ($CTD{ELAPSED}[$#{$CTD{ELAPSED}}] - $CTD{ELAPSED}[0]) / $#{$CTD{ELAPSED}}; |
|
466 |
||
467 |
progress("\t%d scans at %.1fHz\n",scalar(@{$CTD{DEPTH}}),1/$CTD{DT}); |
|
468 |
progress("\tstart depth = %.1fm\n",$CTD{DEPTH}[0]); |
|
469 |
croak("$0: CTD start depth must be numeric\n") |
|
470 |
unless numberp($CTD{DEPTH}[0]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
471 |
progress("\tmax depth = %dm (# $CTD_atbottom)\n",$CTD_maxdepth); |
0 | 472 |
|
473 |
#-------------------------------------------------------------------- |
|
474 |
# Construct sound-speed correction profile from CTD 1Hz downcast data |
|
475 |
# very simple algorithm that stores the last value found |
|
476 |
# in each 1m bin |
|
477 |
#-------------------------------------------------------------------- |
|
478 |
||
479 |
progress("Constructing sound-speed correction profile\n"); |
|
480 |
||
481 |
my($scans_per_sec) = int(1/$CTD{DT}+0.5); |
|
482 |
for (my($s)=0; $s<=$CTD_atbottom; $s+=$scans_per_sec) { |
|
483 |
next unless ($CTD{DEPTH}[$s] >= 0 && numberp($CTD{SVEL}[$s])); |
|
484 |
$sVelProf[int($CTD{DEPTH}[$s])] = $CTD{SVEL}[$s]; |
|
485 |
} |
|
486 |
||
487 |
#------------------- |
|
488 |
# Determine time lag |
|
489 |
#------------------- |
|
490 |
||
491 |
if (defined($opt_i)) { |
|
492 |
progress("Setting initial time lag...\n"); |
|
493 |
$CTD{TIME_LAG} = $opt_i; |
|
494 |
progress("\t-i => elapsed(CTD) ~ elapsed(LADCP) + %.1fs\n",$CTD{TIME_LAG}); |
|
495 |
} else { |
|
496 |
progress("Guestimating time lag...\n"); |
|
497 |
||
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
498 |
my($CTD_10pct_down) = 0; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
499 |
my($LADCP_10pct_down) = $firstGoodEns; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
500 |
|
0 | 501 |
$CTD_10pct_down++ |
502 |
until ($CTD{DEPTH}[$CTD_10pct_down]-$CTD{DEPTH}[0] >= 0.1*($CTD_maxdepth-$CTD{DEPTH}[0])); |
|
503 |
$LADCP_10pct_down++ |
|
504 |
until ($LADCP{ENSEMBLE}[$LADCP_10pct_down]->{DEPTH} >= 0.1*$LADCP{ENSEMBLE}[$LADCP_atbottom]->{DEPTH}); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
505 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
506 |
$CTD{TIME_LAG} = |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
507 |
$CTD{ELAPSED}[$CTD_10pct_down] - $LADCP{ENSEMBLE}[$LADCP_10pct_down]->{ELAPSED}; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
508 |
|
0 | 509 |
progress("\telapsed(dz(CTD)=%.1fm) ~ elapsed(dz(LADCP)=%.1fm) + %.1fs\n", |
510 |
$CTD{DEPTH}[$CTD_10pct_down]-$CTD{DEPTH}[0],$LADCP{ENSEMBLE}[$LADCP_10pct_down]->{DEPTH},$CTD{TIME_LAG}); |
|
511 |
} |
|
512 |
||
2 | 513 |
if ($opt_u) { |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
514 |
progress("\tskipping time lagging (-u)\n"); |
2 | 515 |
} else { |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
516 |
$CTD{TIME_LAG} = calc_lag($number_of_timelag_windows[0],$length_of_timelag_windows[0],int(1/$CTD{DT}+0.5)); |
2 | 517 |
progress("\telapsed(CTD) ~ elapsed(LADCP) + %.2fs\n",$CTD{TIME_LAG}); |
518 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
519 |
$CTD{TIME_LAG} = calc_lag($number_of_timelag_windows[1],$length_of_timelag_windows[1],1); |
2 | 520 |
progress("\telapsed(CTD) = elapsed(LADCP) + %.2fs\n",$CTD{TIME_LAG}); |
521 |
} |
|
0 | 522 |
|
523 |
&antsAddParams('CTD_time_lag',$CTD{TIME_LAG}); |
|
524 |
||
525 |
#------------------------------------------------ |
|
526 |
# Merge CTD with LADCP data |
|
527 |
# - after this step, reflr w is sound-speed corrected!!! |
|
528 |
#------------------------------------------------ |
|
529 |
||
530 |
progress("Merging CTD with LADCP data...\n"); |
|
531 |
||
532 |
for (my($skipped)=0,my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
|
533 |
my($scan) = int(($LADCP{ENSEMBLE}[$ens]->{ELAPSED} + $CTD{TIME_LAG} - $CTD{ELAPSED}[0]) / $CTD{DT} + 0.5); |
|
534 |
if ($scan <= 0) { # NB: must be <=, rather than <, or assertion below sometimes fails |
|
535 |
$skipped++; |
|
536 |
$firstGoodEns = $ens+1; |
|
537 |
next; |
|
538 |
} |
|
539 |
if ($skipped > 0) { |
|
2 | 540 |
$firstGoodEns++,$skipped++,next # in gap |
541 |
unless defined($LADCP{ENSEMBLE}[$firstGoodEns]->{REFLR_W}); |
|
0 | 542 |
info("$skipped initial LADCP ensembles skipped because CTD data begin with LADCP in water\n"); |
543 |
$skipped = 0; |
|
544 |
} |
|
545 |
if ($scan > $#{$CTD{ELAPSED}}) { |
|
2 | 546 |
while (!defined($LADCP{ENSEMBLE}[$ens-1]->{REFLR_W})) { $ens--; } # in gap |
0 | 547 |
info(sprintf("%d final LADCP ensembles skipped because CTD data end with LADCP in water\n", |
548 |
$lastGoodEns-$ens+1)); |
|
549 |
$lastGoodEns = $ens-1; |
|
550 |
last; |
|
551 |
} |
|
552 |
||
553 |
die("assertion failed!\n" . |
|
554 |
"\ttest: abs($LADCP{ENSEMBLE}[$ens]->{ELAPSED} + $CTD{TIME_LAG} - $CTD{ELAPSED}[$scan]) <= $CTD{DT}/2\n" . |
|
555 |
"\tens = $ens, scan = $scan\n" . |
|
556 |
sprintf("\tadjusted LADCP time = %f\n",$LADCP{ENSEMBLE}[$ens]->{ELAPSED} + $CTD{TIME_LAG}) . |
|
557 |
sprintf("\tCTD($scan) time = %f\n",$CTD{ELAPSED}[$scan]) . |
|
558 |
"=> Did you use SeaBird elapsed time? Don't!" |
|
2 | 559 |
) unless (abs($LADCP{ENSEMBLE}[$ens]->{ELAPSED} + $CTD{TIME_LAG} - $CTD{ELAPSED}[$scan]) <= $CTD{DT}/2 + 1e-10); |
0 | 560 |
|
561 |
$LADCP{ENSEMBLE}[$ens]->{CTD_ELAPSED} = $CTD{ELAPSED}[$scan]; # elapsed field for output |
|
562 |
||
563 |
if (defined($LADCP{ENSEMBLE}[$ens]->{REFLR_W}) # not a gap |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
564 |
&& numberp($CTD{DEPTH}[$scan])) { |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
565 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NOSSCORR} = $LADCP{ENSEMBLE}[$ens]->{REFLR_W}; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
566 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W} *= $CTD{SVEL}[$scan]/1500; # correct for sound-speed variations at source |
0 | 567 |
croak(sprintf("\n$0: negative depth (%.1fm) in CTD file at elapsed(CTD) = %.1fs (use -a?)\n", |
568 |
$CTD{DEPTH}[$scan],$CTD{ELAPSED}[$scan])) |
|
569 |
unless ($CTD{DEPTH}[$scan] >= 0); |
|
570 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} = $CTD{DEPTH}[$scan]; |
|
571 |
$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN} = $scan; |
|
572 |
my($reflr_ocean_w) = $LADCP{ENSEMBLE}[$ens]->{REFLR_W} - $CTD{W}[$scan]; |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
573 |
if (abs($reflr_ocean_w) <= $max_allowed_w) { |
0 | 574 |
$sumWsq += &SQR($reflr_ocean_w); |
575 |
$nWsq++; |
|
576 |
if ($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} > 100 && |
|
577 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} < $LADCP{ENSEMBLE}[$LADCP_atbottom]->{CTD_DEPTH}-100) { |
|
578 |
$sumWsqI += &SQR($reflr_ocean_w); |
|
579 |
$nWsqI++; |
|
580 |
} |
|
581 |
} else { |
|
582 |
undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); # DON'T USE THIS ENSEMBLE LATER |
|
583 |
} |
|
584 |
} else{ |
|
585 |
undef($LADCP{ENSEMBLE}[$ens]->{REFLR_W}); # don't output in time-series file |
|
586 |
undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); # old DEPTH from calcLADCPts() |
|
587 |
} |
|
588 |
} |
|
589 |
||
590 |
if ($nWsq > 0 && $nWsqI > 0) { |
|
591 |
&antsAddParams('rms_w_reflr_err',sqrt($sumWsq/$nWsq),'rms_w_reflr_err_interior',sqrt($sumWsqI/$nWsqI)); |
|
592 |
progress("\t%.2f cm/s rms reference-layer w_ocean, %.2f cm/s away from boundaries\n", |
|
593 |
100*sqrt($sumWsq/$nWsq),100*sqrt($sumWsqI/$nWsqI)); |
|
594 |
warning(0,"%.2f cm/s reference-layer w_ocean away from boundaries\n",100*sqrt($sumWsqI/$nWsqI)) |
|
595 |
if (sqrt($sumWsqI/$nWsqI) > 0.05); |
|
2 | 596 |
# croak("$0: rms reference-layer w_ocean is too large\n") |
597 |
# unless (sqrt($sumWsqI/$nWsqI) < 0.07); |
|
0 | 598 |
} elsif ($nWsq > 0) { |
599 |
&antsAddParams('rms_w_reflr_err',sqrt($sumWsq/$nWsq),'rms_w_reflr_err_interior',nan); |
|
600 |
progress("\t%.2f cm/s rms reference-layer w_ocean\n",100*sqrt($sumWsq/$nWsq)); |
|
601 |
} else { |
|
602 |
croak("$0: no valid vertical velocities\n"); |
|
603 |
} |
|
604 |
||
605 |
#---------------------------------------------------------------------------- |
|
606 |
# Remove data contaminated by sidelobe reflection from seabed and sea surface |
|
607 |
#---------------------------------------------------------------------------- |
|
608 |
||
609 |
if ($LADCP{ENSEMBLE}[$LADCP_atbottom]->{XDUCER_FACING_DOWN}) { |
|
610 |
&antsAddParams('ADCP_orientation','downlooker'); |
|
611 |
||
612 |
if (numberp($opt_h)) { |
|
613 |
progress("Setting water depth (-h)\n"); |
|
614 |
$water_depth = $opt_h; |
|
615 |
$sig_water_depth = 0; |
|
616 |
} else { |
|
617 |
progress("Finding seabed...\n"); |
|
618 |
calc_backscatter_profs($firstGoodEns,$lastGoodEns); |
|
619 |
($water_depth,$sig_water_depth) = |
|
620 |
find_backscatter_seabed($LADCP{ENSEMBLE}[$LADCP_atbottom]->{CTD_DEPTH}); |
|
621 |
($water_depth_BT,$sig_water_depth_BT) = |
|
622 |
find_seabed(\%LADCP,$LADCP_atbottom,$LADCP{BEAM_COORDINATES}); |
|
623 |
if (defined($water_depth_BT)) { |
|
624 |
my($dd) = abs($water_depth_BT - $water_depth); |
|
625 |
warning(2,sprintf("Large RDI vs. own water-depth difference (%.1fm)\n",$dd)) |
|
626 |
if ($dd > 5); |
|
627 |
} |
|
628 |
} |
|
629 |
||
630 |
&antsAddParams('water_depth',$water_depth,'water_depth.sig',$sig_water_depth); |
|
631 |
||
632 |
if (defined($water_depth)) { |
|
633 |
if (defined($water_depth_BT)) { |
|
634 |
progress("\t%.1f(%.1f) m water depth (%.1f(%.1f)m from BT)\n", |
|
635 |
$water_depth,$sig_water_depth,$water_depth_BT,$sig_water_depth_BT); |
|
636 |
} else { |
|
637 |
progress("\t%.1f(%.1f) m water depth\n",$water_depth,$sig_water_depth); |
|
638 |
} |
|
639 |
warning(1,sprintf("large uncertainty in water-depth estimation (%.1fm)\n",$sig_water_depth)) |
|
640 |
if ($sig_water_depth > $LADCP{BIN_LENGTH}); |
|
641 |
||
642 |
progress("Editing data to remove sidelobe interference from seabed...\n"); |
|
643 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,$water_depth); |
|
644 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
|
645 |
||
646 |
} else { |
|
647 |
info("no seabed found in backscatter profiles --- no sidelobe editing done\n"); |
|
648 |
} |
|
649 |
||
650 |
} else { |
|
651 |
&antsAddParams('ADCP_orientation','uplooker'); |
|
652 |
progress("Editing data to remove sidelobe interference from sea surface...\n"); |
|
653 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,undef); |
|
654 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
|
655 |
} |
|
656 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
657 |
#---------------------------------------------------------------------- |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
658 |
# Data Editing after LADCP and CTD data have been merged |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
659 |
# 1) surface layer editing |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
660 |
#---------------------------------------------------------------------- |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
661 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
662 |
progress("Removing data from instrument at surface...\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
663 |
$nerm = editSurfLayer($firstGoodEns,$lastGoodEns,$surface_layer_depth); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
664 |
progress("\t$nerm ensembles removed\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
665 |
|
0 | 666 |
#--------------------------------------------------------------------------- |
667 |
# Depth-bin LADCP velocity data |
|
668 |
# |
|
669 |
# NOTES: |
|
670 |
# 1) ensemble and bin numbers are saved for maximum flexibility |
|
671 |
# 2) only ensemble/bins with valid vertical velocities are saved |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
672 |
# 3) applying the full soundspeed correction to w is pointless in |
0 | 673 |
# practice, but hey!, CPU cycles are cheap; [in a cast in the Gulf of Mexico |
674 |
# which has fairly pronounce soundspeed gradients, the max value of Kn |
|
675 |
# is 1.00004160558372, which gives rise to a correction of less than 0.2mm/s |
|
676 |
# at a winch+wave speed of 3m/s....] |
|
677 |
# 4) as far as I can tell, the soundspeed correction for bin length also |
|
678 |
# has only a minute effect |
|
679 |
#--------------------------------------------------------------------------- |
|
680 |
||
681 |
progress("Binning velocities...\n"); |
|
682 |
||
2 | 683 |
my($min_depth) = 9e99; |
684 |
my($max_depth) = 0; |
|
685 |
||
0 | 686 |
progress("\tdowncast...\n"); |
687 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
688 |
unless (numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH})) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
689 |
$firstGoodEns++ if ($ens == $firstGoodEns); # start has been edited away |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
690 |
next; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
691 |
} |
0 | 692 |
my(@bindepth) = calc_binDepths($ens); |
693 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
694 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
2 | 695 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
696 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
697 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] = |
|
0 | 698 |
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
699 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
700 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
|
701 |
$bindepth[$bin]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
702 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin] = |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
703 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]; |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
704 |
my($bi) = $bindepth[$bin]/$output_bin_size; |
0 | 705 |
push(@{$DNCAST{ENSEMBLE}[$bi]},$ens); |
706 |
push(@{$DNCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
707 |
push(@{$DNCAST{CTD_W}[$bi]},$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
708 |
push(@{$DNCAST{BIN}[$bi]},$bin); |
|
709 |
push(@{$DNCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
2 | 710 |
push(@{$DNCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
0 | 711 |
} |
712 |
} |
|
713 |
||
2 | 714 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { # bin data |
0 | 715 |
$DNCAST{MEAN_DEPTH}[$bi] = avg(@{$DNCAST{DEPTH}[$bi]}); |
716 |
$DNCAST{MEAN_ELAPSED}[$bi] = avg(@{$DNCAST{ELAPSED}[$bi]}); |
|
717 |
$DNCAST{MEDIAN_W}[$bi] = median(@{$DNCAST{W}[$bi]}); |
|
718 |
$DNCAST{MAD_W}[$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{W}[$bi]}); |
|
719 |
$DNCAST{N_SAMP}[$bi] = @{$DNCAST{W}[$bi]}; |
|
720 |
} |
|
721 |
||
722 |
||
2 | 723 |
progress("\tupcast...\n"); # upcast |
0 | 724 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
725 |
my($realLastGoodEns); |
0 | 726 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { |
727 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
728 |
$realLastGoodEns = $ens; |
0 | 729 |
my(@bindepth) = calc_binDepths($ens); |
730 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
731 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
2 | 732 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
733 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
734 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] = |
|
0 | 735 |
sscorr_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
736 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
737 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
|
738 |
$bindepth[$bin]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
739 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin] = |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
740 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]; |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
741 |
my($bi) = $bindepth[$bin]/$output_bin_size; |
0 | 742 |
push(@{$UPCAST{ENSEMBLE}[$bi]},$ens); |
743 |
push(@{$UPCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
744 |
push(@{$UPCAST{CTD_W}[$bi]},$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
745 |
push(@{$UPCAST{BIN}[$bi]},$bin); |
|
746 |
push(@{$UPCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
2 | 747 |
push(@{$UPCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
0 | 748 |
} |
749 |
} |
|
750 |
||
751 |
for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) { |
|
752 |
$UPCAST{MEAN_DEPTH}[$bi] = avg(@{$UPCAST{DEPTH}[$bi]}); |
|
753 |
$UPCAST{MEAN_ELAPSED}[$bi] = avg(@{$UPCAST{ELAPSED}[$bi]}); |
|
754 |
$UPCAST{MEDIAN_W}[$bi] = median(@{$UPCAST{W}[$bi]}); |
|
755 |
$UPCAST{MAD_W}[$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{W}[$bi]}); |
|
756 |
$UPCAST{N_SAMP}[$bi] = @{$UPCAST{W}[$bi]}; |
|
757 |
} |
|
758 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
759 |
&antsAddParams('min_depth',$min_depth,'max_depth',$max_depth, # plot parameters |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
760 |
'min_ens',$firstGoodEns,'max_ens',$realLastGoodEns, |
2 | 761 |
'min_elapsed',$LADCP{ENSEMBLE}[$firstGoodEns]->{CTD_ELAPSED}, |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
762 |
'max_elapsed',$LADCP{ENSEMBLE}[$realLastGoodEns]->{CTD_ELAPSED}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
763 |
'LADCP_bin_length',$LADCP{BIN_LENGTH}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
764 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
765 |
#------------------------------------------------------------------------------------------------------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
766 |
# remove single-ping noise |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
767 |
# - based on observation that without this step raw velocities tend to be strongly vertically striped |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
768 |
# => residual CTD/LADCP mismatch errors & ADCP single-ping errors |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
769 |
# - remove ensemble-median residual from all vertical velocities; new residual calculated below |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
770 |
# - improves solution but can introduce errors in ensembles with strong outliers => median instead of |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
771 |
# mean, and outlier filter above |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
772 |
#------------------------------------------------------------------------------------------------------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
773 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
774 |
unless ($opt_q) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
775 |
progress("Removing single-ping residual noise...\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
776 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
777 |
for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
778 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
779 |
my(@residuals) = (); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
780 |
my(@bindepth) = calc_binDepths($ens); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
781 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
782 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
783 |
my($bi) = $bindepth[$bin]/$output_bin_size; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
784 |
push(@residuals, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
785 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
786 |
(($ens < $LADCP_atbottom) ? $DNCAST{MEDIAN_W}[$bi] |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
787 |
: $UPCAST{MEDIAN_W}[$bi])); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
788 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
789 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} = median(@residuals); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
790 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
791 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
792 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] -= |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
793 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W}; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
794 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
795 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
796 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
797 |
progress("\tre-calculating profile mad...\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
798 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
799 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { # bin data |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
800 |
for (my($i)=0; $i<@{$DNCAST{W}[$bi]}; $i++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
801 |
$DNCAST{W}[$bi][$i] -= $LADCP{ENSEMBLE}[$DNCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W}; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
802 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
803 |
$DNCAST{MAD_W}[$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{W}[$bi]}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
804 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
805 |
for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
806 |
for (my($i)=0; $i<@{$UPCAST{W}[$bi]}; $i++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
807 |
$UPCAST{W}[$bi][$i] -= $LADCP{ENSEMBLE}[$UPCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W}; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
808 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
809 |
$UPCAST{MAD_W}[$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{W}[$bi]}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
810 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
811 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
812 |
} # unless ($opt_q); |
2 | 813 |
|
0 | 814 |
#-------------------------------------------------- |
815 |
# Calculate BT-referenced vertical-velocity profile |
|
816 |
#-------------------------------------------------- |
|
817 |
||
818 |
if (defined($water_depth)) { |
|
819 |
progress("Calculating BT-referenced vertical velocities\n"); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
820 |
calc_BTprof($firstGoodEns,$realLastGoodEns,$water_depth,$sig_water_depth); |
0 | 821 |
|
822 |
my($sumSq) = my($n) = 0; |
|
823 |
for (my($bi)=0; $bi<=$#{$BT{MEDIAN_W}}; $bi++) { |
|
824 |
next unless defined($BT{MEDIAN_W}[$bi]); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
825 |
next unless ($BT{N_SAMP}[$bi]>=$min_w_nsamp && $DNCAST{N_SAMP}[$bi]>=$min_w_nsamp && $UPCAST{N_SAMP}[$bi]>=$min_w_nsamp); |
0 | 826 |
$sumSq += ($BT{MEDIAN_W}[$bi] - $DNCAST{MEDIAN_W}[$bi]/2 - $UPCAST{MEDIAN_W}[$bi]/2)**2; |
827 |
$n++; |
|
828 |
} |
|
829 |
if ($n > 0) { |
|
830 |
my($rms) = round(sqrt($sumSq/$n),0.001); |
|
831 |
&antsAddParams('BT_rms_w_discrepancy',$rms); |
|
832 |
progress("\t$rms m/s rms vertical-velocity discrepancy\n"); |
|
833 |
} |
|
834 |
} |
|
835 |
||
2 | 836 |
#------------ |
837 |
# full output |
|
838 |
#------------ |
|
839 |
||
840 |
# NB: residual field is calculated with respect to down-/upcast medians in -o-size bins |
|
841 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
842 |
if (defined($out_w)) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
843 |
progress("Writing vertical-velocity data to $out_w...\n"); |
2 | 844 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
845 |
@antsNewLayout = ('ensemble','bin','elapsed','depth','CTD_depth','downcast', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
846 |
'w','residual','CTD_w','LADCP_w','errvel', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
847 |
'pitch','roll','tilt','heading','3_beam','svel'); |
2 | 848 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
849 |
open(STDOUT,"$out_w") || croak("$out_w: $!\n"); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
850 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
851 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
852 |
my(@bindepth) = calc_binDepths($ens); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
853 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
854 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
855 |
my($bi) = $bindepth[$bin]/$output_bin_size; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
856 |
&antsOut( |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
857 |
$ens,$bin,$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
858 |
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},1, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
859 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
860 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
861 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
862 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
863 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
864 |
$LADCP{ENSEMBLE}[$ens]->{PITCH}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
865 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
866 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
867 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
868 |
(defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][0]) + # only works for beam coords |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
869 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][1]) + |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
870 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][2]) + |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
871 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][3])) < 4 ? 1 : 0, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
872 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
873 |
); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
874 |
} |
2 | 875 |
} |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
876 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
877 |
for ($ens=$LADCP_atbottom; $ens<=$realLastGoodEns; $ens++) { # upcast |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
878 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
879 |
my(@bindepth) = calc_binDepths($ens); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
880 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
881 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
882 |
my($bi) = $bindepth[$bin]/$output_bin_size; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
883 |
&antsOut( |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
884 |
$ens,$bin,$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
885 |
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},0, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
886 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
887 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
888 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
889 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
890 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
891 |
$LADCP{ENSEMBLE}[$ens]->{PITCH}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
892 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
893 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
894 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
895 |
(defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][0]) + # only works for beam coords |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
896 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][1]) + |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
897 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][2]) + |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
898 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][3])) < 4 ? 1 : 0, |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
899 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
900 |
); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
901 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
902 |
} |
2 | 903 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
904 |
&antsOut('EOF'); close(STDOUT); |
2 | 905 |
} |
906 |
||
0 | 907 |
#--------------- |
908 |
# Output profile |
|
909 |
#--------------- |
|
910 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
911 |
if (defined($out_profile)) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
912 |
progress("Writing vertical-velocity profiles to <$out_profile>...\n"); |
0 | 913 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
914 |
@antsNewLayout = ('depth','dc_depth','dc_elapsed','dc_w','dc_w.mad','dc_w.nsamp', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
915 |
'uc_depth','uc_elapsed','uc_w','uc_w.mad','uc_w.nsamp', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
916 |
'elapsed','w','w.mad','w.nsamp', |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
917 |
'BT_w','BT_w.mad','BT_w.nsamp'); |
0 | 918 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
919 |
open(STDOUT,"$out_profile") || croak("$out_profile: $!\n"); |
2 | 920 |
|
921 |
for (my($bi)=0; $bi<=max($#{$DNCAST{ENSEMBLE}},$#{$UPCAST{ENSEMBLE}},$#{$BT{NSAMP}}); $bi++) { |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
922 |
&antsOut(($bi+0.5)*$output_bin_size, # nominal depth |
2 | 923 |
$DNCAST{MEAN_DEPTH}[$bi],$DNCAST{MEAN_ELAPSED}[$bi], |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
924 |
$DNCAST{N_SAMP}[$bi]>=$min_w_nsamp?$DNCAST{MEDIAN_W}[$bi]:nan, |
2 | 925 |
$DNCAST{MAD_W}[$bi],$DNCAST{N_SAMP}[$bi], |
926 |
$UPCAST{MEAN_DEPTH}[$bi],$UPCAST{MEAN_ELAPSED}[$bi], |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
927 |
$UPCAST{N_SAMP}[$bi]>=$min_w_nsamp?$UPCAST{MEDIAN_W}[$bi]:nan, |
2 | 928 |
$UPCAST{MAD_W}[$bi],$UPCAST{N_SAMP}[$bi], |
929 |
$DNCAST{MEAN_ELAPSED}[$bi]/2+$UPCAST{MEAN_ELAPSED}[$bi]/2, |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
930 |
$DNCAST{N_SAMP}[$bi]+$UPCAST{N_SAMP}[$bi]>=$min_w_nsamp ? |
2 | 931 |
($DNCAST{MEDIAN_W}[$bi]*$DNCAST{N_SAMP}[$bi]+$UPCAST{MEDIAN_W}[$bi]*$UPCAST{N_SAMP}[$bi]) / ($DNCAST{N_SAMP}[$bi]+$UPCAST{N_SAMP}[$bi]) : |
932 |
nan, |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
933 |
$DNCAST{N_SAMP}[$bi]+$UPCAST{N_SAMP}[$bi]>=$min_w_nsamp ? |
2 | 934 |
($DNCAST{MAD_W}[$bi]*$DNCAST{N_SAMP}[$bi]+$UPCAST{MAD_W}[$bi]*$UPCAST{N_SAMP}[$bi]) / ($DNCAST{N_SAMP}[$bi]+$UPCAST{N_SAMP}[$bi]) : |
935 |
nan, |
|
936 |
$DNCAST{N_SAMP}[$bi]+$UPCAST{N_SAMP}[$bi], |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
937 |
$BT{N_SAMP}[$bi]>=$min_w_nsamp?$BT{MEDIAN_W}[$bi]:nan, |
2 | 938 |
$BT{MAD_W}[$bi],$BT{N_SAMP}[$bi] |
939 |
); |
|
0 | 940 |
} |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
941 |
&antsOut('EOF'); close(STDOUT); |
0 | 942 |
} |
943 |
||
944 |
#-------------------------------------- |
|
945 |
# write time-series output if requested |
|
946 |
#-------------------------------------- |
|
947 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
948 |
if (defined($out_timeseries)) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
949 |
progress("Writing time-series data to <$out_timeseries>...\n"); |
0 | 950 |
|
951 |
@antsNewLayout = ('ens','elapsed', |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
952 |
'depth','xducer_sound_speed','pitch','gimbal_pitch','roll','tilt','heading', |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
953 |
'CTD_w','LADCP_reflr_w','LADCP_reflr_w_err','LADCP_reflr_w_nosscorr', |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
954 |
'reflr_ocean_w'); |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
955 |
open(STDOUT,"$out_timeseries") || croak("$out_timeseries: $!\n"); |
0 | 956 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
957 |
for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) { |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
958 |
my($reflr_oc_w) = defined($LADCP{ENSEMBLE}[$ens]->{REFLR_W}) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
959 |
? $LADCP{ENSEMBLE}[$ens]->{REFLR_W} - $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}] |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
960 |
: undef; |
0 | 961 |
&antsOut($ens, |
962 |
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
963 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
|
964 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
965 |
$LADCP{ENSEMBLE}[$ens]->{PITCH}, |
|
966 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}, |
|
967 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
|
968 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
|
969 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
|
970 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
971 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
|
972 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_ERR}, |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
973 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NOSSCORR}, |
0 | 974 |
$reflr_w); |
975 |
} |
|
976 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
977 |
&antsOut('EOF'); close(STDOUT); |
0 | 978 |
} |
979 |
||
980 |
&antsExit(); |