author | A.M. Thurnherr <ant@ldeo.columbia.edu> |
Sun, 05 Apr 2015 22:34:59 -0400 | |
changeset 21 | cd001648ccba |
parent 16 | 29e867b3e070 |
child 27 | 2053d8de8d6b |
permissions | -rw-r--r-- |
0 | 1 |
#====================================================================== |
2 |
# E D I T _ D A T A . P L |
|
3 |
# doc: Sat May 22 21:35:55 2010 |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
4 |
# dlm: Wed May 21 13:00:35 2014 |
0 | 5 |
# (c) 2010 A.M. Thurnherr |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
6 |
# uE-Info: 339 74 NIL 0 0 72 2 2 4 NIL ofnI |
0 | 7 |
#====================================================================== |
8 |
||
9 |
# HISTORY: |
|
10 |
# May 22, 2010: - created |
|
11 |
# May 24, 2010: - added editSideLobesFromSeabed() |
|
12 |
# Oct 29, 2010: - added editCorr_Earthcoords |
|
13 |
# Dec 20, 2010: - BUG: DISTANCE_TO_BIN1_CENTER & BIN_LENGTH had been |
|
14 |
# interpreted as along-beam, rather than vertical |
|
15 |
# - replaced editPitchRoll by editTilt |
|
16 |
# Dec 25, 2010: - adapted to changes in [LADCP_w] |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
17 |
# Aug 3, 2011: - added editTruncRange() |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
18 |
# Oct 10, 2011: - added editFalsePositives() |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
19 |
# - BUG: when earth velocities were edited, all were |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
20 |
# counted, not just those between first and lastBin |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
21 |
# Oct 11, 2011: - moved defaults to [defaults.pl] |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
22 |
# Oct 12, 2011: - added &editSurfLayer() |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
23 |
# - BUG: editSideLobes() was slightly loose |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
24 |
# Oct 15, 2011: - added editWOutliers() |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
25 |
# Oct 20, 2011: - added editFarBins() |
6 | 26 |
# Oct 27, 2011: - adapted editTilt() to new call location |
27 |
# - added correctAttitude() |
|
10
7e76fdef8953
version prior to carrying out separate dc-/uc- time lagging
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
6
diff
changeset
|
28 |
# Oct 15, 2012: - BUG: editSurfLayer() counted also ensembles without CTD depth |
13 | 29 |
# Nov 12, 2013: - added comments on editCorr_Earthcoords() |
15 | 30 |
# Mar 4, 2013: - added support for missing PITCH/ROLL (TILT) & HEADING |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
31 |
# May 20, 2014: - added editPPI() |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
32 |
# May 21, 2014: - got it to work correctly |
0 | 33 |
|
34 |
# NOTES: |
|
13 | 35 |
# - editCorr_Earthcoords() is overly conservative and removed most |
36 |
# or all 3-beam solutions |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
37 |
# - all bins must be edited (not just the ones between $LADCP_firstBin |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
38 |
# and $LADCP_lastBin to allow reflr calculations to use bins outside |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
39 |
# this range (ONLY FOR BEAM-COORD EDITS) |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
40 |
# - however, to make the stats work, only the edited velocities |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
41 |
# inside the bin range are counted |
0 | 42 |
|
43 |
#====================================================================== |
|
6 | 44 |
# correctAttitude($ens,$pitch_bias,$roll_bias,$heading_bias) |
45 |
#====================================================================== |
|
46 |
||
47 |
sub correctAttitude($$$$) |
|
48 |
{ |
|
49 |
my($ens,$pitch_bias,$roll_bias,$heading_bias) = @_; |
|
15 | 50 |
$LADCP{ENSEMBLE}[$ens]->{PITCH} -= $pitch_bias if defined($LADCP{ENSEMBLE}[$ens]->{PITCH}); |
51 |
$LADCP{ENSEMBLE}[$ens]->{ROLL} -= $roll_bias if defined($LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
52 |
$LADCP{ENSEMBLE}[$ens]->{HEADING} -= $heading_bias if defined($LADCP{ENSEMBLE}[$ens]->{HEADING}); |
|
6 | 53 |
} |
54 |
||
55 |
#====================================================================== |
|
0 | 56 |
# $vv = countValidVels($ens) |
57 |
#====================================================================== |
|
58 |
||
59 |
sub countValidBeamVels($) |
|
60 |
{ |
|
61 |
my($ens) = @_; |
|
62 |
||
63 |
my($vv) = 0; |
|
64 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
65 |
$vv += defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][0]); |
|
66 |
$vv += defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][1]); |
|
67 |
$vv += defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][2]); |
|
68 |
$vv += defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][3]); |
|
69 |
} |
|
70 |
return $vv; |
|
71 |
} |
|
72 |
||
73 |
#====================================================================== |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
74 |
# $removed = editCorr($ens,$threshold) |
0 | 75 |
# |
76 |
# NOTES: |
|
77 |
# - called before Earth vels have been calculated |
|
78 |
#====================================================================== |
|
79 |
||
80 |
sub editCorr($$) |
|
81 |
{ |
|
82 |
my($ens,$lim) = @_; |
|
83 |
||
84 |
my($nrm) = 0; |
|
85 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
86 |
for (my($beam)=0; $beam<4; $beam++) { |
|
87 |
next if ($LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin][$beam] >= $lim || |
|
88 |
!defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$beam])); |
|
89 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$beam]); |
|
90 |
$nrm++; |
|
91 |
} |
|
92 |
} |
|
93 |
return $nrm; |
|
94 |
} |
|
95 |
||
13 | 96 |
#====================================================================== |
97 |
# $removed = editCorr_Earthcoords($ens,$threshold) |
|
98 |
# |
|
99 |
# NOTES: |
|
100 |
# - if any of the 4 beam correlations is below the threshold, |
|
101 |
# the entire velocity is removed |
|
102 |
# - this implies that (most? all?) three-beam solutions will |
|
103 |
# be edited out, which is overly conserative |
|
104 |
# - a potentially better algorithm (used in LADCPproc) ignores the |
|
105 |
# lowest correlation in all 3-beam solutions |
|
106 |
#====================================================================== |
|
107 |
||
0 | 108 |
sub editCorr_Earthcoords($$) |
109 |
{ |
|
110 |
my($ens,$lim) = @_; |
|
111 |
||
112 |
my($nrm) = 0; |
|
113 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
114 |
my($beam); |
|
115 |
for ($beam=0; $beam<4; $beam++) { |
|
116 |
last unless ($LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin][$beam] >= $lim); |
|
117 |
} |
|
118 |
if ($beam < 4) { |
|
119 |
for (my($c)=0; $c<4; $c++) { |
|
120 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$c]); |
|
121 |
undef($LADCP{ENSEMBLE}[$ens]->{VELOCITY}[$bin][$c]); |
|
122 |
$nrm++; |
|
123 |
} |
|
124 |
} |
|
125 |
} |
|
126 |
return $nrm; |
|
127 |
} |
|
128 |
||
129 |
#====================================================================== |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
130 |
# $removed = editTilt($ens,$threshold) |
0 | 131 |
# |
132 |
# NOTES: |
|
6 | 133 |
# - called after Earth vels have been calculated |
0 | 134 |
# - sets TILT field for each ensemble as a side-effect |
135 |
#====================================================================== |
|
136 |
||
137 |
sub editTilt($$) |
|
138 |
{ |
|
139 |
my($ens,$lim) = @_; |
|
140 |
||
141 |
$LADCP{ENSEMBLE}[$ens]->{TILT} = |
|
142 |
&angle_from_vertical($LADCP{ENSEMBLE}[$ens]->{PITCH},$LADCP{ENSEMBLE}[$ens]->{ROLL}); |
|
143 |
||
15 | 144 |
return 0 unless ($LADCP{ENSEMBLE}[$ens]->{TILT} > $lim); |
0 | 145 |
|
146 |
my($nrm) = 0; |
|
147 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
|
6 | 148 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
149 |
undef($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
150 |
$nrm++; |
|
0 | 151 |
} |
152 |
return $nrm; |
|
153 |
} |
|
154 |
||
155 |
#====================================================================== |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
156 |
# $removed = editErrVel($ens,$threshold) |
0 | 157 |
# |
158 |
# NOTES: |
|
159 |
# - call after Earth vels have been calculated |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
160 |
# - count only removed vels in selected bin range |
0 | 161 |
#====================================================================== |
162 |
||
163 |
sub editErrVel($$) |
|
164 |
{ |
|
165 |
my($ens,$lim) = @_; |
|
166 |
||
167 |
my($nrm) = 0; |
|
168 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $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
|
169 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
0 | 170 |
next if (abs($LADCP{ENSEMBLE}[$ens]->{ERRVEL}[$bin]) <= $lim); |
171 |
undef($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
172 |
$nrm++ if ($bin>=$LADCP_firstBin-1 && $bin<=$LADCP_lastBin-1); |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
173 |
} |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
174 |
return $nrm; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
175 |
} |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
176 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
177 |
#====================================================================== |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
178 |
# $removed = editWOutliers($ens,$lim) |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
179 |
# |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
180 |
# NOTES: |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
181 |
# - call after Earth vels have been calculated |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
182 |
# - count only removed vels in selected bin range |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
183 |
# - lim determines how many times the mad an outlier has to be from median |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
184 |
#====================================================================== |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
185 |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
186 |
sub editWOutliers($$) |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
187 |
{ |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
188 |
my($ens,$lim) = @_; |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
189 |
my($medw) = median(@{$LADCP{ENSEMBLE}[$ens]->{W}}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
190 |
my($madw) = mad2($medw,@{$LADCP{ENSEMBLE}[$ens]->{W}}); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
191 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
192 |
my($nrm) = 0; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
193 |
for (my($bin)=0; $bin<$LADCP{N_BINS}; $bin++) { |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
194 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
195 |
next if (abs($LADCP{ENSEMBLE}[$ens]->{W}[$bin]-$medw) <= $lim*$madw); |
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
196 |
undef($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
197 |
$nrm++ if ($bin>=$LADCP_firstBin-1 && $bin<=$LADCP_lastBin-1); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
198 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
199 |
return $nrm; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
200 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
201 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
202 |
#====================================================================== |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
203 |
# $removed = editTruncRange($ens,$nbins) |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
204 |
# |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
205 |
# NOTES: |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
206 |
# - call after Earth vels have been calculated |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
207 |
#====================================================================== |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
208 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
209 |
sub editTruncRange($$) |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
210 |
{ |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
211 |
my($ens,$nbins) = @_; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
212 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
213 |
my($nrm) = 0; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
214 |
for (my($bin)=$LADCP{N_BINS}-1; $bin>=0 && $nrm<$nbins; $bin--) { |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
215 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
216 |
undef($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
217 |
$nrm++ if ($bin>=$LADCP_firstBin-1 && $bin<=$LADCP_lastBin-1); |
0 | 218 |
} |
219 |
return $nrm; |
|
220 |
} |
|
221 |
||
222 |
#====================================================================== |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
223 |
# $removed = editFarBins($ens,$first_bad_bin) |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
224 |
# |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
225 |
# NOTES: |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
226 |
# - call after Earth vels have been calculated |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
227 |
# - remove data from far bins |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
228 |
# - only bins in valid range are considered here, because |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
229 |
# $per_bin_nsamp is only defined for those |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
230 |
#====================================================================== |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
231 |
|
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
232 |
sub editFarBins($$) |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
233 |
{ |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
234 |
my($ens,$first_bad_bin) = @_; |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
235 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
236 |
my($nrm) = 0; |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
237 |
for (my($bin)=$first_bad_bin; $bin<=$LADCP_lastBin-1; $bin++) { |
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
238 |
next unless defined($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
239 |
undef($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
5
509cc9966b68
======================================================================
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
4
diff
changeset
|
240 |
$nrm++; |
3
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
241 |
} |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
242 |
return $nrm; |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
243 |
} |
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
244 |
|
9c021fdea1ff
Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
0
diff
changeset
|
245 |
#====================================================================== |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
246 |
# ($nvrm,$nerm) = editSideLobes($fromEns,$toEns,$water_depth) |
0 | 247 |
# |
248 |
# NOTES: |
|
249 |
# 1) When this code is executed the sound speed is known. No attempt is made to correct for |
|
250 |
# along-beam soundspeed variation, but the soundspeed at the transducer is accounted for. |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
251 |
# 2) for UL, water_depth == undef |
0 | 252 |
#====================================================================== |
253 |
||
254 |
sub editSideLobes($$$) |
|
255 |
{ |
|
256 |
my($fe,$te,$wd) = @_; # first & last ens to process, water depth for downlooker |
|
257 |
my($nvrm) = 0; # of velocities removed |
|
258 |
my($nerm) = 0; # of ensembles affected |
|
259 |
for (my($e)=$fe; $e<=$te; $e++) { |
|
260 |
next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}); |
|
261 |
my($range) = $LADCP{ENSEMBLE}[$e]->{XDUCER_FACING_UP} |
|
262 |
? $LADCP{ENSEMBLE}[$e]->{CTD_DEPTH} |
|
263 |
: $wd - $LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}; |
|
264 |
my($sscorr) = $CTD{SVEL}[$LADCP{ENSEMBLE}[$e]->{CTD_SCAN}] / 1500; |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
265 |
my($goodBins) = ($range - $sscorr*$LADCP{DISTANCE_TO_BIN1_CENTER}) * cos(rad($LADCP{BEAM_ANGLE})) |
0 | 266 |
/ ($sscorr*$LADCP{BIN_LENGTH}) |
267 |
- 1.5; |
|
268 |
||
269 |
my($dirty) = 0; |
|
270 |
for (my($bin)=int($goodBins); $bin<$LADCP{N_BINS}; $bin++) { # NB: 2 good bins implies that bin 2 is bad |
|
271 |
next unless ($bin>=0 && defined($LADCP{ENSEMBLE}[$e]->{W}[$bin])); |
|
272 |
$dirty = 1; |
|
273 |
$nvrm++; |
|
274 |
undef($LADCP{ENSEMBLE}[$e]->{W}[$bin]); |
|
275 |
} |
|
276 |
||
277 |
$nerm += $dirty; |
|
278 |
} |
|
279 |
return ($nvrm,$nerm); |
|
280 |
} |
|
281 |
||
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
282 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
283 |
#====================================================================== |
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
284 |
# ($nvrm,$nerm) = editPPI($fromEns,$toEns,$water_depth) |
15 | 285 |
# |
286 |
# NOTES: |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
287 |
# - for UL, water_depth == undef; for DL water_depth is always defined, |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
288 |
# or else editPPI is not called |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
289 |
# - when this code is executed a suitable UL or DL depth-average-soundspeed |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
290 |
# profile (@DASSprof at 1m resolution) is available |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
291 |
# - PPI layer is defined by the shortest and longest acoustic paths |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
292 |
# between transducer and seabed that contribute significantly to the |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
293 |
# backscatter |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
294 |
# - shortest path (shallow limit): |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
295 |
# - distance to seabed => sidelobe |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
296 |
# - min_lim = water_depth - DASSprof[CTD_depth]*DeltaT/2 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
297 |
# - longest path (deep limit): |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
298 |
# - outer edge of main lobe of one of the beams (depending on |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
299 |
# instrument tilt) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
300 |
# - nominal half-beam apertures at half peak signal strength |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
301 |
# (-3dB), RDI BB Primer, pp. 35f (2ND COLUMN) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
302 |
# WH1200 1.4 2.4 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
303 |
# WH600 1.5 2.5 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
304 |
# WH300 2.2 3.7 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
305 |
# WH150 4.0 6.7 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
306 |
# WH75 5.0 8.4 |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
307 |
# - for WH150, Fig. 23 indicates that half-beam-width |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
308 |
# at -5dB (<1% peak signal strength) is about 5/3 of same |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
309 |
# at -3dB => PPI limit choice (3rd column above) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
310 |
# - [Plots/2014_P16_043.eps]: |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
311 |
# - mean tilt of 2 degrees included in effects |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
312 |
# - finite pulse length means that there actually |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
313 |
# is less elapsed time between the end of the sending |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
314 |
# and the beginning of the reception than the ping |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
315 |
# interval suggests; without it, the PPI peak depth |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
316 |
# does not agree with the prediction |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
317 |
# - note that there is no PPI effect possible above |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
318 |
# the dark blue line --- this is a hard limit |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
319 |
# (I checked ping interval to within 0.001, |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
320 |
# water depth is known better than 2m, sound |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
321 |
# speed is accurately accounted for (as indicated |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
322 |
# by the cyan line), so the variability above |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
323 |
# is due to background variability, which is |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
324 |
# consistent with the shape of the curve outside |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
325 |
# the PPI layer |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
326 |
# => PPI peak can be tightly bracketed but care has to |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
327 |
# be taken to account for finite beam width & |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
328 |
# instrument beam_tilt = max(|pitch|,|roll|) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
329 |
# - while the upper limit of the PPI layer is unambiguous, this |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
330 |
# is only true if the recorded ping intervals are accurate |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
331 |
# - 2014 CLIVAR P16 #47 shows a slight discontinuity in dc_w near |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
332 |
# the middle of the upper PPI layer (4000m) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
333 |
# - the discontinuity is slightly more pronounced with PPI editing |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
334 |
# enabled |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
335 |
# - setting $PPI_extend_upper_limit = 1.03 (or 1.04, 1.05, 1.1) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
336 |
# reduces the discontinuity to the level without PPI filtering, but |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
337 |
# not any better |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
338 |
# - overall I am not convinced that the discontinuity is related |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
339 |
# to PPI; therefore, $PPI_extend_upper_limit is not set by default |
15 | 340 |
#====================================================================== |
341 |
||
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
342 |
{ my($bha); # beam half aperture (static scope) |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
343 |
|
15 | 344 |
sub editPPI($$$) |
345 |
{ |
|
346 |
my($fe,$te,$wd) = @_; # first & last ens to process, water depth for downlooker |
|
347 |
my($nvrm) = 0; # of velocities removed |
|
348 |
my($nerm) = 0; # of ensembles affected |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
349 |
|
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
350 |
unless (defined($bha)) { |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
351 |
if ($LADCP{BEAM_FREQUENCY} == 1200) { $bha = 2.4; } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
352 |
elsif ($LADCP{BEAM_FREQUENCY} == 600) { $bha = 2.5; } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
353 |
elsif ($LADCP{BEAM_FREQUENCY} == 300) { $bha = 3.7; } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
354 |
elsif ($LADCP{BEAM_FREQUENCY} == 150) { $bha = 6.7; } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
355 |
elsif ($LADCP{BEAM_FREQUENCY} == 75) { $bha = 8.4; } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
356 |
else { croak("$0: unexpected transducer frequency $LADCP{BEAM_FREQUENCY}\n"); } |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
357 |
} |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
358 |
|
15 | 359 |
for (my($e)=$fe; $e<=$te; $e++) { |
360 |
next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}); |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
361 |
next unless ($e > 0); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
362 |
|
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
363 |
my($delta_t) = $LADCP{ENSEMBLE}[$e]->{UNIX_TIME} - $LADCP{ENSEMBLE}[$e-1]->{UNIX_TIME}; |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
364 |
my($dz_max) = $DASSprof[int($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH})]*$delta_t / 2; |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
365 |
my($beam_tilt) = max(abs($LADCP{ENSEMBLE}[$e]->{GIMBAL_PITCH}), |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
366 |
abs($LADCP{ENSEMBLE}[$e]->{ROLL})); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
367 |
my($dz_min) = $dz_max * cos(rad($LADCP{BEAM_ANGLE} + $beam_tilt + $bha)); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
368 |
my(@bd) = calc_binDepths($e); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
369 |
|
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
370 |
$dz_max *= $PPI_extend_upper_limit |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
371 |
if numberp($PPI_extend_upper_limit); |
15 | 372 |
|
373 |
my($dirty) = 0; |
|
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
374 |
for (my($bin)=$LADCP_firstBin-1; $bin<$LADCP_lastBin; $bin++) { |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
375 |
next unless (defined($LADCP{ENSEMBLE}[$e]->{W}[$bin])); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
376 |
if (defined($wd)) { # DL |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
377 |
next unless ($bd[$bin] >= $wd-$dz_max && $bd[$bin] <= $wd-$dz_min); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
378 |
} else { # UL |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
379 |
next unless ($bd[$bin] <= $dz_max && $bd[$bin] >= $dz_min); |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
380 |
} |
15 | 381 |
$dirty = 1; |
382 |
$nvrm++; |
|
383 |
undef($LADCP{ENSEMBLE}[$e]->{W}[$bin]); |
|
384 |
} |
|
385 |
||
386 |
$nerm += $dirty; |
|
387 |
} |
|
388 |
return ($nvrm,$nerm); |
|
389 |
} |
|
390 |
||
16
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
391 |
} # static scope for $bha |
29e867b3e070
whoosher version at beginning of FZ1
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
15
diff
changeset
|
392 |
|
15 | 393 |
|
394 |
#====================================================================== |
|
4
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
395 |
# $nerm = editSurfLayer($fromEns,$toEns,$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
|
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 |
# NOTES: |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
398 |
# 1) When this code is executed the fully corrected instrument and |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
399 |
# bin depths are known |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
400 |
# 2) This code was inspired by 2011_IWISE station 8 |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
401 |
# 3) No point in counting the deleted velocities |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
402 |
#====================================================================== |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
403 |
|
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
404 |
sub editSurfLayer($$$) |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
405 |
{ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
406 |
my($fe,$te,$sld) = @_; # first & last ens to process |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
407 |
my($nerm) = 0; # of ensembles affected |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
408 |
for (my($e)=$fe; $e<=$te; $e++) { |
10
7e76fdef8953
version prior to carrying out separate dc-/uc- time lagging
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
6
diff
changeset
|
409 |
next unless numberp($LADCP{ENSEMBLE}[$e]->{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
|
410 |
undef($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH}),$nerm++ |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
411 |
if ($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH} <= $sld); |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
412 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
413 |
return $nerm; |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
414 |
} |
e681262d0fd7
yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
3
diff
changeset
|
415 |
|
0 | 416 |
1; |