author | A.M. Thurnherr <athurnherr@yahoo.com> |
Mon, 08 Mar 2021 12:07:26 -0500 | |
changeset 54 | 828e5466391b |
parent 51 | 0f6d9e64cc4f |
child 55 | 2d8e1139acd5 |
permissions | -rwxr-xr-x |
0 | 1 |
#!/usr/bin/perl |
2 |
#====================================================================== |
|
31 | 3 |
# L A D C P _ W _ O C E A N |
0 | 4 |
# doc: Fri Dec 17 18:11:13 2010 |
54 | 5 |
# dlm: Mon Jun 29 11:03:22 2020 |
0 | 6 |
# (c) 2010 A.M. Thurnherr |
54 | 7 |
# uE-Info: 306 76 NIL 0 0 72 2 2 4 NIL ofnI |
0 | 8 |
#====================================================================== |
9 |
||
10 |
# TODO: |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
11 |
# ! use instrument tilt in sidelobe editing |
48 | 12 |
# - use instrument tilt in e.g. calculation of Sv |
13 |
# - use instrument tilt in PPI editing |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
14 |
# |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
15 |
# - plots: |
42 | 16 |
# - avoid over-plotting axis labels |
17 |
# - allow for different nsamp magnitudes |
|
18 |
# - add "dc" "uc" labels |
|
19 |
# - add seabed to eps.VKE profile |
|
20 |
# - add seabed to LADCP_w_postproc .wprof output |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
21 |
# |
42 | 22 |
# - worry about water-depth differences (disabled warning) |
23 |
# - make upcast-flag valid for yoyo casts |
|
24 |
# - make diagnostic output 3-beam field work for Earth coordinates |
|
0 | 25 |
|
26 |
$antsSummary = 'calculate vertical velocities from LADCP & CTD time series'; |
|
27 |
||
28 |
# HISTORY: |
|
42 | 29 |
# Dec 17, 2010: - created from [mergeCTD+LADCP] |
30 |
# Dec 18, 2010: - made to work |
|
31 |
# Dec 19, 2010: - improved considerably |
|
32 |
# Dec 20, 2010: - onward |
|
33 |
# - BUG: depth-binning was off by 1 bin?! |
|
34 |
# - added binning correction for instrument tilt |
|
35 |
# Dec 21, 2010: - added -h (seafloor depth) |
|
36 |
# Dec 22, 2010: - BUG: had not applied soundspeed-correction to w |
|
37 |
# - debugged opt_d |
|
38 |
# Dec 23, 2010: - continued implementation of soundspeed corrections |
|
39 |
# Dec 24, 2010: - added winch_w, wave_w |
|
40 |
# - removed beampair velocities from code |
|
41 |
# Dec 25, 2010: - adapted for surface-wave correction in terms of acceleration (CTD_w_t) |
|
42 |
# - removed elapsed_mismatch |
|
43 |
# - removed winch_w, wave_w |
|
44 |
# Dec 26, 2010: - made -p output layout independent of -x to avoid Makefile problems |
|
45 |
# Dec 30, 2010: - cleaned up some |
|
46 |
# - folded-in backscatter calculation from shear method |
|
47 |
# - folded-in BT calculation from shear method |
|
48 |
# Dec 31, 2010: - added weighted mean w profile to output |
|
49 |
# Jan 2, 2010: - BUG: BT_w.mad could bomb with division by 0 |
|
50 |
# - BUG: division by zero if no valid data |
|
51 |
# Jan 5, 2010: - adapted to allow for gaps in CTD time series |
|
52 |
# Feb 16, 2011: - cosmetics |
|
53 |
# Jun 22, 2011: - cosmetics |
|
54 |
# Jun 23, 2011: - disabled error on large rms reflr w |
|
55 |
# - added -l |
|
56 |
# - removed CTD headers from output |
|
57 |
# Jun 26, 2011: - added -u |
|
58 |
# - changed package correction from acceleration to velocity, because of |
|
59 |
# Stan's Antarctic data set where accelerations are zero but package effects are |
|
60 |
# there |
|
61 |
# Jul 2, 2011: - increased tilt default to 15 degrees |
|
62 |
# Jul 3, 2011: - replaced old package-velocity correction -x code by new beamvel correction |
|
63 |
# - removed -p |
|
64 |
# - replaced -d by residual (diagnostics) output |
|
65 |
# Jul 4, 2011: - saved a snapshot in [Jul_04_2011] |
|
66 |
# - removed output of binned profile (but not calculation code, which is required for residual) |
|
67 |
# - BUG: firstGoodEns or lastGoodEns could end up in a reflr_w gap when valid LADCP data begin |
|
68 |
# or end with CTD in water |
|
69 |
# - moved rarely used option -s to -k |
|
70 |
# - added -s)kip <ens> option |
|
71 |
# - had to very very slightly relax an assertion (by 1e-10 seconds...) |
|
72 |
# Aug 3, 2011: - added -z)ap to truncate range, based on Stan's 2009 data set (017-019 most clearly) |
|
73 |
# obs that final 2 velocities are outliers; could be due to color bar, should check with |
|
74 |
# residuals |
|
75 |
# Sep 22, 2011: - removed (commented out) CTD acceleration |
|
76 |
# - added basename to Parameter File Matching |
|
77 |
# Sep 23, 2011: - cosmetics (lots) |
|
78 |
# - added -d) |
|
79 |
# Oct 6, 2011: - removed old commented-out code (CTD acceleration & old -x) |
|
80 |
# - renamed time-series field names |
|
81 |
# - added uncorrected reflr w to time-series output |
|
82 |
# Oct 10, 2011: - BUG: LADCP_w in .tds output had not been soundspeed corrected |
|
83 |
# - removed -x |
|
84 |
# - added "false-positives" editing filter |
|
85 |
# Oct 11, 2011: - adapted to the new parameter file, removing a few options |
|
86 |
# Oct 12, 2011: - added surface-layer editing |
|
87 |
# - made %min/max_depth/elapsed more accurate |
|
88 |
# Oct 13, 2011: - fiddled |
|
89 |
# Oct 14, 2011: - renamed .prof fields from .N to .nsamp |
|
90 |
# - added %output_basename |
|
91 |
# - removed all ">" from open to allow use in pipelines |
|
92 |
# - made <run-label> argument optional |
|
93 |
# - replaced stdout output by $w_out |
|
94 |
# - renamed _out to out_; output_basename to out_basename |
|
95 |
# Oct 15, 2011: - added editWOutliers() |
|
96 |
# - added step to remove single-ping noise |
|
97 |
# Oct 16, 2011: - BUG: ensemble and bin numbers in output files were off by 1 |
|
98 |
# Oct 17, 2011: - added default run label |
|
99 |
# - added out_BR |
|
100 |
# - BUG: closed STDOUT caused problems with tee in plotting scripts |
|
101 |
# - added %run_label |
|
102 |
# - added PostProcess.sh |
|
103 |
# Oct 18, 2011: - BUG: %{min,max}_ens used ensemble indices, rather than numbers |
|
104 |
# - disabled false-positives editing (removes too much good data on 2011_IWISE) |
|
105 |
# Oct 19, 2011: - BUG: time-series output included ensembles without valid w |
|
106 |
# - increased post-process sleep time to 30s |
|
107 |
# - added corr, Sv and echo_amplitude as new fields to w output |
|
108 |
# Oct 20, 2011: - added editFarBins() |
|
109 |
# - added downcast flag to time-series output |
|
110 |
# - added ensemble number to LADCP-time-series output |
|
111 |
# Oct 21, 2011: - BUG: Sv code was not enabled for uplooker data |
|
112 |
# Oct 24, 2011: - added code to copy %lat/%lon from CTD data |
|
113 |
# - added %ADCP_freuquency, %ADCP_blanking_distance |
|
114 |
# - %LADCP_bin_length => %ADCP_bin_length |
|
115 |
# Oct 26, 2011: - added $first_guess_timelag |
|
116 |
# Oct 27, 2011: - added w12, w34, ww (pitch/roll-weighted average) to full output |
|
117 |
# - removed ww because it apparently does not improve the solutions |
|
118 |
# - moved editTilt() to after time-series calculation to allow |
|
119 |
# time matching to work even with strict tilt limit |
|
120 |
# - added correctAttitude() |
|
121 |
# May 22, 2012: - adapted to ANTS V5 |
|
122 |
# Oct 15, 2012: - added $edit_data_hook |
|
123 |
# - HG COMMIT |
|
124 |
# - separated dc/uc time lagging |
|
125 |
# - removed support for TLhist |
|
126 |
# Oct 16, 2012: - added support for dc/uc only solutions |
|
127 |
# Oct 17, 2012: - renamed $edit_data_hook to $post_merge_hook |
|
128 |
# - HG COMMIT |
|
129 |
# Feb 13, 2013: - BUG: CTD_neg_press_offset did not work for CTD time series with -ve starting depth |
|
130 |
# Mar 23, 2013: - cosmetics |
|
131 |
# - HG COMMIT |
|
132 |
# Apr 22, 2013: - removed opt_? variable aliases |
|
133 |
# May 8, 2013: - replaced default run label (default to profiles) to make more readable directory structure |
|
134 |
# May 14, 2013: - opt_m => w_max_lim |
|
135 |
# - BUG: time-series output had two messed-up fields |
|
136 |
# May 15, 2013: - added w12 and w34 (2-beam solutions) to profile output |
|
137 |
# May 16, 2013: - added CTD_w_tt to time-series & all-sample outputs |
|
138 |
# - -a => -d (CTD depth offset) |
|
139 |
# - implemented pressure-sensor acceleration correction (-a) |
|
140 |
# - added re-gridding of full profile after ping-coherent error removal |
|
141 |
# Jun 5, 2013: - renamed $discard_velocities_from_beam to $bad_beam |
|
142 |
# - BUG: $bad_beam did not discard BT_VELOCITY data |
|
143 |
# Jun 6, 2013: - BUG: error message had -a instead of -d |
|
144 |
# Sep 5, 2013: - BUG: w12/w34 do not work for earth-coordinate data, of course |
|
145 |
# Apr 17, 2014: - BUG: edit_tilt was never called when all recorded bins are valid |
|
146 |
# Apr 21, 2014: - updated comments |
|
147 |
# May 19, 2014: - began adding support for PPI filtering |
|
148 |
# May 20, 2014: - changed volume_scattering_coeff to Sv in output |
|
149 |
# - added editPPI() |
|
150 |
# Jul 6, 2014: - BUG: nan water depth had been interpreted as known |
|
151 |
# - BUG: sVelProf[] was not allowed to have any gaps |
|
152 |
# Jul 9, 2014: - BUG: Jul 6 bug fixes had been applied to older |
|
153 |
# version |
|
154 |
# - BUG: code meant to ensure gap-free svel profiles did not work correctly |
|
155 |
# Jul 12, 2014: - finally made output files executable |
|
156 |
# Apr 5, 2015: - added check for required software |
|
157 |
# - BUG: removed dc/uc mean w fields from .prof again |
|
158 |
# Apr 7, 2015: - made LADCP_w callable from installation directory |
|
159 |
# - BUG: -v default was wrong in usage message |
|
160 |
# - replaced 'ens' in output files by 'ensemble' |
|
161 |
# Apr 16, 2015: - turned output specifies into lists (re-design of |
|
162 |
# plotting sub-system) |
|
163 |
# - removed 30s sleep from PostProcess.sh call |
|
164 |
# - disabled active output when ANTS are not available |
|
165 |
# - removed /bin/ksh requirement |
|
166 |
# - BUG: error messages were not reported in the log file |
|
167 |
# - made seabed detection code more flexible |
|
168 |
# - made reference-layer w_ocean warning more severe |
|
169 |
# - BUG: info() did not write anything into logfile when format string was used |
|
170 |
# - BUG: LADCP_lastBin was set 1 too low |
|
171 |
# Apr 20, 2015: - improved comments |
|
172 |
# - improved diagnostic messages (warning on missing CTD temp) |
|
173 |
# - added support for empirical backscatter correction |
|
174 |
# Apr 21, 2015: - improved screen log output |
|
175 |
# Apr 22, 2015: - BUG: $realLastGoodEns could be undefined, breaking plotting routines |
|
176 |
# Apr 24, 2015: - removed @ARGS |
|
177 |
# - added %profile_id |
|
178 |
# May 13, 2015: - loosened "insufficient valid velocities" test for short casts |
|
179 |
# May 15, 2015: - added $min_valid_vels |
|
180 |
# - BUG: LADCP_atbottom could be less than firstGoodEns |
|
181 |
# May 18, 2015: - added %LADCP_pulse_length, %dnXX |
|
182 |
# May 20, 2015: - added $PROF as newer alternative to $STN |
|
183 |
# - replaced "require ProcessingParams" by "do ProcessingParams" |
|
184 |
# Jun 15, 2015: - clarified warning message |
|
185 |
# Jul 26, 2015: - added %output_grid_dz %output_grid_minsamp for use by [LADCP_w_regrid] |
|
186 |
# - began work on support for [libGMT.pl] |
|
187 |
# - -v usage message had wrong default |
|
188 |
# - added $outGrid_firstBin & $outGrid_lastBin |
|
189 |
# Jul 28, 2015: - added GMT plot support for all @out_ lists |
|
190 |
# Jul 29, 2015: - continue adaptation of code for new plotting system |
|
191 |
# Jul 30, 2015: - cosmetics |
|
192 |
# Sep 3, 2015: - changed out_w to out_wsamp |
|
193 |
# Sep 26, 2015: - replaced numberp($water_depth) by defined($water_depth) for consistency |
|
194 |
# - implemented secondary sidelobe editing |
|
195 |
# - allow for -h <filename> |
|
196 |
# - allow $ID as alias for $PROF and $STN |
|
197 |
# Sep 27, 2015: - BUG: -h filename was broken when water_depth is not known |
|
198 |
# Oct 12, 2015: - upgraded missing water-depth warnings to L2 |
|
199 |
# - added -V)ersion |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
200 |
# - require ANTSlibs V6.2 for release |
33 | 201 |
# Oct 13, 2015: - adapted to [version.pl] |
42 | 202 |
# Nov 25, 2015: - made warning disappear on setting $ANTS_TOOLS_AVAILABLE |
203 |
# Nov 27, 2015: - changed RDI_BB_READ.pl to RDI_PD0_IO.pl |
|
204 |
# Jan 4, 2016: - decreased default vertical resolution to 20m |
|
205 |
# Jan 5, 2016: - adapted to [ADCP_tools_lib.pl] |
|
206 |
# Jan 22, 2016: - updated for improved mean_residuals plot |
|
207 |
# - added per-bin residual quality check |
|
208 |
# Jan 25, 2016: - added antsAddParams() with version number |
|
209 |
# Jan 26, 2016: - added %processing_params, many others |
|
210 |
# - expunged -d |
|
211 |
# - implemented outGrid_firstBin eq '*' (also lastBin) |
|
212 |
# Jan 27, 2016: - BUG: outGrid_lastBin eq '*' did not work |
|
213 |
# - removed large ref-lr w warning |
|
214 |
# Feb 14, 2016: - fiddled with ping-coherent residuals code, fixing |
|
215 |
# 0-2 potential (minor?) bugs related to outGrid_{first,last}Bin; |
|
216 |
# output of new code checked against old code => identical |
|
217 |
# Feb 16, 2016: - BUG: per-bin-residual QC could cause division by zero |
|
218 |
# Feb 19, 2016: - added -l (disable time-lag filtering) |
|
219 |
# Mar 7, 2016: - added error message when -h is neither number nor file |
|
220 |
# - BUG: -ve depth error message referred to obsolete -d |
|
221 |
# - BUG: dn field name did not use zero filling for year number |
|
222 |
# Mar 8, 2016: - removed L0 water-depth-difference warning |
|
223 |
# - added test for 1500m/s sound speed |
|
224 |
# Mar 9, 2016: - added hab field to .wprof output |
|
225 |
# Mar 13, 2016: - cleaned up warnings created before LADCP_file is defined |
|
226 |
# - added sanity checks and warnings |
|
227 |
# Mar 17, 2016: - added {dc,uc}_rms_{tilt,w_pkg} |
|
228 |
# - replaced a couple of **2 by &SQR() |
|
229 |
# - replaced %ADCP_orientation values by DL & UL |
|
230 |
# - {dc,uc}_rms_w_pkg => {dc,uc}_rms_accel_pkg for V1.2beta6 |
|
231 |
# Mar 18, 2016: - added -l to %processing_options |
|
232 |
# Mar 24, 2016: - generalized plotting system (renamed variables) |
|
233 |
# - made plotting system search current dir before LADCP_w dir |
|
234 |
# - BUG: ProcessingParams syntax errors were not flagged |
|
235 |
# - BUG: progress message in rarely used filter |
|
236 |
# Mar 25, 2016: - added -r)esidual rms filter |
|
237 |
# - added -q -r to processing_options |
|
238 |
# Mar 26, 2016: - BUG: water_depth < CTD_maxdepth was allowed |
|
239 |
# - round(CTD_depth) |
|
240 |
# Mar 29, 2016: - split [default_paths.pl] from [defaults.pl] to allow defaults |
|
241 |
# to be read before usage |
|
242 |
# - renamed _subdir to _dir variables |
|
243 |
# - renamed post-process hook script to LADCP_w.PostProcess |
|
244 |
# - added -r default (0.04m/s) |
|
43 | 245 |
# Mar 31, 2016: - changed version %PARAM |
246 |
# Apr 6, 2016: - BUG: GMT test looked for psxy, rather than gmt binary |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
247 |
# May 12, 2106: - added v12, v34 to wsamp output |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
248 |
# May 17, 2016: - added residual12, residual34 to wsamp output |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
249 |
# - changed pitch field in wsamp output to gimbal pitch |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
250 |
# - added w_t to .wsamp output for completeness |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
251 |
# May 18, 2016: - replaced rms_tilt by mean_tilt |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
252 |
# - add (gimbal-)pitch, roll and residual{12,34} to wprof output |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
253 |
# - expunged super-confusing $realLastGoodEns |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
254 |
# - removed assumption of default 1500m/s sspd setting during acquisition |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
255 |
# - added w12, w34 for earth-coordinates |
46 | 256 |
# May 19, 2016: - updated to ADCP_tools V1.6 |
257 |
# May 24, 2016: - calc_binDepths() -> binDepths() |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
258 |
# May 26, 2016: - added -d)isable bin interpolation |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
259 |
# - adapted to w_CTD, w_winch |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
260 |
# - re-enabled disabled L0 warning |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
261 |
# - suppressing L0 warnings on screen |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
262 |
# May 27, 2016: - cosmetics |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
263 |
# - added reflr_w to .wsamp output |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
264 |
# May 29, 2016: - BUG: do ProcessingParams did not handle all errors correctly |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
265 |
# Jun 1, 2016: - made empirical accoustic backscatter correction optional |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
266 |
# - split [default_paths.pl] to same plus [default_output.pl] |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
267 |
# Jun 2, 2016: - added applyTiltCorrection() |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
268 |
# - BUG: PPI-editing was no longer enabled automatically |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
269 |
# for 150kHz instruments |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
270 |
# Jun 3, 2016: - BUG: earth-coordinate data did not have gimbal-pitch |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
271 |
# calculated |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
272 |
# Jun 6, 2016: - removed applyTiltCorrection() |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
273 |
# Jun 11, 2016: - BUG: w12, w34 were wrong for Earth-coord data |
48 | 274 |
# Jul 7, 2016: - BUG: finally fixed with velEarthToBPw() from [RDI_Coords.pl] |
275 |
# Jul 31, 2016: - BUG: -d did not work because it was handled in [defaults.pl] |
|
276 |
# Oct 16, 2016: - cosmetics |
|
277 |
# Dec 22, 2016: - moved $opt_p to [defaults.pl] |
|
278 |
# Dec 23, 2016: - BUG: -u did not set required variables to proceed |
|
279 |
# Mar 6, 2017: - BUG: division by zero when water-depth ~ max(CTD_depth) |
|
49 | 280 |
# Oct 12, 2017: - BUG: beampair w did not work for earth-coord vels; major re-write |
281 |
# of earthcoord code to unify processing |
|
282 |
# Nov 26, 2017: - BUG: $bad_beam did not work correctly with bin interpolation |
|
283 |
# - BUG: ping-coherent residual removal did not respect missing values |
|
284 |
# Nov 28, 2017: - added $initial_time_lag |
|
285 |
# - expanded semantics of -q to disable time-lagging and residual filters |
|
286 |
# Dec 9, 2017: - added $antsSuppressCommonOptions = 1; |
|
287 |
# Dec 17, 2017: - added dependencies |
|
288 |
# Apr 24, 2018: - added support for $water_depth_db_cmd |
|
289 |
# May 1, 2018: - added threshold for reference-layer horizontal speed |
|
290 |
# - added ambiguity velocity check |
|
291 |
# May 2, 2018: - BUG: ref-lr threshold did not work |
|
292 |
# - BUG: BT code was called for UL when -h was used |
|
293 |
# - replaced $PPI_seabed_editing_required by &PPI_seabed_editing_required |
|
294 |
# - BUG: surface PPI editing code could not be enabled; added &PPI_surface_editing_required |
|
295 |
# Nov 2, 2018: - BUG: for 3-beam solutions, residual{12,34} with affected beam was wrong |
|
51
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
296 |
# Apr 12, 2019: - added logfile error message for non-existing file |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
297 |
# Apr 18, 2019: - added addtional RDI coordinate transformation %PARAMs |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
298 |
# Apr 21, 2019: - BUG: removed duplicate warning about lacking water-depth info |
54 | 299 |
# Sep 10, 2019: - BUG: -i was erroneously listed as the initial CTD time offset |
300 |
# Sep 12, 2019: - modified .prof output layout to be consistent with [LADCP_w_postproc] |
|
301 |
# May 15, 2020: - BUG: re-binning on -r did not work for v12 and v34 |
|
302 |
# - BUG: before re-binning, upcast v12 and v34 were actuall from DC data |
|
303 |
# - BUG: all beam-pair velocity stats were contaminated by missing values |
|
304 |
# - made bin residuals per beam pair |
|
305 |
# May 16, 2020: - BUG: write_residual_profs() clobbered layout |
|
306 |
# Jun 22, 2020: - sscorr_w renamed to remove conflict with [RDI_Coords.pl] |
|
30 | 307 |
# HISTORY END |
0 | 308 |
|
309 |
# CTD REQUIREMENTS |
|
310 |
# - elapsed elapsed seconds; see note below |
|
311 |
# - depth |
|
19 | 312 |
# - ss sound speed |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
313 |
# - w[_CTD] ddepth/dt |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
314 |
# - w_winch OPTIONAL; winch-speed estimate |
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
315 |
# - temp OPTIONAL; used for backscatter calculation |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
316 |
# - %lat/%lon OPTIONAL |
0 | 317 |
|
13 | 318 |
# 2-BEAM SOLUTIONS |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
319 |
# - both for beam- and earth-coordinate data, two separate two-beam |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
320 |
# solutions (w12 & w34) are calculated: |
46 | 321 |
# - w12 corresponds to ROLL axis (plotted with dashed lines) |
322 |
# - w34 corresponds to PITCH axis (plotted with dotted lines) |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
323 |
# - the 2-beam solutions are largely independent of each other |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
324 |
# => key for detecting data problems, such as package wakes |
13 | 325 |
|
0 | 326 |
# NUMERICAL OPTIONS |
327 |
# - the first option in the list cannot be numerical! |
|
19 | 328 |
# - if need be, use -v 1 as a dummy option |
0 | 329 |
|
330 |
# ELAPSED TIMES |
|
331 |
# - there are 2 different elapsed times used in this program: |
|
332 |
# 1) elapsed based on firstgoodens in the LADCP time series |
|
333 |
# 2) CTD elapsed time |
|
334 |
# - CTD elapsed time does not have to start with zero! |
|
335 |
# - do not use the Seabird elapsed field, which is only reported to |
|
336 |
# 3 significant digits, causing significant jitter in dt; however, |
|
337 |
# at least up to 2010 Seabird simply calculates elapsed time by |
|
338 |
# assuming a 24Hz sampling rate and no record drop; therefore, |
|
339 |
# it is best to calculate elapsed time as %RECNO/24 |
|
340 |
# - the elapsed field of the output is the elapsed time from the CTD |
|
341 |
# file; this is required in order to be able to compare the times |
|
342 |
# from the uplooker and downlooker-derived vertical velocity |
|
343 |
# profiles |
|
11 | 344 |
# - the .TL files use the LADCP elapsed time in output; as a result, |
345 |
# the DL/UL .TL files have different time axes! |
|
0 | 346 |
# - as a result, a profile only starts with elapsed==0 if the CTD |
347 |
# is turned on when the LADCP is already in the water |
|
348 |
||
13 | 349 |
# BINNED-PROFILE OUTPUT NOTES |
350 |
# - residuals are calculated with respect to down-/upcast medians |
|
351 |
# - w12 and w34 2-beam solutions are reported without considering |
|
352 |
# -k (min samples) |
|
2 | 353 |
# - equivalence, assuming -o 10: |
354 |
# 1) 004DL.prof dc_w depth |
|
6 | 355 |
# 2) bindata -Sdowncast:1 -Fw.median,depth -n 20 depth 10 004DL.w |
2 | 356 |
|
0 | 357 |
# VELOCITY AMBIGUITY ERRORS |
358 |
# - quite extensive tests with DIMES US2 station 146, which has a lot of |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
359 |
# ambiguity velocity errors, reveal that $w_max_lim catches those errors |
0 | 360 |
# quite nicely |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
361 |
# - even when the errors are not filtered with $w_max_lim, they do not |
0 | 362 |
# affect the w profiles, as long as the median bin values are used |
363 |
||
23 | 364 |
($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$}); |
365 |
($ADCP_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$}); |
|
366 |
($WCALC) = ($0 =~ m{^(.*)/[^/]*$}); |
|
367 |
$WCALC = '.' if ($WCALC eq ''); |
|
33 | 368 |
$ANTS_TOOLS_AVAILABLE = (`which list 2>/dev/null` ne ''); |
23 | 369 |
|
19 | 370 |
die("$0: Generic Mapping Tools (GMT) required but not found (bad \$PATH?)\n") |
43 | 371 |
unless (`which gmt` ne ''); |
19 | 372 |
die("$0: ANTSlib required but not found (bad \$PATH?)\n") |
23 | 373 |
unless ($ANTS ne ''); |
19 | 374 |
die("$0: ADCP Tools required but not found (bad \$PATH?)\n") |
23 | 375 |
unless ($ADCP_TOOLS ne ''); |
0 | 376 |
|
33 | 377 |
require "$WCALC/version.pl"; |
0 | 378 |
require "$WCALC/edit_data.pl"; |
379 |
require "$WCALC/time_series.pl"; |
|
380 |
require "$WCALC/time_lag.pl"; |
|
381 |
require "$WCALC/find_seabed.pl"; |
|
382 |
require "$WCALC/svel_corrections.pl"; |
|
383 |
require "$WCALC/acoustic_backscatter.pl"; |
|
384 |
require "$WCALC/bottom_tracking.pl"; |
|
33 | 385 |
require "$ANTS/ants.pl"; |
386 |
require "$ANTS/libstats.pl"; |
|
34 | 387 |
require "$ADCP_TOOLS/ADCP_tools_lib.pl"; |
43 | 388 |
&antsAddParams('LADCP_w_ocean::version',$VERSION); |
0 | 389 |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
390 |
use IO::Handle; |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
391 |
|
6 | 392 |
my($TINY) = 1e-16; |
393 |
||
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 |
#------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
395 |
# Usage |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
396 |
#------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
397 |
|
42 | 398 |
require "$WCALC/defaults.pl"; # load default/option parameters |
399 |
||
0 | 400 |
$antsParseHeader = 0; |
49 | 401 |
$antsSuppressCommonOptions = 1; |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
402 |
&antsUsage('3:4a:b:c:de:g:h:i:k:lm:n:o:p:qr:s:t:uv:Vw:x:',0, |
42 | 403 |
"[print software -V)ersion] [-v)erbosity <level[$opt_v]>]", |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
404 |
"[require -4)-beam solutions] [-d)isable bin interpolation] [apply beamvel-m)ask <file> if it exists]", |
42 | 405 |
"[valid LADCP -b)ins <bin,bin[$opt_b]>", |
406 |
"[-c)orrelation <min[$opt_c counts]>] [-t)ilt <max[$opt_t deg]> [-e)rr-vel <max[$opt_e m/s]>]", |
|
49 | 407 |
"[max -r)esidual <rms.max[,delta.max][$opt_r m/s]>]", |
42 | 408 |
"[-h water <depth|filename>]", |
409 |
"[max LADCP time-series -g)ap <length[$opt_g s]>]", |
|
54 | 410 |
"[-i)nitial LADCP time offset <guestimate> [-u)se as final]]", |
42 | 411 |
"[calculate -n) <lags,lags[$opt_n]>] [lag -w)indow <sz,sz[$opt_w s]>] [lag-p)iece <CTD_elapsed_min|+[,...]>]", |
412 |
"[require top-3) lags to account for <frac[$opt_3]> of all]", |
|
413 |
"[disable time-l)ag filtering]", |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
414 |
"[pressure-sensor -a)cceleration-derivative correction <residual/CTD_w_tt>]", |
42 | 415 |
"[-o)utput bin <resolution[$opt_o m]>] [-k) require <min[$opt_k]> samples]", |
416 |
"[e-x)ecute <perl-expr>]", |
|
49 | 417 |
"[-q)uick-and-dirty (no single-ping denoising, residual and time-lagging filters)]", |
42 | 418 |
"<profile-id> [run-label]"); |
0 | 419 |
|
42 | 420 |
if ($opt_V) { |
49 | 421 |
printf(STDERR "+------------------------------+\n"); |
422 |
printf(STDERR "| LADCP_w Software V%s |\n",$VERSION); |
|
423 |
printf(STDERR "| (c) 2015-2017 A.M. Thurnherr |\n"); |
|
424 |
printf(STDERR "+------------------------------+\n"); |
|
42 | 425 |
exit(0); |
426 |
} |
|
2 | 427 |
|
42 | 428 |
&antsUsageError() if ($opt_u && !defined($opt_i)); |
429 |
&antsUsageError() unless (@ARGV==1 || @ARGV==2); |
|
2 | 430 |
|
42 | 431 |
&antsCardOpt(\$opt_s,0); # skip # initial ensembles |
48 | 432 |
#$opt_p = '+' unless defined($opt_p); # separate uc/dc time lagging |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
433 |
|
42 | 434 |
&antsFloatOpt(\$opt_a,1); # pressure acceleration correction |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
435 |
|
42 | 436 |
$ID = $PROF = $STN = &antsCardArg(); # station id ($STN for compatibility) |
437 |
if (@ARGV) { # run label |
|
438 |
$RUN = $ARGV[0]; |
|
439 |
shift; |
|
440 |
} else { |
|
441 |
$RUN = 'profiles'; |
|
442 |
} |
|
0 | 443 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
444 |
#---------------------------------------------------------------- |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
445 |
# Handle Processing Parameters |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
446 |
# - paths need to be read first to define ProcessingParams file |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
447 |
# and output directories |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
448 |
# - processing params file is read next to allow setting |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
449 |
# plotting_level |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
450 |
# - default_output.pl is read finally to set any missing output |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
451 |
# variables to default values |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
452 |
#---------------------------------------------------------------- |
42 | 453 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
454 |
require "$WCALC/default_paths.pl"; # define default input/output paths |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
455 |
my($retval) = do $processing_param_file; # load processing parameters |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
456 |
if (!defined($retval) && $@ ne '') { |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
457 |
croak("$processing_param_file: $@\n"); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
458 |
} elsif (!defined($retval) && $! != 0) { |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
459 |
croak("$processing_param_file: $!\n"); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
460 |
} |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
461 |
require "$WCALC/default_output.pl"; # set default output plots and files |
34 | 462 |
|
463 |
$processing_options = "-k $opt_k -o $opt_o -c $opt_c -t $opt_t -e $opt_e -g $opt_g -3 $opt_3"; |
|
42 | 464 |
$processing_options .= ' -l' if defined($opt_l); |
49 | 465 |
|
466 |
if (defined($opt_q)) { # quick-and-dirty |
|
467 |
$processing_options .= ' -q'; |
|
468 |
$opt_l = 1; # disable time-lagging filter |
|
469 |
} |
|
470 |
||
471 |
if (defined($opt_i)) { # set initial time lag |
|
472 |
$processing_options .= " -i $opt_i"; |
|
473 |
$initial_time_lag = &antsFloatOpt($opt_i); |
|
474 |
} |
|
0 | 475 |
|
34 | 476 |
if (defined($opt_x)) { # eval cmd-line expression to override anything |
477 |
$processing_options .= " -x $opt_x"; |
|
478 |
eval($opt_x); |
|
479 |
} |
|
480 |
||
481 |
if ($opt_4) { # disallow 3-beam solutions |
|
482 |
$processing_options .= " -4"; |
|
483 |
$RDI_Coords::minValidVels = 4; |
|
484 |
} |
|
48 | 485 |
|
49 | 486 |
if ($opt_d) { # disable bin mapping |
48 | 487 |
$processing_options .= ' -d'; |
488 |
$RDI_Coords::binMapping = 'none'; |
|
489 |
} |
|
34 | 490 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
491 |
if (defined($opt_r)) { # residuals filters |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
492 |
$processing_options .= " -r $opt_r"; |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
493 |
($residuals_rms_max,$residuals_delta_max) = split(',',$opt_r); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
494 |
croak("$0: cannot decode -r $opt_r\n") unless ($residuals_rms_max > 0); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
495 |
} |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
496 |
|
34 | 497 |
($LADCP_firstBin,$LADCP_lastBin) = split(',',$opt_b); # select valid bins |
13 | 498 |
croak("$0: cannot decode -b $opt_b\n") |
499 |
unless (numberp($LADCP_firstBin) && |
|
500 |
($LADCP_lastBin eq '*' || numberp($LADCP_lastBin))); |
|
34 | 501 |
$processing_options .= " -b $opt_b"; |
502 |
||
503 |
$outGrid_firstBin = $LADCP_firstBin if ($outGrid_firstBin eq '*'); # default bins to use in gridded output |
|
504 |
$outGrid_lastBin = $LADCP_lastBin if ($outGrid_lastBin eq '*'); # NB: can still be '*'!!! |
|
505 |
||
13 | 506 |
@number_of_timelag_windows = split(',',$opt_n); |
507 |
croak("$0: cannot decode -n $opt_n\n") |
|
508 |
unless numberp($number_of_timelag_windows[0]) && numberp($number_of_timelag_windows[1]); |
|
34 | 509 |
$processing_options .= " -n $opt_n"; |
13 | 510 |
@length_of_timelag_windows = split(',',$opt_w); |
511 |
croak("$0: cannot decode -w $opt_w\n") |
|
512 |
unless numberp($length_of_timelag_windows[0]) && numberp($length_of_timelag_windows[1]); |
|
34 | 513 |
$processing_options .= " -w $opt_w"; |
13 | 514 |
|
42 | 515 |
croak("$0: \$out_basename undefined\n") # plotting routines use this to label the plots |
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 |
unless defined($out_basename); |
49 | 517 |
#&antsAddParams('RDI_Coords::binMapping',$RDI_Coords::binMapping); # must be set below since binmapping depends on coords |
34 | 518 |
&antsAddParams('processing_options',$processing_options); |
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 |
&antsAddParams('out_basename',$out_basename); |
29 | 520 |
&antsAddParams('profile_id',$PROF,'run_label',$RUN); |
0 | 521 |
|
522 |
#---------------------------------------------------------------------- |
|
523 |
# Screen Logging |
|
524 |
# - warning levels: |
|
525 |
# 0 probably unimportant, e.g. nonsensical parameters that probably won't affect solution |
|
526 |
# 1 may be somewhat important |
|
527 |
# 2 important |
|
528 |
#---------------------------------------------------------------------- |
|
529 |
||
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
530 |
open(LOGF,">$out_log") || croak("$out_log: $!\n") |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
531 |
if defined($out_log); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
532 |
LOGF->autoflush(1); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
533 |
|
0 | 534 |
sub progress(@) |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
535 |
{ |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
536 |
printf(LOGF @_) if defined($out_log); |
13 | 537 |
printf(STDERR @_) if ($opt_v > 1); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
538 |
} |
0 | 539 |
|
540 |
sub info(@) |
|
541 |
{ |
|
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
542 |
print(LOGF "\t"),printf(LOGF @_) if defined($out_log); |
29 | 543 |
printf(STDERR @_) if ($opt_v > 1); |
0 | 544 |
} |
545 |
||
546 |
sub warning(@) |
|
547 |
{ |
|
548 |
my($lvl,@msg) = @_; |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
549 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
550 |
if (defined($out_log)) { |
29 | 551 |
print(LOGF "\nWARNING (L$lvl): "); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
552 |
printf(LOGF @msg); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
553 |
print(LOGF "\n"); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
554 |
} |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
555 |
return if ($opt_v == 0) || ($lvl == 0); |
29 | 556 |
|
557 |
if ($opt_v == 1) { |
|
39 | 558 |
print(STDERR "$LADCP_file: ") if defined($LADCP_file); |
559 |
print(STDERR "WARNING (L$lvl): "); |
|
29 | 560 |
printf(STDERR @msg); |
561 |
} else { |
|
562 |
print(STDERR "\n-------------\nWARNING (L$lvl): "); |
|
563 |
printf(STDERR @msg); |
|
564 |
print(STDERR "-------------\n\n") |
|
565 |
} |
|
0 | 566 |
} |
567 |
||
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
568 |
sub error($) |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
569 |
{ |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
570 |
print(LOGF "ABORT: @_") if defined($out_log); |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
571 |
croak("ABORT: @_"); |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
572 |
} |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
573 |
|
0 | 574 |
sub debugmsg(@) |
13 | 575 |
{ printf(STDERR @_) if ($opt_v > 2); } |
0 | 576 |
|
40 | 577 |
#--------------------------- |
0 | 578 |
# Read LADCP data |
40 | 579 |
# |
580 |
# sanity checks: |
|
581 |
# - single-ping ensembles |
|
582 |
# |
|
583 |
# warnings: |
|
584 |
# - high bandwidth |
|
585 |
# - low transmit power |
|
586 |
#--------------------------- |
|
0 | 587 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
588 |
progress("Reading LADCP data from <$LADCP_file>...\n"); |
51
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
589 |
error("cannot open <$LADCP_file> for reading\n") |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
590 |
unless (-r $LADCP_file); |
0 | 591 |
readData($LADCP_file,\%LADCP); |
49 | 592 |
&antsAddDeps($LADCP_file); |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
593 |
if ($LADCP{BEAM_COORDINATES}) { |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
594 |
progress("\t%d ensembles (beam coordinates)\n",scalar(@{$LADCP{ENSEMBLE}})); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
595 |
} else { |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
596 |
progress("\t%d ensembles (Earth coordinates)\n",scalar(@{$LADCP{ENSEMBLE}})); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
597 |
} |
0 | 598 |
|
49 | 599 |
if ($valid_ensemble_range[0] > 0) { # remove leading invalid records |
600 |
my($ens) = 0; |
|
601 |
while ($ens < @{$LADCP{ENSEMBLE}} && $LADCP{ENSEMBLE}[$ens]->{NUMBER}<$valid_ensemble_range[0]) { $ens++ } |
|
602 |
splice(@{$LADCP{ENSEMBLE}},0,$ens); |
|
603 |
progress("\t%d invalid leading ensembles removed\n",$ens) |
|
604 |
} |
|
605 |
if ($valid_ensemble_range[1] > 0) { # remove trailing invalid records |
|
606 |
my($ens) = 0; |
|
607 |
while ($ens < @{$LADCP{ENSEMBLE}} && $LADCP{ENSEMBLE}[$ens]->{NUMBER}<$valid_ensemble_range[1]) { $ens++ } |
|
608 |
splice(@{$LADCP{ENSEMBLE}},$ens); |
|
609 |
progress("\t%d invalid trailing ensembles removed\n",@{$LADCP{ENSEMBLE}}-$ens) |
|
610 |
} |
|
611 |
||
40 | 612 |
error("$LADCP_file: cannot process multi-ping ensembles\n") |
613 |
unless ($LADCP{PINGS_PER_ENSEMBLE} == 1); |
|
614 |
warning(2,"$LADCP_file: wide-bandwidth setting\n") |
|
615 |
if ($LADCP{WIDE_BANDWIDTH}); |
|
616 |
warning(2,"$LADCP_file: low transmit-power setting\n") |
|
617 |
unless ($LADCP{TRANSMIT_POWER_HIGH}); |
|
618 |
||
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
619 |
error("$LADCP_file: not enough LADCP bins ($LADCP{N_BINS}) for choice of -r\n") |
0 | 620 |
unless ($LADCP{N_BINS} >= $refLr_lastBin); |
621 |
||
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
622 |
error("$0: first reference-layer bin outside valid range\n") |
0 | 623 |
unless ($refLr_firstBin>=1 && $refLr_firstBin<=$LADCP{N_BINS}); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
624 |
error("$0: last reference-layer bin outside valid range\n") |
0 | 625 |
unless ($refLr_lastBin>=1 && $refLr_lastBin<=$LADCP{N_BINS}); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
626 |
error("$0: first reference-layer bin > last reference-layer bin\n") |
0 | 627 |
unless ($refLr_firstBin <= $refLr_lastBin); |
34 | 628 |
&antsAddParams('refLr_firstBin',$refLr_firstBin,'refLr_lastBin',$refLr_lastBin); |
0 | 629 |
|
34 | 630 |
$LADCP_lastBin = $LADCP{N_BINS} if ($LADCP_lastBin eq '*'); |
631 |
$outGrid_lastBin = $LADCP{N_BINS} if ($outGrid_lastBin eq '*'); |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
632 |
error("$0: first valid LADCP bin outside valid range\n") |
0 | 633 |
unless ($LADCP_firstBin>=1 && $LADCP_firstBin<=$LADCP{N_BINS}); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
634 |
error("$0: last valid LADCP bin outside valid range\n") |
0 | 635 |
unless ($LADCP_lastBin>=1 && $LADCP_lastBin<=$LADCP{N_BINS}); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
636 |
error("$0: first valid LADCP bin > last valid LADCP bin\n") |
0 | 637 |
unless ($LADCP_firstBin <= $LADCP_lastBin); |
34 | 638 |
&antsAddParams('LADCP_firstBin',$LADCP_firstBin,'LADCP_lastBin',$LADCP_lastBin); |
0 | 639 |
|
640 |
warning(0,"first reference-layer bin < first valid LADCP bin\n") |
|
641 |
unless ($refLr_firstBin >= $LADCP_firstBin); |
|
642 |
warning(0,"last reference-layer bin > last valid LADCP bin\n") |
|
643 |
unless ($refLr_lastBin <= $LADCP_lastBin); |
|
644 |
||
645 |
warning(1,"if at all, bin 1 should not be used for short blank-after-transmit values\n") |
|
646 |
if ($LADCP{BLANKING_DISTANCE}<$LADCP{BIN_LENGTH} && $refLr_firstBin==1); |
|
647 |
||
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
648 |
&antsAddParams('ADCP_bin_length',$LADCP{BIN_LENGTH}, |
29 | 649 |
'ADCP_pulse_length',$LADCP{TRANSMITTED_PULSE_LENGTH}, |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
650 |
'ADCP_frequency',$LADCP{BEAM_FREQUENCY}, |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
651 |
'ADCP_blanking_distance',$LADCP{BLANKING_DISTANCE}); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
652 |
|
49 | 653 |
|
0 | 654 |
#------------------------------------------------------------ |
49 | 655 |
# Edit velocity data |
656 |
# beam coords: |
|
657 |
# 1) beam-vel mask on -m |
|
658 |
# mask file has three columns: from_ens to_ens ignore_beam |
|
659 |
# 2) correlation threshold |
|
660 |
# Earth coords: |
|
661 |
# 1) correlation threshold |
|
0 | 662 |
#------------------------------------------------------------ |
663 |
||
664 |
if ($LADCP{BEAM_COORDINATES}) { |
|
665 |
progress("Editing beam-velocity data...\n"); |
|
13 | 666 |
|
667 |
if (defined($opt_m) && -r $opt_m) { |
|
668 |
progress("\tmasking beam velocities according to $opt_m:"); |
|
669 |
||
670 |
my($nee) = 0; |
|
671 |
open(BVM,$opt_m) || die("$opt_m: $!\n"); |
|
672 |
while (<BVM>) { |
|
673 |
s/#.*//; |
|
674 |
s/^\s*$//; |
|
675 |
next if ($_ eq ''); |
|
676 |
my($fe,$te,$db) = split; |
|
677 |
die("$opt_m: cannot decode $_\n") |
|
678 |
unless (numberp($fe) && numberp($te) && $te>=$fe && $db>=1 && $db<=4); |
|
679 |
die("$0: assertion failed") |
|
680 |
unless ($LADCP{ENSEMBLE}[$fe-1]->{NUMBER} == $fe && |
|
681 |
$LADCP{ENSEMBLE}[$te-1]->{NUMBER} == $te); |
|
682 |
for (my($ens)=$fe-1; $ens<=$te-1; $ens++) { |
|
683 |
$nee++; |
|
684 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
685 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$db-1]); |
|
686 |
} |
|
687 |
} |
|
688 |
} |
|
42 | 689 |
progress(" $nee ensembles edited\n"); |
13 | 690 |
close(BVM); |
691 |
} |
|
692 |
||
0 | 693 |
$nvv = $cte = 0; |
34 | 694 |
|
695 |
if ($pitch_bias || $roll_bias || $heading_bias) { |
|
696 |
&antsAddParams('pitch_bias',$pitch_bias, |
|
697 |
'roll_bias',$roll_bias, |
|
698 |
'heading_bias',$heading_bias); |
|
699 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
700 |
correctAttitude($ens,$pitch_bias,$roll_bias,$heading_bias); |
|
701 |
} |
|
702 |
} |
|
0 | 703 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
704 |
$nvv += countValidBeamVels($ens); |
|
13 | 705 |
$cte += editCorr($ens,$opt_c); |
0 | 706 |
} |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
707 |
error("$LADCP_file: no valid data\n") unless ($nvv > 0); |
13 | 708 |
progress("\tcorrelation threshold (-c %d counts): %d velocites removed (%d%% of total)\n",$opt_c,$cte,round(100*$cte/$nvv)); |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
709 |
} else { # if BEAM_COORDINATES |
0 | 710 |
progress("Editing velocity data...\n"); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
711 |
error("$LADCP_file: cannot apply beamvel-mask $opt_m to earth-coordinate data\n") |
13 | 712 |
if defined($opt_m); |
0 | 713 |
$nvv = $cte = 0; |
714 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
715 |
$nvv += countValidBeamVels($ens); |
|
13 | 716 |
$cte += editCorr_Earthcoords($ens,$opt_c); |
0 | 717 |
} |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
718 |
error("$LADCP_file: no valid data\n") unless ($nvv > 0); |
13 | 719 |
progress("\tcorrelation threshold (-c %d counts): %d velocites removed (%d%% of total)\n",$opt_c,$cte,round(100*$cte/$nvv)); |
0 | 720 |
} |
721 |
||
49 | 722 |
#------------------------------------------------------------ |
723 |
# Create beam coordinate velocities for Earth-velocity data |
|
724 |
# - velocities are replaced "in place" |
|
725 |
# - BT velocities are treated separately in [find_seabed.pl] |
|
726 |
# - this transformation will remove all 3-beam solutions |
|
727 |
# - disable bin mapping because Earth coords are typically bin-remapped |
|
728 |
#------------------------------------------------------------ |
|
729 |
||
730 |
unless ($LADCP{BEAM_COORDINATES}) { |
|
731 |
progress("Replacing earth- with beam-velocities...\n"); |
|
732 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
733 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
734 |
@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]} = |
|
735 |
&velEarthToBeam(\%LADCP,$ens,@{$LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin]}); |
|
736 |
} |
|
737 |
} |
|
738 |
$RDI_Coords::binMapping = 'none'; |
|
739 |
} |
|
740 |
||
51
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
741 |
&antsAddParams('RDI_Coords::binMapping', $RDI_Coords::binMapping, # finally, bin mapping is known |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
742 |
'RDI_Coords::minValidVels', $RDI_Coords::minValidVels, |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
743 |
'RDI_Coords::beamTransformation',$RDI_Coords::beamTransformation); |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
744 |
|
49 | 745 |
|
0 | 746 |
#------------------------------------------------------------------- |
747 |
# Calculate earth velocities |
|
748 |
# - this is done for all bins (not just valid ones), to allow |
|
749 |
# useless possibility that invalid bins are used for reflr calcs |
|
750 |
# - also calculate separate beam-pair velocities |
|
751 |
# - the UNEDITED velocities are saved for the BT calculations |
|
752 |
# (W is required, U & V are only used for stats that have not |
|
753 |
# been very useful so far) |
|
754 |
#------------------------------------------------------------------- |
|
755 |
||
49 | 756 |
my($dummy); |
757 |
progress("Calculating earth-coordinate velocities...\n"); |
|
758 |
if ($bad_beam) { |
|
759 |
progress("\tdiscarding velocities from beam $bad_beam\n"); |
|
760 |
&antsAddParams('bad_beam_discarded',$bad_beam); |
|
761 |
} |
|
762 |
$nvw = 0; |
|
763 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
764 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH} = |
|
765 |
gimbal_pitch($LADCP{ENSEMBLE}[$ens]->{PITCH},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
766 |
|
49 | 767 |
if ($bad_beam) { |
768 |
for (my($bin)=0; $bin<=$LADCP{N_BINS}-1; $bin++) { |
|
769 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$bad_beam-1]); |
|
770 |
undef($LADCP{ENSEMBLE}[$ens]->{BT_VELOCITY}[$bin][$bad_beam-1]); |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
771 |
} |
49 | 772 |
} |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
773 |
|
49 | 774 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
775 |
($LADCP{ENSEMBLE}[$ens]->{INTERP_U}[$bin], |
|
776 |
$LADCP{ENSEMBLE}[$ens]->{INTERP_V}[$bin], |
|
777 |
$LADCP{ENSEMBLE}[$ens]->{INTERP_W}[$bin], |
|
778 |
$LADCP{ENSEMBLE}[$ens]->{INTERP_ERRVEL}[$bin]) = earthVels(\%LADCP,$ens,$bin); |
|
779 |
($LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{W12}[$bin], |
|
780 |
$LADCP{ENSEMBLE}[$ens]->{V34}[$bin],$LADCP{ENSEMBLE}[$ens]->{W34}[$bin]) = BPEarthVels(\%LADCP,$ens,$bin); |
|
781 |
} |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
782 |
|
49 | 783 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
784 |
$LADCP{ENSEMBLE}[$ens]->{U}[$bin] = $LADCP{ENSEMBLE}[$ens]->{INTERP_U}[$bin]; |
|
785 |
$LADCP{ENSEMBLE}[$ens]->{V}[$bin] = $LADCP{ENSEMBLE}[$ens]->{INTERP_V}[$bin]; |
|
786 |
$LADCP{ENSEMBLE}[$ens]->{W}[$bin] = $LADCP{ENSEMBLE}[$ens]->{INTERP_W}[$bin]; |
|
787 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin] = $LADCP{ENSEMBLE}[$ens]->{INTERP_ERRVEL}[$bin]; |
|
788 |
undef($LADCP{ENSEMBLE}[$ens]->{INTERP_U}[$bin]); |
|
789 |
undef($LADCP{ENSEMBLE}[$ens]->{INTERP_V}[$bin]); |
|
790 |
undef($LADCP{ENSEMBLE}[$ens]->{INTERP_W}[$bin]); |
|
791 |
undef($LADCP{ENSEMBLE}[$ens]->{INTERP_ERRVEL}[$bin]); |
|
792 |
||
793 |
if (defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin])) { |
|
794 |
$per_bin_nsamp[$bin]++; |
|
795 |
$nvw++; |
|
0 | 796 |
} |
49 | 797 |
|
798 |
$LADCP{ENSEMBLE}[$ens]->{U_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{U}[$bin]; |
|
799 |
$LADCP{ENSEMBLE}[$ens]->{V_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{V}[$bin]; |
|
800 |
$LADCP{ENSEMBLE}[$ens]->{W_UNEDITED}[$bin] = $LADCP{ENSEMBLE}[$ens]->{W}[$bin]; |
|
0 | 801 |
} |
802 |
} |
|
49 | 803 |
progress("\t$nvw valid velocities in bins $LADCP_firstBin-$LADCP_lastBin\n"); |
804 |
progress("\t3-beam solutions : $RDI_Coords::threeBeam_1 " . |
|
805 |
"$RDI_Coords::threeBeam_2 " . |
|
806 |
"$RDI_Coords::threeBeam_3 " . |
|
807 |
"$RDI_Coords::threeBeam_4\n") |
|
808 |
unless ($opt_4); |
|
0 | 809 |
|
29 | 810 |
error("$LADCP_file: insufficient valid velocities\n") unless ($nvw >= $min_valid_vels); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
811 |
|
0 | 812 |
#---------------------------------------------- |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
813 |
# STEP: Edit earth-coordinate -velocity data |
0 | 814 |
# 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
|
815 |
# 2) vertical-velocity outliers |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
816 |
# 3) truncate range by deleting farthest valid velocities (disbled by default) |
0 | 817 |
#---------------------------------------------- |
818 |
||
819 |
progress("Editing earth-coordinate velocity data...\n"); |
|
820 |
||
34 | 821 |
&antsAddParams('per_ens_outliers_mad_limit',$per_ens_outliers_mad_limit) |
822 |
&antsAddParams('farthest_valid_bins_truncated',$truncate_farthest_valid_bins) |
|
823 |
if ($truncate_farthest_valid_bins); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
824 |
$evrm = $trrm = $worm = 0; |
0 | 825 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
13 | 826 |
$evrm += editErrVel($ens,$opt_e); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
827 |
$worm += editWOutliers($ens,$per_ens_outliers_mad_limit); |
34 | 828 |
$trrm += editTruncRange($ens,$truncate_farthest_valid_bins) if ($truncate_farthest_valid_bins); |
0 | 829 |
} |
13 | 830 |
progress("\terror-velocity threshold (-e %.2f m/s): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
831 |
$opt_e,$evrm,round(100*$evrm/$nvw)); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
832 |
progress("\tvertical-velocity outliers ($per_ens_outliers_mad_limit x mad): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
833 |
$worm,round(100*$worm/$nvw)); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
834 |
progress("\trange truncation (-z %d bins): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
835 |
$truncate_farthest_valid_bins,$trrm,round(100*$trrm/$nvw)) |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
836 |
if ($truncate_farthest_valid_bins > 0); |
0 | 837 |
|
838 |
#---------------------------- |
|
839 |
# Calculate LADCP time series |
|
840 |
#---------------------------- |
|
841 |
||
842 |
progress("Calculating LADCP time-series...\n"); |
|
843 |
||
844 |
($firstGoodEns,$lastGoodEns,$LADCP_atbottom,$LADCP_w_gap_time) = |
|
13 | 845 |
calcLADCPts(\%LADCP,$opt_s,$refLr_firstBin,$refLr_lastBin,$opt_g); |
29 | 846 |
error("$LADCP_file: insufficient valid data\n") |
847 |
unless defined($firstGoodEns) && ($lastGoodEns>$firstGoodEns) && ($LADCP_atbottom>=$firstGoodEns); |
|
0 | 848 |
|
849 |
my($cast_duration) = $LADCP{ENSEMBLE}[$lastGoodEns]->{ELAPSED} - |
|
850 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{ELAPSED}; |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
851 |
error("$0: implausibly short cast ($cast_duration seconds)\n") |
0 | 852 |
unless ($cast_duration > 600); |
853 |
||
29 | 854 |
my($year) = $LADCP{ENSEMBLE}[$firstGoodEns]->{YEAR} % 100; |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
855 |
&antsAddParams(sprintf('dn%02d',$year),$LADCP{ENSEMBLE}[$firstGoodEns]->{DAYNO}); |
29 | 856 |
|
0 | 857 |
$LADCP{MEAN_DT} = $cast_duration / ($lastGoodEns-$firstGoodEns-1); |
858 |
||
859 |
progress("\tStart of cast : %s (#%5d)\n", |
|
860 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{TIME}, |
|
861 |
$LADCP{ENSEMBLE}[$firstGoodEns]->{NUMBER}); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
862 |
progress("\tBottom of cast : %s (#%5d) @ dz=%6dm\n", |
0 | 863 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{TIME}, |
864 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{NUMBER}, |
|
865 |
$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
|
866 |
progress("\tEnd of cast : %s (#%5d) @ dz=%6dm\n", |
0 | 867 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{TIME}, |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
868 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{NUMBER}, |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
869 |
$LADCP{ENSEMBLE}[$lastGoodEns]->{DEPTH}); |
0 | 870 |
progress("\tCast duration : %.1f hours (pinging for %.1f hours)\n", |
871 |
$cast_duration / 3600, |
|
872 |
($LADCP{ENSEMBLE}[$#{$LADCP{ENSEMBLE}}]->{UNIX_TIME} - |
|
873 |
$LADCP{ENSEMBLE}[0]->{UNIX_TIME}) / 3600); |
|
874 |
progress("\tMean ping interval: %.1f seconds\n",$LADCP{MEAN_DT}); |
|
875 |
||
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
876 |
if (@out_LADCPtis) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
877 |
progress("Writing LADCP-timeseries to "); |
23 | 878 |
@antsNewLayout = ('ensemble','elapsed','reflr_w','reflr_w.stddev','reflr_w.nsamp','depth'); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
879 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
880 |
foreach my $of (@out_LADCP) { |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
881 |
progress("<$of> "); |
42 | 882 |
my($sub,$arg) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # sub(arg), e.g. plot_wprof(DL/003_wprof.ps) |
883 |
if (defined($arg)) { # NB: exactly one arg |
|
884 |
if (-f "./${sub}.pl") { # # NB: don't quote arg |
|
885 |
require "./${sub}.pl"; |
|
886 |
} else { |
|
887 |
require "$WCALC/${sub}.pl"; |
|
888 |
} |
|
889 |
&{$sub}($arg); |
|
30 | 890 |
next; |
891 |
} |
|
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
892 |
$of = ">$of" unless ($of =~ /^$|^\s*\|/); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
893 |
open(STDOUT,$of) || error("$of: $!\n"); |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
894 |
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
895 |
for (my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
896 |
&antsOut($LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
897 |
$LADCP{ENSEMBLE}[$ens]->{ELAPSED}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
898 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
899 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_STDDEV}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
900 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NSAMP}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
901 |
$LADCP{ENSEMBLE}[$ens]->{DEPTH}); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
902 |
} |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
903 |
&antsOut('EOF'); open(STDOUT,'>&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
|
904 |
} |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
905 |
progress("\n"); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
906 |
} |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
907 |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
908 |
error("deepest depth is at end of cast (no upcast data)\n") |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
909 |
if ($lastGoodEns-$LADCP_atbottom < 100); |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
910 |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
911 |
#---------------------------------------------------------------------- |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
912 |
# More editing |
49 | 913 |
# - attitude threshold |
914 |
# - data in far bins (beyond reliable range) |
|
915 |
# - at this stage ${first,last}GoodEns are known |
|
6 | 916 |
# - TILT field is set as a side-effect |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
917 |
#---------------------------------------------------------------------- |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
918 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
919 |
progress("Editing additional earth-coordinate velocity data...\n"); |
34 | 920 |
&antsAddParams('per_bin_valid_frac_lim',$per_bin_valid_frac_lim); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
921 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
922 |
my($first_bad_bin); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
923 |
for (my($bin)=$LADCP_firstBin-1; $bin<$LADCP_lastBin-1; $bin++) { |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
924 |
next unless ($per_bin_nsamp[$bin]/($lastGoodEns-$firstGoodEns) < $per_bin_valid_frac_lim); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
925 |
$first_bad_bin = $bin; |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
926 |
last; |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
927 |
} |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
928 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
929 |
my($dc_sumTilts,$dc_n,$uc_sumTilts,$uc_n) = (0,0,0,0); |
15 | 930 |
$fprm = $pte = 0; |
931 |
for ($ens=0; $ens<=$#{$LADCP{ENSEMBLE}}; $ens++) { |
|
41 | 932 |
my($ne) = editTilt($ens,$opt_t); |
933 |
if ($ne == 0) { |
|
934 |
if ($ens <= $LADCP_atbottom) { |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
935 |
$dc_sumTilts += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT}); |
41 | 936 |
$dc_n++; |
937 |
} else { |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
938 |
$uc_sumTilts += &SQR($LADCP{ENSEMBLE}[$ens]->{TILT}); |
41 | 939 |
$uc_n++; |
940 |
} |
|
941 |
} else { |
|
942 |
$pte += $ne; |
|
943 |
} |
|
15 | 944 |
$fprm += editFarBins($ens,$first_bad_bin) if defined($first_bad_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
|
945 |
} |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
946 |
my($dc_mean_tilt) = ($dc_n > 0) ? sqrt($dc_sumTilts/$dc_n) : nan; |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
947 |
my($uc_mean_tilt) = ($uc_n > 0) ? sqrt($uc_sumTilts/$uc_n) : nan; |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
948 |
&antsAddParams('dc_mean_tilt',$dc_mean_tilt,'uc_mean_tilt',$uc_mean_tilt); |
41 | 949 |
|
15 | 950 |
progress("\tattitude threshold (max_tilt = %d deg): %d velocites removed (%d%% of total)\n", |
951 |
$opt_t,$pte,round(100*$pte/$nvv)); |
|
952 |
progress("\tvelocities beyond bin $first_bad_bin (<%d%% valid values): %d velocites removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n", |
|
953 |
round(100*$per_bin_valid_frac_lim),$fprm,round(100*$fprm/$nvw)); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
954 |
|
49 | 955 |
#---------------------------------------------------------------------- |
0 | 956 |
# Read CTD data |
49 | 957 |
#---------------------------------------------------------------------- |
0 | 958 |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
959 |
progress("Reading CTD data from <$CTD_file>...\n"); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
960 |
open(STDIN,$CTD_file) || error("$CTD_file: $!\n"); |
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
961 |
error("$CTD_file: no data\n") unless (&antsIn()); |
2 | 962 |
undef($antsOldHeaders); |
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
963 |
|
49 | 964 |
&antsAddDeps($CTD_file); |
19 | 965 |
&antsAddParams('lat',$P{lat}) if defined($P{lat}); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
966 |
&antsAddParams('lon',$P{lon}) if defined($P{lon}); |
0 | 967 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
968 |
($CTD_elapsed,$CTD_depth,$CTD_svel) = &fnr('elapsed','depth','ss'); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
969 |
$CTD_w = &fnrNoErr('w_CTD'); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
970 |
$CTD_w = &fnr('w') unless defined($CTD_w); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
971 |
$CTD_winchvel = &fnrNoErr('w_winch'); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
972 |
$CTD_temp = &fnrNoErr('temp'); |
29 | 973 |
warning(0,"no CTD temperature --- using ADCP temperature instead => Sv degraded!\n",$s) |
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
974 |
unless defined($CTD_temp); |
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
975 |
|
0 | 976 |
$CTD_maxdepth = -1; |
13 | 977 |
do { # read data |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
978 |
error("$0: cannot deal with non-numeric CTD elapsed time\n") |
0 | 979 |
unless &antsNumbers($CTD_elapsed); |
980 |
push(@{$CTD{ELAPSED}},$ants_[0][$CTD_elapsed]); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
981 |
push(@{$CTD{DEPTH}}, $ants_[0][$CTD_depth]); |
0 | 982 |
push(@{$CTD{SVEL}}, $ants_[0][$CTD_svel]); |
983 |
push(@{$CTD{W}}, $ants_[0][$CTD_w]); |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
984 |
push(@{$CTD{TEMP}}, $ants_[0][$CTD_temp]) if defined($CTD_temp); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
985 |
push(@{$CTD{W_WINCH}},$ants_[0][$CTD_winchvel]) if defined($CTD_winchvel); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
986 |
if ($ants_[0][$CTD_depth] > $CTD_maxdepth) { |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
987 |
$CTD_maxdepth = $ants_[0][$CTD_depth]; |
0 | 988 |
$CTD_atbottom = $#{$CTD{DEPTH}}; |
989 |
} |
|
990 |
} while (&antsIn()); |
|
991 |
||
992 |
$CTD{DT} = ($CTD{ELAPSED}[$#{$CTD{ELAPSED}}] - $CTD{ELAPSED}[0]) / $#{$CTD{ELAPSED}}; |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
993 |
progress("\t%d scans at %.1fHz\n",scalar(@{$CTD{DEPTH}}),1/$CTD{DT}); |
0 | 994 |
|
13 | 995 |
$CTD{W_t}[0] = $CTD{W_t} [@{$CTD{ELAPSED}}] = nan; # calculate w-derivatives |
996 |
$CTD{W_tt}[0] = $CTD{W_tt}[@{$CTD{ELAPSED}}] = nan; |
|
997 |
for (my($s)=1; $s<@{$CTD{ELAPSED}}-1; $s++) { # centered differences for both |
|
998 |
$CTD{W_t} [$s] = ($CTD{W}[$s+1] - $CTD{W}[$s-1]) / (2*$CTD{DT}); |
|
41 | 999 |
$CTD{W_tt}[$s] = ($CTD{W}[$s+1] + $CTD{W}[$s-1] - 2*$CTD{W}[$s]) / &SQR($CTD{DT}); |
13 | 1000 |
} |
42 | 1001 |
$CTD_maxdepth = round($CTD_maxdepth); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
1002 |
error("$0: CTD start depth must be numeric\n") |
0 | 1003 |
unless numberp($CTD{DEPTH}[0]); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1004 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1005 |
progress("\tstart depth = %.1fm\n",$CTD{DEPTH}[0]); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1006 |
progress("\tmax depth = %dm (# $CTD_atbottom)\n",$CTD_maxdepth); |
0 | 1007 |
|
1008 |
#-------------------------------------------------------------------- |
|
1009 |
# Construct sound-speed correction profile from CTD 1Hz downcast data |
|
1010 |
# very simple algorithm that stores the last value found |
|
1011 |
# in each 1m bin |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1012 |
# For PPI filtering, a sound speed profile without gaps is required. |
0 | 1013 |
#-------------------------------------------------------------------- |
1014 |
||
1015 |
progress("Constructing sound-speed correction profile\n"); |
|
1016 |
||
1017 |
my($scans_per_sec) = int(1/$CTD{DT}+0.5); |
|
15 | 1018 |
my($min_depth) = 9e99; |
0 | 1019 |
for (my($s)=0; $s<=$CTD_atbottom; $s+=$scans_per_sec) { |
1020 |
next unless ($CTD{DEPTH}[$s] >= 0 && numberp($CTD{SVEL}[$s])); |
|
19 | 1021 |
my($d) = int($CTD{DEPTH}[$s]); |
1022 |
$min_depth = $d if ($d < $min_depth); |
|
1023 |
$sVelProf[$d] = $CTD{SVEL}[$s]; |
|
0 | 1024 |
} |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1025 |
while ($min_depth > 0) { # fill surface gap |
15 | 1026 |
$sVelProf[$min_depth-1] = $sVelProf[$min_depth]; |
1027 |
$min_depth--; |
|
1028 |
} |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1029 |
for (my($d)=$min_depth+1; $d<=$#sVelProf; $d++) { # fill interior gaps |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1030 |
$sVelProf[$d] = $sVelProf[$d-1] |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1031 |
unless defined($sVelProf[$d]); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1032 |
} |
18 | 1033 |
|
0 | 1034 |
#------------------- |
1035 |
# Determine time lag |
|
1036 |
#------------------- |
|
1037 |
||
49 | 1038 |
if (defined($initial_time_lag)) { |
0 | 1039 |
progress("Setting initial time lag...\n"); |
49 | 1040 |
$CTD{TIME_LAG} = $initial_time_lag; |
0 | 1041 |
progress("\t-i => elapsed(CTD) ~ elapsed(LADCP) + %.1fs\n",$CTD{TIME_LAG}); |
1042 |
} else { |
|
1043 |
progress("Guestimating time lag...\n"); |
|
1044 |
||
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1045 |
my($CTD_10pct_down) = 0; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1046 |
my($LADCP_10pct_down) = $firstGoodEns; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1047 |
|
0 | 1048 |
$CTD_10pct_down++ |
1049 |
until ($CTD{DEPTH}[$CTD_10pct_down]-$CTD{DEPTH}[0] >= 0.1*($CTD_maxdepth-$CTD{DEPTH}[0])); |
|
1050 |
$LADCP_10pct_down++ |
|
1051 |
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
|
1052 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1053 |
$CTD{TIME_LAG} = |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1054 |
$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
|
1055 |
|
0 | 1056 |
progress("\telapsed(dz(CTD)=%.1fm) ~ elapsed(dz(LADCP)=%.1fm) + %.1fs\n", |
1057 |
$CTD{DEPTH}[$CTD_10pct_down]-$CTD{DEPTH}[0],$LADCP{ENSEMBLE}[$LADCP_10pct_down]->{DEPTH},$CTD{TIME_LAG}); |
|
1058 |
} |
|
1059 |
||
2 | 1060 |
if ($opt_u) { |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1061 |
progress("\tskipping time lagging (-u)\n"); |
48 | 1062 |
$CTD_time_lag[0] = $CTD{TIME_LAG}; |
1063 |
$CTD_tl_toEns[0] = $lastGoodEns; |
|
2 | 1064 |
} else { |
13 | 1065 |
|
1066 |
#------------------------ |
|
1067 |
# stage 1: 1Hz; full cast |
|
1068 |
#------------------------ |
|
1069 |
||
1070 |
$CTD{TIME_LAG} = |
|
1071 |
calc_lag($number_of_timelag_windows[0],$length_of_timelag_windows[0], |
|
1072 |
int(1/$CTD{DT}+0.5),$firstGoodEns,$lastGoodEns); |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
1073 |
error("$0: Cannot proceed without valid lag!\n") unless defined($CTD{TIME_LAG}); |
2 | 1074 |
progress("\telapsed(CTD) ~ elapsed(LADCP) + %.2fs\n",$CTD{TIME_LAG}); |
13 | 1075 |
|
1076 |
#--------------------------------- |
|
1077 |
# stage 2: piece-wise time lagging |
|
1078 |
#--------------------------------- |
|
1079 |
||
1080 |
my(@splits); |
|
1081 |
push(@splits,$firstGoodEns); |
|
1082 |
foreach my $s (split(/,/,$opt_p)) { |
|
1083 |
if ($s eq '+') { |
|
1084 |
push(@splits,$LADCP_atbottom); |
|
1085 |
} elsif (numberp($s)) { # find ens for given LADCP elapsed time in min |
|
1086 |
my($ela) = $s*60; |
|
1087 |
my($ens) = $firstGoodEns + round($ela / $LADCP{MEAN_DT}); # first, guess |
|
1088 |
while ($LADCP{ENSEMBLE}[$ens]->{ELAPSED} > $ela) { $ens--; } # then, correct |
|
1089 |
while ($LADCP{ENSEMBLE}[$ens]->{ELAPSED} < $ela) { $ens++; } |
|
1090 |
push(@splits,$ens); |
|
1091 |
} else { |
|
1092 |
warning(2,"ignoring non-numeric -p argument %s",$s); |
|
1093 |
} |
|
1094 |
} |
|
1095 |
push(@splits,$lastGoodEns); |
|
11 | 1096 |
|
13 | 1097 |
my($valid_lag); # determine piece-wise lags |
1098 |
while (@splits > 1) { |
|
1099 |
push(@CTD_tl_fromEns,$splits[0]); |
|
1100 |
push(@CTD_tl_toEns,$splits[1]); |
|
29 | 1101 |
debugmsg("lag($splits[0],$splits[1]) = "); |
13 | 1102 |
my($lag) = calc_lag($number_of_timelag_windows[1],$length_of_timelag_windows[1], |
1103 |
1,$splits[0],$splits[1]); |
|
29 | 1104 |
debugmsg("$lag\n"); |
13 | 1105 |
if (defined($lag)) { |
1106 |
progress("\tcast-piece: elapsed(CTD) = elapsed(LADCP) + %.2fs\n",$lag); |
|
1107 |
push(@CTD_time_lag,$lag); |
|
1108 |
$valid_lag = $#CTD_time_lag; |
|
1109 |
} else { |
|
1110 |
progress("\tcast-piece: time-lagging failed\n"); |
|
1111 |
push(@CTD_time_lag,nan); |
|
1112 |
} |
|
1113 |
shift(@splits); |
|
1114 |
} |
|
1115 |
||
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
1116 |
error("$0: Cannot proceed without at least one lag!\n") # fill failed lag with surrounding data |
13 | 1117 |
unless defined($valid_lag); |
1118 |
while ($valid_lag < $#CTD_time_lag) { # forward |
|
1119 |
$CTD_time_lag[$valid_lag+1] = $CTD_time_lag[$valid_lag]; |
|
1120 |
$valid_lag++; |
|
1121 |
} |
|
1122 |
while ($valid_lag > 0) { # backward |
|
1123 |
$CTD_time_lag[$valid_lag-1] = $CTD_time_lag[$valid_lag] |
|
1124 |
unless (numberp($CTD_time_lag[$valid_lag-1])); |
|
1125 |
$valid_lag--; |
|
1126 |
} |
|
2 | 1127 |
} |
0 | 1128 |
|
13 | 1129 |
&antsAddParams('CTD_time_lags',"@CTD_time_lag"); |
1130 |
undef($CTD{TIME_LAG}); # to avoid confusion, clear old 1Hz-based lag |
|
0 | 1131 |
|
1132 |
#------------------------------------------------ |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1133 |
# Merge (associate) CTD with LADCP data |
0 | 1134 |
# - after this step, reflr w is sound-speed corrected!!! |
1135 |
#------------------------------------------------ |
|
1136 |
||
1137 |
progress("Merging CTD with LADCP data...\n"); |
|
1138 |
||
34 | 1139 |
&antsAddParams('w_max_lim',$w_max_lim); |
1140 |
||
13 | 1141 |
my($cli) = 0; # current-lag index |
1142 |
my($lag) = $CTD_time_lag[$cli]; # current lag |
|
1143 |
||
42 | 1144 |
my($dc_sumsq,$dc_n,$uc_sumsq,$uc_n) = (0,0,0,0); # for a_pkg calcs |
0 | 1145 |
for (my($skipped)=0,my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
13 | 1146 |
|
1147 |
if ($ens > $CTD_tl_toEns[$cli]) { # use correct lag piece |
|
1148 |
$cli++; |
|
48 | 1149 |
die("assertion failed!\n\ttest: \$cli(=$cli) <= \$#CTD_time_lag(=$#CTD_time_lag) at ens=$ens\n") |
13 | 1150 |
unless ($cli <= $#CTD_time_lag); |
1151 |
$lag = $CTD_time_lag[$cli]; |
|
1152 |
} |
|
1153 |
||
1154 |
my($scan) = |
|
1155 |
int(($LADCP{ENSEMBLE}[$ens]->{ELAPSED} + $lag - $CTD{ELAPSED}[0]) / $CTD{DT} + 0.5); |
|
0 | 1156 |
if ($scan <= 0) { # NB: must be <=, rather than <, or assertion below sometimes fails |
1157 |
$skipped++; |
|
1158 |
$firstGoodEns = $ens+1; |
|
1159 |
next; |
|
1160 |
} |
|
1161 |
if ($skipped > 0) { |
|
13 | 1162 |
$firstGoodEns++,$skipped++,next # in gap |
2 | 1163 |
unless defined($LADCP{ENSEMBLE}[$firstGoodEns]->{REFLR_W}); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1164 |
info("\t$skipped initial LADCP ensembles skipped because CTD data begin with LADCP in water\n"); |
0 | 1165 |
$skipped = 0; |
1166 |
} |
|
1167 |
if ($scan > $#{$CTD{ELAPSED}}) { |
|
13 | 1168 |
while (!defined($LADCP{ENSEMBLE}[$ens-1]->{REFLR_W})) { $ens--; } # in gap |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1169 |
info(sprintf("\t%d final LADCP ensembles skipped because CTD data end with LADCP in water\n", |
0 | 1170 |
$lastGoodEns-$ens+1)); |
1171 |
$lastGoodEns = $ens-1; |
|
1172 |
last; |
|
1173 |
} |
|
1174 |
||
1175 |
$LADCP{ENSEMBLE}[$ens]->{CTD_ELAPSED} = $CTD{ELAPSED}[$scan]; # elapsed field for output |
|
1176 |
||
1177 |
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
|
1178 |
&& numberp($CTD{DEPTH}[$scan])) { |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1179 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_NOSSCORR} = $LADCP{ENSEMBLE}[$ens]->{REFLR_W}; |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1180 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W} *= # correct for sound-speed variations at source |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1181 |
$CTD{SVEL}[$scan] / $LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}; |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1182 |
error(sprintf("\n$0: negative depth (%.1fm) in CTD file at elapsed(CTD) = %.1fs\n", |
0 | 1183 |
$CTD{DEPTH}[$scan],$CTD{ELAPSED}[$scan])) |
1184 |
unless ($CTD{DEPTH}[$scan] >= 0); |
|
1185 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} = $CTD{DEPTH}[$scan]; |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1186 |
$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN} = $scan; # used for other CTD fields |
42 | 1187 |
if (numberp($CTD{W_t}[$scan])) { |
1188 |
if ($ens <= $LADCP_atbottom) { |
|
1189 |
$dc_sumsq += &SQR($CTD{W_t}[$scan]); $dc_n++; |
|
1190 |
} else { |
|
1191 |
$uc_sumsq += &SQR($CTD{W_t}[$scan]); $uc_n++; |
|
1192 |
} |
|
41 | 1193 |
} |
0 | 1194 |
my($reflr_ocean_w) = $LADCP{ENSEMBLE}[$ens]->{REFLR_W} - $CTD{W}[$scan]; |
13 | 1195 |
if (abs($reflr_ocean_w) <= $w_max_lim) { |
0 | 1196 |
$sumWsq += &SQR($reflr_ocean_w); |
1197 |
$nWsq++; |
|
1198 |
if ($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} > 100 && |
|
1199 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH} < $LADCP{ENSEMBLE}[$LADCP_atbottom]->{CTD_DEPTH}-100) { |
|
1200 |
$sumWsqI += &SQR($reflr_ocean_w); |
|
1201 |
$nWsqI++; |
|
1202 |
} |
|
1203 |
} else { |
|
1204 |
undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); # DON'T USE THIS ENSEMBLE LATER |
|
1205 |
} |
|
1206 |
} else{ |
|
1207 |
undef($LADCP{ENSEMBLE}[$ens]->{REFLR_W}); # don't output in time-series file |
|
10
7e76fdef8953
version prior to carrying out separate dc-/uc- time lagging
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
6
diff
changeset
|
1208 |
undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); # old DEPTH from calcLADCPts() must be removed |
0 | 1209 |
} |
1210 |
} |
|
41 | 1211 |
|
42 | 1212 |
my($dc_rms_apkg) = ($dc_n > 0) ? sqrt($dc_sumsq / $dc_n) : nan; # rms package acceleration |
1213 |
my($uc_rms_apkg) = ($uc_n > 0) ? sqrt($uc_sumsq / $uc_n) : nan; |
|
1214 |
&antsAddParams('dc_rms_accel_pkg',$dc_rms_apkg,'uc_rms_accel_pkg',$uc_rms_apkg); |
|
0 | 1215 |
|
1216 |
if ($nWsq > 0 && $nWsqI > 0) { |
|
1217 |
&antsAddParams('rms_w_reflr_err',sqrt($sumWsq/$nWsq),'rms_w_reflr_err_interior',sqrt($sumWsqI/$nWsqI)); |
|
1218 |
progress("\t%.2f cm/s rms reference-layer w_ocean, %.2f cm/s away from boundaries\n", |
|
1219 |
100*sqrt($sumWsq/$nWsq),100*sqrt($sumWsqI/$nWsqI)); |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1220 |
if (sqrt($sumWsqI/$nWsqI) > 0.05) { |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1221 |
warning(0,"%.2f cm/s (large) reference-layer w_ocean away from boundaries\n",100*sqrt($sumWsqI/$nWsqI)); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1222 |
} elsif (sqrt($sumWsqI/$nWsqI) > 0.15) { |
34 | 1223 |
warning(2,"%.2f cm/s (implausibly large) reference-layer w_ocean away from boundaries\n",100*sqrt($sumWsqI/$nWsqI)); |
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
1224 |
} |
0 | 1225 |
} elsif ($nWsq > 0) { |
1226 |
&antsAddParams('rms_w_reflr_err',sqrt($sumWsq/$nWsq),'rms_w_reflr_err_interior',nan); |
|
1227 |
progress("\t%.2f cm/s rms reference-layer w_ocean\n",100*sqrt($sumWsq/$nWsq)); |
|
1228 |
} else { |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
1229 |
error("$0: no valid vertical velocities\n"); |
0 | 1230 |
} |
1231 |
||
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1232 |
#---------------------------------------------------------------------- |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1233 |
# Calculate Volume Scattering Coefficients |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1234 |
#---------------------------------------------------------------------- |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1235 |
|
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
1236 |
progress("Calculating volume-scattering coefficients (Sv)...\n"); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1237 |
calc_backscatter_profs($firstGoodEns,$lastGoodEns); |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1238 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1239 |
if (defined($Sv_ref_bin) && @nSv) { |
34 | 1240 |
progress("\tapplying empirical Sv correction\n"); |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1241 |
&antsAddParams('Sv_correction','empirical'); |
34 | 1242 |
correct_backscatter($firstGoodEns,$lastGoodEns); |
1243 |
} |
|
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
1244 |
|
0 | 1245 |
#---------------------------------------------------------------------------- |
28
b07b23485336
after folding in EGU flight mods (empirical Sv correction)
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
27
diff
changeset
|
1246 |
# Find Seabed & Edit data |
15 | 1247 |
# 1) contaminated by sidelobe reflection from seabed and sea surface |
1248 |
# 2) PPI |
|
0 | 1249 |
#---------------------------------------------------------------------------- |
1250 |
||
49 | 1251 |
error("$0: conflicting water-depth information provided by user\n") # only happens when $water_depth is set explicitly |
1252 |
if defined($opt_h) && defined($water_depth); |
|
1253 |
||
1254 |
if (defined($opt_h)) { # handle user-provided water-depth info |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1255 |
if (numberp($opt_h)) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1256 |
$water_depth = $opt_h; |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1257 |
} elsif (-f $opt_h) { |
40 | 1258 |
open(WDF,$opt_h) || error("$opt_h: $_\n"); |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1259 |
$water_depth = &antsFileScanParam(WDF,'water_depth'); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1260 |
close(WDF); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1261 |
undef($water_depth) unless numberp($water_depth); |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1262 |
} else { |
40 | 1263 |
error("$0: -h $opt_h defines neither number nor existing file\n"); |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1264 |
} |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1265 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1266 |
|
42 | 1267 |
if (!defined($water_depth) && # find seabed in data |
1268 |
$LADCP{ENSEMBLE}[$LADCP_atbottom]->{XDUCER_FACING_DOWN}) { |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1269 |
progress("Finding seabed...\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1270 |
($water_depth,$sig_water_depth) = |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1271 |
find_backscatter_seabed($LADCP{ENSEMBLE}[$LADCP_atbottom]->{CTD_DEPTH}); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1272 |
($water_depth_BT,$sig_water_depth_BT) = |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1273 |
find_seabed(\%LADCP,$LADCP_atbottom,$LADCP{BEAM_COORDINATES}); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1274 |
if (defined($water_depth) && defined($water_depth_BT)) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1275 |
my($dd) = abs($water_depth_BT - $water_depth); |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1276 |
# warning(0,sprintf("Large instrument vs. backscatter-derived water-depth difference (%.1fm)\n",$dd)) |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1277 |
# if ($dd > 10); |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1278 |
} |
42 | 1279 |
if (!$SS_use_BT && !defined($water_depth) && defined($water_depth_BT)) { # warn if use of BT was not |
1280 |
warning(1,"using water_depth from ADCP BT data\n"); # explicitly requested |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1281 |
$SS_use_BT = 1; |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1282 |
} |
49 | 1283 |
if ($SS_use_BT && numberp($water_depth_BT)) { # water depth from BT data |
34 | 1284 |
&antsAddParams('water_depth_from','BT_data'); |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1285 |
$water_depth = $water_depth_BT; |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1286 |
$sig_water_depth = $sig_water_depth_BT; |
49 | 1287 |
} elsif (defined($water_depth)) { # water depth from WT data |
34 | 1288 |
&antsAddParams('water_depth_from','echo_amplitudes'); |
1289 |
} |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1290 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1291 |
|
42 | 1292 |
if (defined($water_depth)) { # 1 or 2 water depths available |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1293 |
if (defined($water_depth_BT)) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1294 |
progress("\t%.1f(%.1f) m water depth (%.1f(%.1f)m from ADCP BT data)\n", |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1295 |
$water_depth,$sig_water_depth,$water_depth_BT,$sig_water_depth_BT); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1296 |
} else { |
42 | 1297 |
progress("\t%.1f(%.1f) m water depth (no seabed found in BT data)\n", |
1298 |
$water_depth,$sig_water_depth); |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1299 |
} |
42 | 1300 |
warning(1,sprintf("large uncertainty in water-depth estimation (%.1fm)\n", |
1301 |
$sig_water_depth)) |
|
1302 |
if ($sig_water_depth > $LADCP{BIN_LENGTH}); |
|
1303 |
if ($water_depth < $CTD_maxdepth) { |
|
1304 |
warning(2,"water depth ($water_depth m) < max CTD depth ($CTD_maxdepth m) ignored\n"); |
|
1305 |
undef($water_depth); |
|
1306 |
} |
|
1307 |
} |
|
1308 |
||
49 | 1309 |
if (!defined($water_depth) && defined($water_depth_db_cmd)) { # set water depth from data base |
1310 |
error("$0: lat/lon required for running $water_depth_db_cmd\n") |
|
1311 |
unless numbersp($P{lat},$P{lon}); |
|
1312 |
chomp($water_depth = `$water_depth_db_cmd $P{lon} $P{lat}`); |
|
1313 |
error("$0: command '$water_depth_db_cmd $P{lon} $P{lat}' did not return valid water depth\n") |
|
1314 |
unless numberp($water_depth); |
|
1315 |
&antsAddParams('water_depth_from',"$water_depth_db_cmd $P{lon} $P{lat}"); |
|
1316 |
} |
|
1317 |
||
42 | 1318 |
if (defined($water_depth)) { # set %PARAMs |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1319 |
&antsAddParams('water_depth',$water_depth,'water_depth.sig',$sig_water_depth); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1320 |
} else { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1321 |
warning(2,"unknown water depth --- cannot edit sidelobes or PPI near the seabed\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1322 |
&antsAddParams('water_depth','unknown','water_depth.sig','nan'); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1323 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1324 |
|
42 | 1325 |
if ($LADCP{ENSEMBLE}[$LADCP_atbottom]->{XDUCER_FACING_DOWN}) { # DOWNLOOKER |
41 | 1326 |
&antsAddParams('ADCP_orientation','DL'); |
0 | 1327 |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1328 |
if (defined($water_depth)) { |
0 | 1329 |
progress("Editing data to remove sidelobe interference from seabed...\n"); |
1330 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,$water_depth); |
|
1331 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
|
1332 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1333 |
if ($sidelobe_editing_DL_surface) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1334 |
progress("Editing data to remove sidelobe interference from sea surface...\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1335 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,undef); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1336 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
34 | 1337 |
&antsAddParams('sidelobe_editing','surface+seabed','vessel_draft',$vessel_draft); |
1338 |
} else { |
|
1339 |
&antsAddParams('sidelobe_editing','seabed'); |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1340 |
} |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1341 |
|
49 | 1342 |
if (&PPI_seabed_editing_required()) { |
34 | 1343 |
&antsAddParams('PPI_editing','seabed'); |
1344 |
&antsAddParams('PPI_extend_upper_limit',$PPI_extend_upper_limit) |
|
1345 |
if numberp($PPI_extend_upper_limit); |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1346 |
progress("Editing data to remove PPI from seabed...\n"); |
48 | 1347 |
progress("\tConstructing depth-average soundspeed profile...\n"); |
1348 |
die("assertion failed") unless defined($water_depth); |
|
1349 |
my($dz) = $water_depth - $#sVelProf; # $#sVelProf = max_depth(profile) in meters |
|
1350 |
my($sum) = $dz * $sVelProf[$#sVelProf]; |
|
1351 |
if ($dz == 0) { # water-depth <= max CTD depth |
|
1352 |
warning(1,"inferred water depth very close to max(CTD depth)\n"); |
|
1353 |
$DASSprof[$#sVelProf] = $sVelProf[$#sVelProf]; |
|
1354 |
} else { |
|
1355 |
die("assertion failed") unless defined($dz > 0); |
|
1356 |
$DASSprof[$#sVelProf] = $sum/$dz; |
|
1357 |
} |
|
1358 |
for (my($d)=$#sVelProf-1; $d>=0; $d--) { |
|
1359 |
die("assertion failed (d=$d, #sVelProf=$#sVelProf)") unless numberp($sVelProf[$d]); |
|
1360 |
$sum += $sVelProf[$d]; |
|
19 | 1361 |
$dz++; |
1362 |
$DASSprof[$d] = $sum/$dz; |
|
48 | 1363 |
} |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1364 |
($nvrm,$nerm) = editPPI($firstGoodEns,$lastGoodEns,$water_depth); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1365 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1366 |
} |
0 | 1367 |
} |
1368 |
||
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1369 |
} else { # UPLOOKER |
41 | 1370 |
&antsAddParams('ADCP_orientation','UL'); |
15 | 1371 |
|
0 | 1372 |
progress("Editing data to remove sidelobe interference from sea surface...\n"); |
1373 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,undef); |
|
1374 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
|
15 | 1375 |
|
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1376 |
if ($sidelobe_editing_UL_seabed) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1377 |
if (defined($water_depth)) { |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1378 |
progress("Editing data to remove sidelobe interference from seabed...\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1379 |
($nvrm,$nerm) = editSideLobes($firstGoodEns,$lastGoodEns,$water_depth); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1380 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1381 |
} else { |
51
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
1382 |
# WARNING ALREADY PRODUCED ABOVE |
0f6d9e64cc4f
before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
49
diff
changeset
|
1383 |
# warning(2,"unknown water depth --- cannot edit UL data for sidelobe interference from seabed\n"); |
32
6041a20feb39
V1.0 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
31
diff
changeset
|
1384 |
} |
34 | 1385 |
&antsAddParams('sidelobe_editing','surface+seabed','vessel_draft',$vessel_draft); |
1386 |
} else { |
|
1387 |
&antsAddParams('sidelobe_editing','surface','vessel_draft',$vessel_draft); |
|
1388 |
} |
|
49 | 1389 |
if (&PPI_surface_editing_required()) { |
34 | 1390 |
&antsAddParams('PPI_editing','surface'); |
1391 |
&antsAddParams('PPI_extend_upper_limit',$PPI_extend_upper_limit) |
|
1392 |
if numberp($PPI_extend_upper_limit); |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1393 |
progress("Editing data to remove PPI from sea surface...\n"); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1394 |
progress("\tConstructing depth-average soundspeed profile...\n"); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1395 |
$DASSprof[0] = my($sum) = 0; |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1396 |
for (my($d)=1; $d<=$#sVelProf; $d++) { |
19 | 1397 |
die("assertion failed") unless numberp($sVelProf[$d]); |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1398 |
$sum += $sVelProf[$d]; |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1399 |
$DASSprof[$d] = $sum/$d; |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1400 |
} |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1401 |
($nvrm,$nerm) = editPPI($firstGoodEns,$lastGoodEns,undef); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1402 |
progress("\t$nvrm velocities from $nerm ensembles removed\n"); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
1403 |
} |
0 | 1404 |
} |
1405 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1406 |
#---------------------------------------------------------------------- |
49 | 1407 |
# Check For Ambiguity Velocity Problems |
1408 |
#---------------------------------------------------------------------- |
|
1409 |
||
1410 |
progress("Checking for ambiguity velocity violations...\n"); |
|
1411 |
||
1412 |
my($ambiguity_velocity) = ambiguity_velocity($LADCP{BEAM_FREQUENCY}, |
|
1413 |
$LADCP{BEAM_ANGLE}, |
|
1414 |
$LADCP{SPEED_OF_SOUND}, |
|
1415 |
$LADCP{TRANSMIT_LAG_DISTANCE}); |
|
1416 |
&antsAddParams('ambiguity_velocity',$ambiguity_velocity); |
|
1417 |
my($nbad) = 0; |
|
1418 |
for (my($ens)=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
|
1419 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
1420 |
next unless ($CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}] > $ambiguity_velocity); |
|
1421 |
$nbad++; |
|
1422 |
} |
|
1423 |
||
1424 |
my($badf) = $nbad / ($lastGoodEns - $firstGoodEns + 1); # fraction of bad values |
|
1425 |
if ($bad > 0.01) { # allow 1% violations before warning is triggered |
|
1426 |
warning(2,"%d ensembles (%d%% of total) have CTD_w > ambiguity velocity of %.1 m/s\n", |
|
1427 |
$nbad,round(100*$badf),$ambiguity_velocity); |
|
1428 |
} elsif ($nbad > 0) { |
|
1429 |
info("\t%d ensembles (%d%% of total) have CTD_w > ambiguity velocity of %.1 m/s", |
|
1430 |
$nbad,round(100*$badf),$ambiguity_velocity); |
|
1431 |
} else { |
|
1432 |
info("\tnone found\n"); |
|
1433 |
} |
|
1434 |
||
1435 |
#---------------------------------------------------------------------- |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1436 |
# 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
|
1437 |
# 1) surface layer editing |
49 | 1438 |
# 2) reference-layer horizontal velocity threshold |
1439 |
# 3) Execute user-supplied $edit_data_hook |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1440 |
#---------------------------------------------------------------------- |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1441 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1442 |
progress("Removing data from instrument at surface...\n"); |
34 | 1443 |
&antsAddParams('surface_layer_depth',$surface_layer_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
|
1444 |
$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
|
1445 |
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
|
1446 |
|
49 | 1447 |
progress("Removing data collected at large horizontal package speeds...\n"); |
1448 |
$max_hspeed = &max_hspeed(); # defined in [defaults.h] |
|
1449 |
&antsAddParams('max_hspeed',$max_hspeed); |
|
1450 |
$nerm = editLargeHSpeeds($firstGoodEns,$lastGoodEns,$max_hspeed); |
|
1451 |
my($nermf) = $nerm / ($lastGoodEns - $firstGoodEns + 1); |
|
1452 |
info("\treference-layer horizontal speed threshold (max_hspeed = %g m/s): %d ensembles removed (%d%% of total)\n", |
|
1453 |
$max_hspeed,$nerm,round(100*$nermf)); |
|
1454 |
warning(2,"large fraction (%d%%) of samples exceed reference-layer horizontal speed threshold\n",round(100*$nermf)) |
|
1455 |
if ($nermf > 0.05); |
|
1456 |
||
11 | 1457 |
if (defined($post_merge_hook)) { |
1458 |
progress("Executing user-supplied \$post_merge_hook...\n"); |
|
1459 |
&{$post_merge_hook}($firstGoodEns,$lastGoodEns); |
|
10
7e76fdef8953
version prior to carrying out separate dc-/uc- time lagging
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
6
diff
changeset
|
1460 |
} |
7e76fdef8953
version prior to carrying out separate dc-/uc- time lagging
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
6
diff
changeset
|
1461 |
|
13 | 1462 |
#---------------------------------------------------------------------- |
1463 |
# apply pressure-sensor acceleration correction (-a) |
|
1464 |
# - valid, but useless except for troubleshooting data sets (e.g. DIMES UK2) |
|
1465 |
# - useless, because ping-coherent error removal below does same job but better |
|
1466 |
# - it does not make sense to to use this with ping-coherent error removal enabled |
|
1467 |
#---------------------------------------------------------------------- |
|
1468 |
||
1469 |
if ($opt_a != 1) { |
|
1470 |
progress("Applying pressure-sensor acceleration correction...\n"); |
|
1471 |
for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
|
1472 |
next unless numberp($CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
1473 |
my($acorr) = $opt_a * $CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]; |
|
1474 |
if (numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH})) { |
|
1475 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
1476 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
1477 |
$LADCP{ENSEMBLE}[$ens]->{W}[$bin] -= $acorr; |
|
1478 |
} |
|
1479 |
} |
|
1480 |
if (numberp($LADCP{ENSEMBLE}[$ens]->{REFLR_W})) { |
|
1481 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W} -= $acorr; |
|
1482 |
} |
|
1483 |
} |
|
1484 |
} |
|
1485 |
||
0 | 1486 |
#--------------------------------------------------------------------------- |
1487 |
# Depth-bin LADCP velocity data |
|
1488 |
# |
|
1489 |
# NOTES: |
|
1490 |
# 1) ensemble and bin numbers are saved for maximum flexibility |
|
1491 |
# 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
|
1492 |
# 3) applying the full soundspeed correction to w is pointless in |
0 | 1493 |
# practice, but hey!, CPU cycles are cheap; [in a cast in the Gulf of Mexico |
1494 |
# which has fairly pronounce soundspeed gradients, the max value of Kn |
|
1495 |
# is 1.00004160558372, which gives rise to a correction of less than 0.2mm/s |
|
1496 |
# at a winch+wave speed of 3m/s....] |
|
1497 |
# 4) as far as I can tell, the soundspeed correction for bin length also |
|
1498 |
# has only a minute effect |
|
1499 |
#--------------------------------------------------------------------------- |
|
1500 |
||
13 | 1501 |
progress("Creating binned profiles at ${opt_o}m resolution...\n"); |
30 | 1502 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1503 |
&antsAddParams('outgrid_dz',$opt_o,'outgrid_minsamp',$opt_k); # used by LADCP_w_postproc |
30 | 1504 |
&antsAddParams('outgrid_firstbin',$outGrid_firstBin,'outgrid_lastbin',$outGrid_lastBin); |
0 | 1505 |
|
2 | 1506 |
my($min_depth) = 9e99; |
1507 |
my($max_depth) = 0; |
|
30 | 1508 |
local($realLastGoodEns); |
2 | 1509 |
|
0 | 1510 |
progress("\tdowncast...\n"); |
1511 |
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
|
1512 |
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
|
1513 |
$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
|
1514 |
next; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1515 |
} |
29 | 1516 |
$realLastGoodEns = $ens; |
46 | 1517 |
my(@bindepth) = binDepths($ens); |
0 | 1518 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
1519 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
30 | 1520 |
next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1); |
2 | 1521 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
1522 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
1523 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] = |
|
54 | 1524 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
0 | 1525 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1526 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
0 | 1527 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1528 |
$bindepth[$bin]); |
|
6 | 1529 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] = |
54 | 1530 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W12}[$bin], |
6 | 1531 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1532 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
6 | 1533 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1534 |
$bindepth[$bin]) |
|
1535 |
if numberp($LADCP{ENSEMBLE}[$ens]->{W12}[$bin]); |
|
1536 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] = |
|
54 | 1537 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W34}[$bin], |
6 | 1538 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1539 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
6 | 1540 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1541 |
$bindepth[$bin]) |
|
1542 |
if numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1543 |
$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
|
1544 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]; |
54 | 1545 |
$LADCP{ENSEMBLE}[$ens]->{V12}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND} |
1546 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1547 |
$LADCP{ENSEMBLE}[$ens]->{V34}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND} |
|
1548 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
13 | 1549 |
my($bi) = $bindepth[$bin]/$opt_o; |
0 | 1550 |
push(@{$DNCAST{ENSEMBLE}[$bi]},$ens); |
1551 |
push(@{$DNCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
1552 |
push(@{$DNCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
2 | 1553 |
push(@{$DNCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
54 | 1554 |
push(@{$DNCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]) |
1555 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1556 |
push(@{$DNCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]) |
|
1557 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
1558 |
push(@{$DNCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]) |
|
1559 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1560 |
push(@{$DNCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]) |
|
1561 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1562 |
push(@{$DNCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1563 |
push(@{$DNCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
0 | 1564 |
} |
1565 |
} |
|
1566 |
||
6 | 1567 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { # bin data into profile |
0 | 1568 |
$DNCAST{MEAN_DEPTH}[$bi] = avg(@{$DNCAST{DEPTH}[$bi]}); |
1569 |
$DNCAST{MEAN_ELAPSED}[$bi] = avg(@{$DNCAST{ELAPSED}[$bi]}); |
|
1570 |
$DNCAST{MEDIAN_W}[$bi] = median(@{$DNCAST{W}[$bi]}); |
|
13 | 1571 |
$DNCAST{MEDIAN_W12}[$bi] = median(@{$DNCAST{W12}[$bi]}); |
1572 |
$DNCAST{MEDIAN_W34}[$bi] = median(@{$DNCAST{W34}[$bi]}); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1573 |
$DNCAST{MEDIAN_V12}[$bi] = median(@{$DNCAST{V12}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1574 |
$DNCAST{MEDIAN_V34}[$bi] = median(@{$DNCAST{V34}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1575 |
$DNCAST{MEAN_PITCH}[$bi] = avg(@{$DNCAST{PITCH}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1576 |
$DNCAST{MEAN_ROLL}[$bi] = avg(@{$DNCAST{ROLL}[$bi]}); |
0 | 1577 |
$DNCAST{MAD_W}[$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{W}[$bi]}); |
1578 |
$DNCAST{N_SAMP}[$bi] = @{$DNCAST{W}[$bi]}; |
|
1579 |
} |
|
1580 |
||
2 | 1581 |
progress("\tupcast...\n"); # upcast |
0 | 1582 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1583 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { |
0 | 1584 |
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
|
1585 |
$realLastGoodEns = $ens; |
46 | 1586 |
my(@bindepth) = binDepths($ens); |
0 | 1587 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
1588 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
30 | 1589 |
next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1); |
2 | 1590 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
1591 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
1592 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] = |
|
54 | 1593 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W}[$bin], |
0 | 1594 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1595 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
0 | 1596 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1597 |
$bindepth[$bin]); |
|
6 | 1598 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] = |
54 | 1599 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W12}[$bin], |
6 | 1600 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1601 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
6 | 1602 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1603 |
$bindepth[$bin]) |
|
1604 |
if numberp($LADCP{ENSEMBLE}[$ens]->{W12}[$bin]); |
|
1605 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] = |
|
54 | 1606 |
sscorr_LADCP_w($LADCP{ENSEMBLE}[$ens]->{W34}[$bin], |
6 | 1607 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1608 |
$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND}, |
6 | 1609 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
1610 |
$bindepth[$bin]) |
|
1611 |
if numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
1612 |
$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
|
1613 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] + $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]; |
54 | 1614 |
$LADCP{ENSEMBLE}[$ens]->{V12}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND} |
1615 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1616 |
$LADCP{ENSEMBLE}[$ens]->{V34}[$bin] *= $CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]/$LADCP{ENSEMBLE}[$ens]->{SPEED_OF_SOUND} |
|
1617 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
13 | 1618 |
my($bi) = $bindepth[$bin]/$opt_o; |
0 | 1619 |
push(@{$UPCAST{ENSEMBLE}[$bi]},$ens); |
1620 |
push(@{$UPCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
1621 |
push(@{$UPCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
2 | 1622 |
push(@{$UPCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
54 | 1623 |
push(@{$UPCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]) |
1624 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1625 |
push(@{$UPCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]) |
|
1626 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
1627 |
push(@{$UPCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]) |
|
1628 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1629 |
push(@{$UPCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]) |
|
1630 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1631 |
push(@{$UPCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1632 |
push(@{$UPCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
0 | 1633 |
} |
1634 |
} |
|
1635 |
||
1636 |
for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) { |
|
1637 |
$UPCAST{MEAN_DEPTH}[$bi] = avg(@{$UPCAST{DEPTH}[$bi]}); |
|
1638 |
$UPCAST{MEAN_ELAPSED}[$bi] = avg(@{$UPCAST{ELAPSED}[$bi]}); |
|
1639 |
$UPCAST{MEDIAN_W}[$bi] = median(@{$UPCAST{W}[$bi]}); |
|
13 | 1640 |
$UPCAST{MEDIAN_W12}[$bi] = median(@{$UPCAST{W12}[$bi]}); |
1641 |
$UPCAST{MEDIAN_W34}[$bi] = median(@{$UPCAST{W34}[$bi]}); |
|
54 | 1642 |
$UPCAST{MEDIAN_V12}[$bi] = median(@{$UPCAST{V12}[$bi]}); |
1643 |
$UPCAST{MEDIAN_V34}[$bi] = median(@{$UPCAST{V34}[$bi]}); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1644 |
$UPCAST{MEAN_PITCH}[$bi] = avg(@{$UPCAST{PITCH}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1645 |
$UPCAST{MEAN_ROLL}[$bi] = avg(@{$UPCAST{ROLL}[$bi]}); |
0 | 1646 |
$UPCAST{MAD_W}[$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{W}[$bi]}); |
1647 |
$UPCAST{N_SAMP}[$bi] = @{$UPCAST{W}[$bi]}; |
|
1648 |
} |
|
1649 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1650 |
#------------------------------------------------------------------------------------------------------ |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1651 |
# remove ping-coherent residuals |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1652 |
# - potential error sources: |
13 | 1653 |
# 1) acceleration-dependence of Paroscientific pressure measurements; O(10cm/s) [IWISE 28] |
1654 |
# 2) residual CTD/LADCP mismatch errors; O(1cm/s) [Thurnherr, CWTMC 2011] |
|
1655 |
# 3) ADCP short-term variability; O(1cm/s) for vertical? |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1656 |
# - multiple sub-steps: |
13 | 1657 |
# - remove ensemble-median residual from all ocean vertical velocities |
1658 |
# - re-bin profiles |
|
1659 |
# - calculate new residuals |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1660 |
# - 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
|
1661 |
# 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
|
1662 |
#------------------------------------------------------------------------------------------------------ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1663 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1664 |
unless ($opt_q) { |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1665 |
progress("Subtracting ping-coherent residuals...\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
|
1666 |
|
13 | 1667 |
for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
1668 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
11 | 1669 |
|
13 | 1670 |
my(@residuals) = (); # calc median of residuals |
46 | 1671 |
my(@bindepth) = binDepths($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
|
1672 |
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
|
1673 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
30 | 1674 |
next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1); |
13 | 1675 |
my($bi) = $bindepth[$bin]/$opt_o; |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1676 |
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
|
1677 |
$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
|
1678 |
(($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
|
1679 |
: $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
|
1680 |
} |
13 | 1681 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} = median(@residuals); # NB: can be nan! |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1682 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W}); |
13 | 1683 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1684 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { # subtract from ocean velocities |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1685 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$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
|
1686 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] -= |
49 | 1687 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} |
1688 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
|
13 | 1689 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin] -= |
49 | 1690 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} |
1691 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
13 | 1692 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] -= |
49 | 1693 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} |
1694 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$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
|
1695 |
} |
13 | 1696 |
|
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1697 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W} -= # NB: this can be nan here |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1698 |
$LADCP{ENSEMBLE}[$ens]->{MEDIAN_RESIDUAL_W} |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1699 |
if numberp($LADCP{ENSEMBLE}[$ens]->{REFLR_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
|
1700 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1701 |
|
13 | 1702 |
#------------------------------------------------------------ |
1703 |
||
1704 |
progress("\tre-binning profile data...\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
|
1705 |
|
13 | 1706 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { # bin data |
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
1707 |
for (my($i)=0; $i<@{$DNCAST{W}[$bi]}; $i++) { # code works if MEDIAN_RESIDUAL_W is nan (possible?) |
49 | 1708 |
$DNCAST{W} [$bi][$i] -= $LADCP{ENSEMBLE}[$DNCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
1709 |
if numberp($DNCAST{W}[$bi][$i]); |
|
1710 |
$DNCAST{W12}[$bi][$i] -= $LADCP{ENSEMBLE}[$DNCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
|
1711 |
if numberp($DNCAST{W12}[$bi][$i]); |
|
1712 |
$DNCAST{W34}[$bi][$i] -= $LADCP{ENSEMBLE}[$DNCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
|
1713 |
if numberp($DNCAST{W34}[$bi][$i]); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1714 |
} |
49 | 1715 |
$DNCAST{MEDIAN_W} [$bi] = median(@{$DNCAST{W}[$bi]}) if numberp($DNCAST{MEDIAN_W} [$bi]); |
1716 |
$DNCAST{MEDIAN_W12}[$bi] = median(@{$DNCAST{W12}[$bi]}) if numberp($DNCAST{MEDIAN_W12}[$bi]); |
|
1717 |
$DNCAST{MEDIAN_W34}[$bi] = median(@{$DNCAST{W34}[$bi]}) if numberp($DNCAST{MEDIAN_W34}[$bi]); |
|
13 | 1718 |
$DNCAST{MAD_W} [$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{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
|
1719 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1720 |
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
|
1721 |
for (my($i)=0; $i<@{$UPCAST{W}[$bi]}; $i++) { |
49 | 1722 |
$UPCAST{W} [$bi][$i] -= $LADCP{ENSEMBLE}[$UPCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
1723 |
if numberp($UPCAST{W}[$bi][$i]); |
|
1724 |
$UPCAST{W12}[$bi][$i] -= $LADCP{ENSEMBLE}[$UPCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
|
1725 |
if numberp($UPCAST{W12}[$bi][$i]); |
|
1726 |
$UPCAST{W34}[$bi][$i] -= $LADCP{ENSEMBLE}[$UPCAST{ENSEMBLE}[$bi][$i]]->{MEDIAN_RESIDUAL_W} |
|
1727 |
if numberp($UPCAST{W34}[$bi][$i]); |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1728 |
} |
49 | 1729 |
$UPCAST{MEDIAN_W} [$bi] = median(@{$UPCAST{W}[$bi]}) if numberp($UPCAST{MEDIAN_W} [$bi]); |
1730 |
$UPCAST{MEDIAN_W12}[$bi] = median(@{$UPCAST{W12}[$bi]}) if numberp($UPCAST{MEDIAN_W12}[$bi]); |
|
1731 |
$UPCAST{MEDIAN_W34}[$bi] = median(@{$UPCAST{W34}[$bi]}) if numberp($UPCAST{MEDIAN_W34}[$bi]); |
|
13 | 1732 |
$UPCAST{MAD_W} [$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{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
|
1733 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1734 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
1735 |
} # unless ($opt_q); |
2 | 1736 |
|
42 | 1737 |
#---------------------------------------------------------------------- |
1738 |
# remove ensembles with large rms residuals |
|
1739 |
#---------------------------------------------------------------------- |
|
1740 |
||
49 | 1741 |
if (defined($opt_r) && !$opt_q) { |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1742 |
progress("Applying residuals filters...\n"); |
42 | 1743 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1744 |
progress("\trms residuals > $residuals_rms_max: "); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1745 |
my($nerm) = editResiduals_rmsMax($firstGoodEns,$lastGoodEns,$residuals_rms_max); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1746 |
progress("$nerm ensembles removed (%d%% of total)\n",round(100*$nerm/($lastGoodEns-$firstGoodEns+1))); |
42 | 1747 |
|
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1748 |
if (defined($residuals_delta_max)) { # filter based on difference between |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1749 |
progress("\tbeampair residuals difference > $residuals_delta_max [m/s]: "); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1750 |
my($nvrm) = editResiduals_deltaMax($firstGoodEns,$lastGoodEns,$residuals_delta_max); |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
1751 |
progress("$nvrm velocities removed (%d%% of total in bins $LADCP_firstBin-$LADCP_lastBin)\n",round(100*$nvrm/$nvw)); |
42 | 1752 |
} |
1753 |
||
1754 |
progress("\tre-binning profile data...\n"); |
|
1755 |
undef(%DNCAST); undef(%UPCAST); |
|
1756 |
$min_depth = 9e99; my($max_depth) = 0; |
|
1757 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
|
1758 |
unless (numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH})) { |
|
1759 |
$firstGoodEns++ if ($ens == $firstGoodEns); # start has been edited away |
|
1760 |
next; |
|
1761 |
} |
|
1762 |
$realLastGoodEns = $ens; |
|
46 | 1763 |
my(@bindepth) = binDepths($ens); |
42 | 1764 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
1765 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
1766 |
next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1); |
|
1767 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
|
1768 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
1769 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
1770 |
push(@{$DNCAST{ENSEMBLE}[$bi]},$ens); |
|
1771 |
push(@{$DNCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
1772 |
push(@{$DNCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
1773 |
push(@{$DNCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
|
54 | 1774 |
push(@{$DNCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]) |
1775 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1776 |
push(@{$DNCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]) |
|
1777 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
1778 |
push(@{$DNCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]) |
|
1779 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1780 |
push(@{$DNCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]) |
|
1781 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
1782 |
push(@{$DNCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}); |
|
1783 |
push(@{$DNCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
42 | 1784 |
} |
1785 |
} |
|
1786 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { # bin data into profile |
|
1787 |
$DNCAST{MEAN_DEPTH}[$bi] = avg(@{$DNCAST{DEPTH}[$bi]}); |
|
1788 |
$DNCAST{MEAN_ELAPSED}[$bi] = avg(@{$DNCAST{ELAPSED}[$bi]}); |
|
1789 |
$DNCAST{MEDIAN_W}[$bi] = median(@{$DNCAST{W}[$bi]}); |
|
1790 |
$DNCAST{MEDIAN_W12}[$bi] = median(@{$DNCAST{W12}[$bi]}); |
|
1791 |
$DNCAST{MEDIAN_W34}[$bi] = median(@{$DNCAST{W34}[$bi]}); |
|
54 | 1792 |
$DNCAST{MEDIAN_V12}[$bi] = median(@{$DNCAST{V12}[$bi]}); |
1793 |
$DNCAST{MEDIAN_V34}[$bi] = median(@{$DNCAST{V34}[$bi]}); |
|
1794 |
$DNCAST{MEAN_PITCH}[$bi] = avg(@{$DNCAST{PITCH}[$bi]}); |
|
1795 |
$DNCAST{MEAN_ROLL}[$bi] = avg(@{$DNCAST{ROLL}[$bi]}); |
|
42 | 1796 |
$DNCAST{MAD_W}[$bi] = mad2($DNCAST{MEDIAN_W}[$bi],@{$DNCAST{W}[$bi]}); |
1797 |
$DNCAST{N_SAMP}[$bi] = @{$DNCAST{W}[$bi]}; |
|
1798 |
} |
|
1799 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { |
|
1800 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
1801 |
$realLastGoodEns = $ens; |
|
46 | 1802 |
my(@bindepth) = binDepths($ens); |
42 | 1803 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
1804 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
1805 |
next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1); |
|
1806 |
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth); |
|
1807 |
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth); |
|
1808 |
my($bi) = $bindepth[$bin]/$opt_o; |
|
1809 |
push(@{$UPCAST{ENSEMBLE}[$bi]},$ens); |
|
1810 |
push(@{$UPCAST{ELAPSED}[$bi]},$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}]); |
|
1811 |
push(@{$UPCAST{DEPTH}[$bi]},$bindepth[$bin]); |
|
1812 |
push(@{$UPCAST{W}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]); |
|
54 | 1813 |
push(@{$UPCAST{W12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]) |
1814 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1815 |
push(@{$UPCAST{W34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]) |
|
1816 |
if defined($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
1817 |
push(@{$UPCAST{V12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V12}[$bin]) |
|
1818 |
if defined($LADCP{ENSEMBLE}[$ens]->{V12}[$bin]); |
|
1819 |
push(@{$UPCAST{V34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{V34}[$bin]) |
|
1820 |
if defined($LADCP{ENSEMBLE}[$ens]->{V34}[$bin]); |
|
1821 |
push(@{$UPCAST{PITCH}[$bi]},$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}); |
|
1822 |
push(@{$UPCAST{ROLL}[$bi]},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
42 | 1823 |
} |
1824 |
} |
|
1825 |
for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) { |
|
1826 |
$UPCAST{MEAN_DEPTH}[$bi] = avg(@{$UPCAST{DEPTH}[$bi]}); |
|
1827 |
$UPCAST{MEAN_ELAPSED}[$bi] = avg(@{$UPCAST{ELAPSED}[$bi]}); |
|
1828 |
$UPCAST{MEDIAN_W}[$bi] = median(@{$UPCAST{W}[$bi]}); |
|
1829 |
$UPCAST{MEDIAN_W12}[$bi] = median(@{$UPCAST{W12}[$bi]}); |
|
1830 |
$UPCAST{MEDIAN_W34}[$bi] = median(@{$UPCAST{W34}[$bi]}); |
|
54 | 1831 |
$UPCAST{MEDIAN_V12}[$bi] = median(@{$UPCAST{V12}[$bi]}); |
1832 |
$UPCAST{MEDIAN_V34}[$bi] = median(@{$UPCAST{V34}[$bi]}); |
|
1833 |
$UPCAST{MEAN_PITCH}[$bi] = avg(@{$UPCAST{PITCH}[$bi]}); |
|
1834 |
$UPCAST{MEAN_ROLL}[$bi] = avg(@{$UPCAST{ROLL}[$bi]}); |
|
42 | 1835 |
$UPCAST{MAD_W}[$bi] = mad2($UPCAST{MEDIAN_W}[$bi],@{$UPCAST{W}[$bi]}); |
1836 |
$UPCAST{N_SAMP}[$bi] = @{$UPCAST{W}[$bi]}; |
|
1837 |
} |
|
1838 |
} # if defined($opt_r) |
|
1839 |
||
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1840 |
$lastGoodEns = $realLastGoodEns; # now the ensemble range is final |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1841 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1842 |
&antsAddParams('min_depth',$min_depth,'max_depth',$max_depth, # define plot range limits |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1843 |
'min_ens',$LADCP{ENSEMBLE}[$firstGoodEns]->{NUMBER}, |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1844 |
'max_ens',$LADCP{ENSEMBLE}[$lastGoodEns]->{NUMBER}, |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1845 |
'min_elapsed',$LADCP{ENSEMBLE}[$firstGoodEns]->{CTD_ELAPSED}, |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1846 |
'max_elapsed',$LADCP{ENSEMBLE}[$lastGoodEns]->{CTD_ELAPSED}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1847 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1848 |
#----------------------------------------------- |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1849 |
# Add residuals to depth-binned profiles (wprof) |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1850 |
#----------------------------------------------- |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1851 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1852 |
progress("Binning vertical-velocity residuals into depth profiles..."); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1853 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1854 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1855 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 1856 |
my(@bindepth) = binDepths($ens); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1857 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1858 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1859 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1860 |
my($bi) = $bindepth[$bin]/$opt_o; |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1861 |
next unless numberp($DNCAST{MEDIAN_W}[$bi]); |
49 | 1862 |
push(@{$DNCAST{RESIDUAL12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]-$DNCAST{MEDIAN_W}[$bi]) |
1863 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1864 |
push(@{$DNCAST{RESIDUAL34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]-$DNCAST{MEDIAN_W}[$bi]) |
|
1865 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1866 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1867 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1868 |
for (my($bi)=0; $bi<=$#{$DNCAST{ENSEMBLE}}; $bi++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1869 |
$DNCAST{MEAN_RESIDUAL12}[$bi] = avg(@{$DNCAST{RESIDUAL12}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1870 |
$DNCAST{MEAN_RESIDUAL34}[$bi] = avg(@{$DNCAST{RESIDUAL34}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1871 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1872 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1873 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1874 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 1875 |
my(@bindepth) = binDepths($ens); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1876 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1877 |
next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1878 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1879 |
my($bi) = $bindepth[$bin]/$opt_o; |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1880 |
next unless numberp($UPCAST{MEDIAN_W}[$bi]); |
49 | 1881 |
push(@{$UPCAST{RESIDUAL12}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]-$UPCAST{MEDIAN_W}[$bi]) |
1882 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin]); |
|
1883 |
push(@{$UPCAST{RESIDUAL34}[$bi]},$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]-$UPCAST{MEDIAN_W}[$bi]) |
|
1884 |
if numberp($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin]); |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1885 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1886 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1887 |
for (my($bi)=0; $bi<=$#{$UPCAST{ENSEMBLE}}; $bi++) { |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1888 |
$UPCAST{MEAN_RESIDUAL12}[$bi] = avg(@{$UPCAST{RESIDUAL12}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1889 |
$UPCAST{MEAN_RESIDUAL34}[$bi] = avg(@{$UPCAST{RESIDUAL34}[$bi]}); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1890 |
} |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1891 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1892 |
progress("\n"); |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1893 |
|
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1894 |
#------------------------------------------------- |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1895 |
# Calculate and Output ADCP-Bin-Averaged Residuals |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1896 |
#------------------------------------------------- |
42 | 1897 |
|
54 | 1898 |
#if (@out_BR) { |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1899 |
progress("Binning vertical-velocity residuals wrt. ADCP bin number..."); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1900 |
|
54 | 1901 |
local(@dc_bres12,@uc_bres12,@dc_bres34,@uc_bres34); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1902 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # DOWNCAST |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1903 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 1904 |
my(@bindepth) = binDepths($ens); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1905 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1906 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
54 | 1907 |
push(@{$dc_bres12[$bin]}, |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1908 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] |
54 | 1909 |
- $DNCAST{MEDIAN_W12}[$bindepth[$bin]/$opt_o]) |
1910 |
if numberp($DNCAST{MEDIAN_W12}[$bindepth[$bin]/$opt_o]); |
|
1911 |
push(@{$dc_bres34[$bin]}, |
|
1912 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] |
|
1913 |
- $DNCAST{MEDIAN_W34}[$bindepth[$bin]/$opt_o]) |
|
1914 |
if numberp($DNCAST{MEDIAN_W34}[$bindepth[$bin]/$opt_o]); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1915 |
} |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1916 |
} |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
1917 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # UPCAST |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1918 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 1919 |
my(@bindepth) = binDepths($ens); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1920 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1921 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
54 | 1922 |
push(@{$uc_bres12[$bin]}, |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1923 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] |
54 | 1924 |
- $UPCAST{MEDIAN_W12}[$bindepth[$bin]/$opt_o]) |
1925 |
if numberp($UPCAST{MEDIAN_W12}[$bindepth[$bin]/$opt_o]); |
|
1926 |
push(@{$uc_bres34[$bin]}, |
|
1927 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] |
|
1928 |
- $UPCAST{MEDIAN_W34}[$bindepth[$bin]/$opt_o]) |
|
1929 |
if numberp($UPCAST{MEDIAN_W34}[$bindepth[$bin]/$opt_o]); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1930 |
} |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
1931 |
} |
54 | 1932 |
local(@dc_avg_bres12,@uc_avg_bres12,@dc_avg_bres12_nsamp,@uc_avg_bres12_nsamp); # means/stddevs |
1933 |
local(@dc_avg_bres34,@uc_avg_bres34,@dc_avg_bres34_nsamp,@uc_avg_bres34_nsamp); |
|
34 | 1934 |
for (my($bin)=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
54 | 1935 |
$dc_bres12_nsamp[$bin] = @{$dc_bres12[$bin]}; |
1936 |
if ($dc_bres12_nsamp[$bin] > 0) { |
|
1937 |
$dc_avg_bres12[$bin] = avg(@{$dc_bres12[$bin]}); |
|
1938 |
$dc_sig_bres12[$bin] = stddev2($dc_avg_bres12[$bin],@{$dc_bres12[$bin]}); |
|
1939 |
} else { |
|
1940 |
$dc_avg_bres12[$bin] = nan; |
|
1941 |
$dc_sig_bres12[$bin] = nan; |
|
1942 |
} |
|
1943 |
$uc_bres12_nsamp[$bin] = @{$uc_bres12[$bin]}; |
|
1944 |
if ($uc_bres12_nsamp[$bin] > 0) { |
|
1945 |
$uc_avg_bres12[$bin] = avg(@{$uc_bres12[$bin]}); |
|
1946 |
$uc_sig_bres12[$bin] = stddev2($uc_avg_bres12[$bin],@{$uc_bres12[$bin]}); |
|
34 | 1947 |
} else { |
54 | 1948 |
$uc_avg_bres12[$bin] = nan; |
1949 |
$uc_sig_bres12[$bin] = nan; |
|
34 | 1950 |
} |
54 | 1951 |
$dc_bres34_nsamp[$bin] = @{$dc_bres34[$bin]}; |
1952 |
if ($dc_bres34_nsamp[$bin] > 0) { |
|
1953 |
$dc_avg_bres34[$bin] = avg(@{$dc_bres34[$bin]}); |
|
1954 |
$dc_sig_bres34[$bin] = stddev2($dc_avg_bres34[$bin],@{$dc_bres34[$bin]}); |
|
34 | 1955 |
} else { |
54 | 1956 |
$dc_avg_bres34[$bin] = nan; |
1957 |
$dc_sig_bres34[$bin] = nan; |
|
1958 |
} |
|
1959 |
$uc_bres34_nsamp[$bin] = @{$uc_bres34[$bin]}; |
|
1960 |
if ($uc_bres34_nsamp[$bin] > 0) { |
|
1961 |
$uc_avg_bres34[$bin] = avg(@{$uc_bres34[$bin]}); |
|
1962 |
$uc_sig_bres34[$bin] = stddev2($uc_avg_bres34[$bin],@{$uc_bres34[$bin]}); |
|
1963 |
} else { |
|
1964 |
$uc_avg_bres34[$bin] = nan; |
|
1965 |
$uc_sig_bres34[$bin] = nan; |
|
34 | 1966 |
} |
30 | 1967 |
} |
1968 |
||
54 | 1969 |
local($uc_bres12_max_nsamp,$dc_bres12_max_nsamp) = (0,0); # calc rms in block of well sampled bins |
1970 |
local($uc_bres34_max_nsamp,$dc_bres34_max_nsamp) = (0,0); |
|
34 | 1971 |
for (my($bin)=$LADCP_firstBin; $bin<=$LADCP_lastBin-1; $bin++) { # SKIP 1ST BIN!!! |
1972 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); # skip bins not included in gridded output |
|
54 | 1973 |
$dc_bres12_max_nsamp = $dc_bres12_nsamp[$bin] # nsamp in best sampled bin |
1974 |
if ($dc_bres12_nsamp[$bin] > $dc_bres12_max_nsamp); |
|
1975 |
$uc_bres12_max_nsamp = $uc_bres12_nsamp[$bin] |
|
1976 |
if ($uc_bres12_nsamp[$bin] > $uc_bres12_max_nsamp); |
|
1977 |
$dc_bres34_max_nsamp = $dc_bres34_nsamp[$bin] # nsamp in best sampled bin |
|
1978 |
if ($dc_bres34_nsamp[$bin] > $dc_bres34_max_nsamp); |
|
1979 |
$uc_bres34_max_nsamp = $uc_bres34_nsamp[$bin] |
|
1980 |
if ($uc_bres34_nsamp[$bin] > $uc_bres34_max_nsamp); |
|
34 | 1981 |
} |
54 | 1982 |
my($dc_sumsq12,$uc_sumsq12,$dc_n12,$uc_n12) = (0,0,0,0); # calc rms residuals |
1983 |
my($dc_sumsq34,$uc_sumsq34,$dc_n34,$uc_n34) = (0,0,0,0); |
|
34 | 1984 |
for (my($bin)=$LADCP_firstBin; $bin<=$LADCP_lastBin-1; $bin++) { # SKIP 1ST BIN |
1985 |
next if ($bin+1<$outGrid_firstBin || $bin+1>$outGrid_lastBin); # skip bins not included in gridded output |
|
54 | 1986 |
if ($dc_bres12_nsamp[$bin] >= $dc_bres12_max_nsamp/3) { # skip bins with < 1/3 max(nsamp) |
1987 |
$dc_sumsq12 += $dc_avg_bres12[$bin]**2; |
|
1988 |
$dc_n12++; |
|
1989 |
} |
|
1990 |
if ($uc_bres12_nsamp[$bin] >= $uc_bres12_max_nsamp/3) { |
|
1991 |
$uc_sumsq12 += $uc_avg_bres12[$bin]**2; |
|
1992 |
$uc_n12++; |
|
34 | 1993 |
} |
54 | 1994 |
if ($dc_bres34_nsamp[$bin] >= $dc_bres34_max_nsamp/3) { # skip bins with < 1/3 max(nsamp) |
1995 |
$dc_sumsq34 += $dc_avg_bres34[$bin]**2; |
|
1996 |
$dc_n34++; |
|
1997 |
} |
|
1998 |
if ($uc_bres34_nsamp[$bin] >= $uc_bres34_max_nsamp/3) { |
|
1999 |
$uc_sumsq34 += $uc_avg_bres34[$bin]**2; |
|
2000 |
$uc_n34++; |
|
34 | 2001 |
} |
2002 |
} |
|
54 | 2003 |
$dc_bres12_rms = ($dc_n12 > 0) ? sqrt($dc_sumsq12/$dc_n12) : nan; |
2004 |
$uc_bres12_rms = ($uc_n12 > 0) ? sqrt($uc_sumsq12/$uc_n12) : nan; |
|
2005 |
$dc_bres34_rms = ($dc_n34 > 0) ? sqrt($dc_sumsq34/$dc_n34) : nan; |
|
2006 |
$uc_bres34_rms = ($uc_n34 > 0) ? sqrt($uc_sumsq34/$uc_n34) : nan; |
|
2007 |
||
2008 |
&antsAddParams('dc_bin_residuals12.rms',$dc_bres12_rms, |
|
2009 |
'dc_bin_residuals34.rms',$dc_bres34_rms, |
|
2010 |
'uc_bin_residuals12.rms',$uc_bres12_rms, |
|
2011 |
'uc_bin_residuals34.rms',$uc_bres34_rms); |
|
34 | 2012 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2013 |
progress("\n\twriting binned residuals to "); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2014 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2015 |
my($saveParams) = $antsCurParams; |
54 | 2016 |
@antsNewLayout = ('bin','dc_residual12','dc_residual12.sig','dc_residual12.nsamp', |
2017 |
'uc_residual12','uc_residual12.sig','uc_residual12.nsamp', |
|
2018 |
'dc_residual34','dc_residual34.sig','dc_residual34.nsamp', |
|
2019 |
'uc_residual34','uc_residual34.sig','uc_residual34.nsamp'); |
|
2020 |
&antsAddParams('BR_max_bin',max(scalar(@dc_bres12),scalar(@uc_bres12), |
|
2021 |
scalar(@dc_bres34),scalar(@uc_bres34))); |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2022 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2023 |
foreach my $of (@out_BR) { |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2024 |
progress("<$of> "); |
42 | 2025 |
my($sub,$arg) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file) |
2026 |
if (defined($arg)) { |
|
2027 |
require "$WCALC/${sub}.pl"; |
|
2028 |
&{$sub}($arg); |
|
30 | 2029 |
next; |
2030 |
} |
|
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2031 |
$of = ">$of" unless ($of =~ /^$|^\s*\|/); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
2032 |
open(STDOUT,$of) || error("$of: $!\n"); |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2033 |
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
54 | 2034 |
for (my($bin)=0; $bin<max(scalar(@dc_bres12),scalar(@uc_bres12)); $bin++) { |
2035 |
&antsOut($bin+1,$dc_avg_bres12[$bin],$dc_sig_bres12[$bin],$dc_bres12_nsamp[$bin], |
|
2036 |
$uc_avg_bres12[$bin],$uc_sig_bres12[$bin],$uc_bres12_nsamp[$bin], |
|
2037 |
$dc_avg_bres34[$bin],$dc_sig_bres34[$bin],$dc_bres34_nsamp[$bin], |
|
2038 |
$uc_avg_bres34[$bin],$uc_sig_bres34[$bin],$uc_bres34_nsamp[$bin]); |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2039 |
} |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2040 |
&antsOut('EOF'); open(STDOUT,">&2"); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2041 |
} |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2042 |
$antsCurParams = $saveParams; |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2043 |
progress("\n"); |
54 | 2044 |
#} |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2045 |
|
0 | 2046 |
#-------------------------------------------------- |
2047 |
# Calculate BT-referenced vertical-velocity profile |
|
2048 |
#-------------------------------------------------- |
|
2049 |
||
49 | 2050 |
if ($LADCP{ENSEMBLE}[$LADCP_atbottom]->{XDUCER_FACING_DOWN} && defined($water_depth)) { |
2051 |
||
0 | 2052 |
progress("Calculating BT-referenced vertical velocities\n"); |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2053 |
calc_BTprof($firstGoodEns,$lastGoodEns,$water_depth,$sig_water_depth); |
0 | 2054 |
|
2055 |
my($sumSq) = my($n) = 0; |
|
2056 |
for (my($bi)=0; $bi<=$#{$BT{MEDIAN_W}}; $bi++) { |
|
2057 |
next unless defined($BT{MEDIAN_W}[$bi]); |
|
13 | 2058 |
next unless ($BT{N_SAMP}[$bi]>=$opt_k && $DNCAST{N_SAMP}[$bi]>=$opt_k && $UPCAST{N_SAMP}[$bi]>=$opt_k); |
0 | 2059 |
$sumSq += ($BT{MEDIAN_W}[$bi] - $DNCAST{MEDIAN_W}[$bi]/2 - $UPCAST{MEDIAN_W}[$bi]/2)**2; |
2060 |
$n++; |
|
2061 |
} |
|
2062 |
if ($n > 0) { |
|
2063 |
my($rms) = round(sqrt($sumSq/$n),0.001); |
|
2064 |
&antsAddParams('BT_rms_w_discrepancy',$rms); |
|
2065 |
progress("\t$rms m/s rms vertical-velocity discrepancy\n"); |
|
2066 |
} |
|
2067 |
} |
|
2068 |
||
13 | 2069 |
#------------------------ |
2070 |
# output all samples (-w) |
|
2071 |
#------------------------ |
|
2 | 2072 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2073 |
# NB: residual fields are calculated with respect to down-/upcast medians in -o-size bins |
2 | 2074 |
|
31 | 2075 |
if (@out_wsamp) { |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2076 |
progress("Writing vertical-velocity data to "); |
2 | 2077 |
|
31 | 2078 |
foreach my $of (@out_wsamp) { |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2079 |
progress("<$of> "); |
30 | 2080 |
|
42 | 2081 |
my($sub,$arg) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file) |
2082 |
if (defined($arg)) { |
|
2083 |
require "$WCALC/${sub}.pl"; |
|
2084 |
&{$sub}($arg); |
|
30 | 2085 |
next; |
2086 |
} |
|
2087 |
||
54 | 2088 |
@antsNewLayout = ('ensemble','bin','elapsed','depth','CTD_depth','downcast', |
2089 |
'w','w12','w34','v12','v34','residual','residual12','residual34', |
|
2090 |
'CTD_w','CTD_w_t','CTD_w_tt','LADCP_w','LADCP_reflr_w','winch_w', |
|
2091 |
'errvel','correlation','echo_amplitude','Sv', |
|
2092 |
'pitch','roll','tilt','heading','3_beam','svel'); |
|
2093 |
||
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2094 |
$of = ">$of" unless ($of =~ /^$|^\s*\|/); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
2095 |
open(STDOUT,$of) || error("$of: $!\n"); |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2096 |
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
49 | 2097 |
|
2098 |
sub res($$) |
|
2099 |
{ |
|
2100 |
my($meas,$mean) = @_; |
|
2101 |
return numberp($meas) ? ($meas - $mean) : undef; |
|
2102 |
} |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2103 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2104 |
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2105 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 2106 |
my(@bindepth) = binDepths($ens); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2107 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2108 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2109 |
my($bi) = $bindepth[$bin]/$opt_o; |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2110 |
&antsOut( |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2111 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER},$bin+1, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2112 |
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2113 |
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},1, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2114 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2115 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin], |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2116 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin], |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2117 |
$LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{V34}[$bin], |
49 | 2118 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin],$DNCAST{MEDIAN_W}[$bi]), |
2119 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin],$DNCAST{MEDIAN_W}[$bi]), |
|
2120 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin],$DNCAST{MEDIAN_W}[$bi]), |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2121 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2122 |
$CTD{W_t}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2123 |
$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2124 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin], |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
2125 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
2126 |
$CTD{W_WINCH}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2127 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2128 |
median(@{$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]}), |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2129 |
median(@{$LADCP{ENSEMBLE}[$ens]->{ECHO_AMPLITUDE}[$bin]}), |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2130 |
$LADCP{ENSEMBLE}[$ens]->{SV}[$bin], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2131 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}, |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2132 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2133 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2134 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2135 |
(defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][0]) + # only works for beam coords |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2136 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][1]) + |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2137 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][2]) + |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2138 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][3])) < 4 ? 1 : 0, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2139 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2140 |
); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2141 |
} # for $bin |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2142 |
} # for $ens |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2143 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2144 |
for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) { # upcast |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2145 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
46 | 2146 |
my(@bindepth) = binDepths($ens); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2147 |
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2148 |
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2149 |
my($bi) = $bindepth[$bin]/$opt_o; |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2150 |
&antsOut( |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2151 |
$LADCP{ENSEMBLE}[$ens]->{NUMBER},$bin+1, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2152 |
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2153 |
$bindepth[$bin],$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH},0, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2154 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2155 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin], |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2156 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin], |
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2157 |
$LADCP{ENSEMBLE}[$ens]->{V12}[$bin],$LADCP{ENSEMBLE}[$ens]->{V34}[$bin], |
49 | 2158 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin],$UPCAST{MEDIAN_W}[$bi]), |
2159 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W12}[$bin],$UPCAST{MEDIAN_W}[$bi]), |
|
2160 |
res($LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin],$UPCAST{MEDIAN_W}[$bi]), |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2161 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2162 |
$CTD{W_t}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2163 |
$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2164 |
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_W}[$bin], |
47
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
2165 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
2ccb81b7cea5
version found on whoosher after repair
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
46
diff
changeset
|
2166 |
$CTD{W_WINCH}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2167 |
$LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2168 |
median(@{$LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]}), |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2169 |
median(@{$LADCP{ENSEMBLE}[$ens]->{ECHO_AMPLITUDE}[$bin]}), |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2170 |
$LADCP{ENSEMBLE}[$ens]->{SV}[$bin], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2171 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}, |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2172 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2173 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2174 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2175 |
(defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][0]) + # only works for beam coords |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2176 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][1]) + |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2177 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][2]) + |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2178 |
defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][3])) < 4 ? 1 : 0, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2179 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2180 |
); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2181 |
} # for $bin |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2182 |
} # for $ens |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2183 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2184 |
&antsOut('EOF'); open(STDOUT,">&2"); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2185 |
} |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2186 |
progress("\n"); |
2 | 2187 |
} |
2188 |
||
13 | 2189 |
#---------------------------- |
2190 |
# Output depth-binned profile |
|
2191 |
#---------------------------- |
|
0 | 2192 |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2193 |
if (@out_profile) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2194 |
progress("Writing vertical-velocity profiles to "); |
54 | 2195 |
undef(@antsNewLayout); |
2196 |
push(@antsNewLayout,'depth','hab', # consistent with [LADCP_w_postproc] |
|
2197 |
'dc_elapsed','dc_w','dc_w.mad','dc_w.nsamp', |
|
2198 |
'uc_elapsed','uc_w','uc_w.mad','uc_w.nsamp'); |
|
2199 |
push(@antsNewLayout,'dc_depth','dc_w12','dc_w34','dc_v12','dc_v34', # additional fields (inconsistent w postproc) |
|
2200 |
'uc_depth','uc_w12','uc_w34','uc_v12','uc_v34', |
|
2201 |
'BT_w','BT_w.mad','BT_w.nsamp'); |
|
0 | 2202 |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2203 |
foreach my $of (@out_profile) { |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2204 |
progress("<$of> "); |
29 | 2205 |
|
42 | 2206 |
my($sub,$arg) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file) |
2207 |
if (defined($arg)) { |
|
2208 |
require "$WCALC/${sub}.pl"; |
|
2209 |
&{$sub}($arg); |
|
29 | 2210 |
next; |
2211 |
} |
|
2212 |
||
2213 |
$of = ">$of" unless ($of =~ /^$|^\s*\|/); # pipe or file output |
|
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
2214 |
open(STDOUT,$of) || error("$of: $!\n"); |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2215 |
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2216 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2217 |
for (my($bi)=0; $bi<=max($#{$DNCAST{ENSEMBLE}},$#{$UPCAST{ENSEMBLE}},$#{$BT{NSAMP}}); $bi++) { |
37 | 2218 |
&antsOut(($bi+0.5)*$opt_o, # nominal depth |
2219 |
defined($water_depth)?$water_depth-($bi+0.5)*$opt_o:nan, # nominal hab |
|
54 | 2220 |
$DNCAST{MEAN_ELAPSED}[$bi], # dc data consistent w postproc |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2221 |
$DNCAST{N_SAMP}[$bi]>=$opt_k?$DNCAST{MEDIAN_W}[$bi]:nan, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2222 |
$DNCAST{MAD_W}[$bi],$DNCAST{N_SAMP}[$bi], |
54 | 2223 |
$UPCAST{MEAN_ELAPSED}[$bi], # uc data consistent w postproc |
2224 |
$UPCAST{N_SAMP}[$bi]>=$opt_k?$UPCAST{MEDIAN_W}[$bi]:nan, |
|
2225 |
$UPCAST{MAD_W}[$bi],$UPCAST{N_SAMP}[$bi], |
|
2226 |
$DNCAST{MEAN_DEPTH}[$bi], # remaining dc data |
|
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2227 |
$DNCAST{MEDIAN_W12}[$bi],$DNCAST{MEDIAN_W34}[$bi], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2228 |
$DNCAST{MEDIAN_V12}[$bi],$DNCAST{MEDIAN_V34}[$bi], |
54 | 2229 |
$UPCAST{MEAN_DEPTH}[$bi], # remaining uc data |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2230 |
$UPCAST{MEDIAN_W12}[$bi],$UPCAST{MEDIAN_W34}[$bi], |
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2231 |
$UPCAST{MEDIAN_V12}[$bi],$UPCAST{MEDIAN_V34}[$bi], |
37 | 2232 |
$BT{N_SAMP}[$bi]>=$opt_k?$BT{MEDIAN_W}[$bi]:nan, # BT data |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2233 |
$BT{MAD_W}[$bi],$BT{N_SAMP}[$bi] |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2234 |
); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2235 |
} |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2236 |
&antsOut('EOF'); open(STDOUT,">&2"); |
0 | 2237 |
} |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2238 |
progress("\n"); |
0 | 2239 |
} |
2240 |
||
2241 |
#-------------------------------------- |
|
2242 |
# write time-series output if requested |
|
2243 |
#-------------------------------------- |
|
2244 |
||
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2245 |
if (@out_timeseries) { |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2246 |
progress("Writing time-series data to "); |
23 | 2247 |
@antsNewLayout = ('ensemble','elapsed','downcast', |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
2248 |
'depth','xducer_sound_speed','pitch','gimbal_pitch','roll','tilt','heading', |
13 | 2249 |
'CTD_w','CTD_w_tt','LADCP_reflr_w','LADCP_reflr_w.sig', |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
2
diff
changeset
|
2250 |
'reflr_ocean_w'); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2251 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2252 |
foreach my $of (@out_timeseries) { |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2253 |
progress("<$of> "); |
42 | 2254 |
my($sub,$arg) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file) |
2255 |
if (defined($arg)) { |
|
2256 |
require "$WCALC/${sub}.pl"; |
|
2257 |
&{$sub}($arg); |
|
30 | 2258 |
next; |
2259 |
} |
|
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2260 |
$of = ">$of" unless ($of =~ /^$|^\s*\|/); |
27
2053d8de8d6b
updated plots & seabed code; GoM data process correctly
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
26
diff
changeset
|
2261 |
open(STDOUT,$of) || error("$of: $!\n"); |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
25
diff
changeset
|
2262 |
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2263 |
|
45
6d49c7420a6c
stable V1.3beta, just before implementing bin interpolation
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
43
diff
changeset
|
2264 |
for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2265 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2266 |
my($reflr_oc_w) = defined($LADCP{ENSEMBLE}[$ens]->{REFLR_W}) |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2267 |
? $LADCP{ENSEMBLE}[$ens]->{REFLR_W} - $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}] |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2268 |
: undef; |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2269 |
&antsOut($LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2270 |
$CTD{ELAPSED}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2271 |
($ens < $LADCP_atbottom) ? 1 : 0, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2272 |
$LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2273 |
$CTD{SVEL}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2274 |
$LADCP{ENSEMBLE}[$ens]->{PITCH}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2275 |
$LADCP{ENSEMBLE}[$ens]->{GIMBAL_PITCH}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2276 |
$LADCP{ENSEMBLE}[$ens]->{ROLL}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2277 |
$LADCP{ENSEMBLE}[$ens]->{TILT}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2278 |
$LADCP{ENSEMBLE}[$ens]->{HEADING}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2279 |
$CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2280 |
$CTD{W_tt}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2281 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2282 |
$LADCP{ENSEMBLE}[$ens]->{REFLR_W_STDDEV}, |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2283 |
$reflr_oc_w); |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2284 |
} |
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2285 |
|
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2286 |
&antsOut('EOF'); open(STDOUT,">&2"); |
0 | 2287 |
} |
25
bd38f8bfb8e6
first step at re-designing plotting system
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
23
diff
changeset
|
2288 |
progress("\n"); |
0 | 2289 |
} |
2290 |
||
42 | 2291 |
system("{ ./LADCP_w.PostProcess $out_basename $RUN $data_dir $plot_dir $log_dir; }&") |
2292 |
if (-x 'LADCP_w.PostProcess'); |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2293 |
|
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
2294 |
exit(0); |