lib/App/SeismicUnixGui/sunix/NMO_Vel_Stk/sudivstack.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 80 CC 4 SCAR 13.1
CC
4
Cov
0%
key
6.0
peak
6.0
winlen
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::NMO_Vel_Stk::sudivstack;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (Perl module only)
8  
9 DATE:
10  
11 DESCRIPTION:
12  
13 Version:
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4 Examples
20  
21 =head2 SYNOPSIS
22  
23 =head3 SEISMIC UNIX NOTES
24 SUDIVSTACK - Diversity Stacking using either average power or peak
25  
26 power within windows
27  
28  
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameters:
39  
40 key=tracf key header word to stack on
41  
42 winlen=0.064 window length in seconds.
43  
44 typical choices: 0.064, 0.128, 0.256,
45  
46 0.512, 1.024, 2.048, 4.096
47  
48 if not specified the entire trace is used
49  
50  
51  
52 peak=1 peak power option default is average power
53  
54  
55  
56 Notes:
57  
58 Diversity stacking is a noise reduction technique used in the
59  
60 summation of duplicate data. Each trace is scaled by the inverse
61  
62 of its average power prior to stacking. The composite trace is
63  
64 then renormalized by dividing by the sum of the scalers used.
65  
66  
67  
68 This program stacks adjacent traces having the same key header
69  
70 word, which can be specified by the key parameter. The default
71  
72 is "tracf" (trace number within field record).
73  
74 For more information on key header words, type "sukeyword -o".
75  
76  
77  
78 Examples:
79  
80 For duplicate field shot records:
81  
82 susort < field.data tracf | sudivstack > stack.data
83  
84 For CDP ordered data:
85  
86 sudivstack < cdp.data key=cdp > stack.data
87  
88  
89  
90  
91  
92
93  
94 Author: Mary Palen-Murphy,
95  
96 Masters' candidate, Colorado School of Mines,
97  
98 Geophysics Department, 1994
99  
100  
101  
102 Implementation of "key=" option: Nils Maercklin,
103  
104 GeoForschungsZentrum (GFZ) Potsdam, Germany, 2002.
105  
106  
107  
108 References:
109  
110  
111  
112 Embree, P.,1968, Diversity seismic record stacking method and system:
113  
114 U.S. patent 3,398,396.
115  
116 Gimlin, D. R., and Smith, J. W., 1980, A comparison of seismic trace
117  
118 summing techniques: Geophysics, vol. 45, pages 1017-1041.
119  
120  
121  
122 Trace header fields accessed: ns, dt, key=keyword
123  
124 Trace header fields modified: tracl
125  
126  
127  
128  
129  
130 =head2 User's notes (Juan Lorenzo)
131 untested
132  
133 =cut
134  
135  
136 =head2 CHANGES and their DATES
137  
138 =cut
139  
140 use Moose;
141 our $VERSION = '0.0.1';
142  
143  
144 =head2 Import packages
145  
146 =cut
147  
148 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
149  
150 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
151 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
152  
153  
154 =head2 instantiation of packages
155  
156 =cut
157  
158 my $get = L_SU_global_constants->new();
159 my $Project = Project_config->new();
160 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
161 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
162 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
163  
164 my $PS_SEISMIC = $Project->PS_SEISMIC();
165  
166 my $var = $get->var();
167 my $on = $var->{_on};
168 my $off = $var->{_off};
169 my $true = $var->{_true};
170 my $false = $var->{_false};
171 my $empty_string = $var->{_empty_string};
172  
173 =head2 Encapsulated
174 hash of private variables
175  
176 =cut
177  
178 my $sudivstack = {
179 _key => '',
180 _peak => '',
181 _winlen => '',
182 _Step => '',
183 _note => '',
184  
185 };
186  
187 =head2 sub Step
188  
189 collects switches and assembles bash instructions
190 by adding the program name
191  
192 =cut
193  
194 sub Step {
195  
196 $sudivstack->{_Step} = 'sudivstack'.$sudivstack->{_Step};
197 return ( $sudivstack->{_Step} );
198  
199 }
200  
201  
202 =head2 sub note
203  
204 collects switches and assembles bash instructions
205 by adding the program name
206  
207 =cut
208  
209 sub note {
210  
211 $sudivstack->{_note} = 'sudivstack'.$sudivstack->{_note};
212 return ( $sudivstack->{_note} );
213  
214 }
215  
216  
217  
218 =head2 sub clear
219  
220 =cut
221  
222 sub clear {
223  
224 $sudivstack->{_key} = '';
225 $sudivstack->{_peak} = '';
226 $sudivstack->{_winlen} = '';
227 $sudivstack->{_Step} = '';
228 $sudivstack->{_note} = '';
229 }
230  
231  
232 =head2 sub key
233  
234  
235 =cut
236  
237 sub key {
238  
239 my ( $self,$key ) = @_;
240 if ( $key ne $empty_string ) {
241  
242 $sudivstack->{_key} = $key;
243 $sudivstack->{_note} = $sudivstack->{_note}.' key='.$sudivstack->{_key};
244 $sudivstack->{_Step} = $sudivstack->{_Step}.' key='.$sudivstack->{_key};
245  
246 } else {
247 print("sudivstack, key, missing key,\n");
248 }
249 }
250  
251  
252 =head2 sub peak
253  
254  
255 =cut
256  
257 sub peak {
258  
259 my ( $self,$peak ) = @_;
260 if ( $peak ne $empty_string ) {
261  
262 $sudivstack->{_peak} = $peak;
263 $sudivstack->{_note} = $sudivstack->{_note}.' peak='.$sudivstack->{_peak};
264 $sudivstack->{_Step} = $sudivstack->{_Step}.' peak='.$sudivstack->{_peak};
265  
266 } else {
267 print("sudivstack, peak, missing peak,\n");
268 }
269 }
270  
271  
272 =head2 sub winlen
273  
274  
275 =cut
276  
277 sub winlen {
278  
279 my ( $self,$winlen ) = @_;
280 if ( $winlen ne $empty_string ) {
281  
282 $sudivstack->{_winlen} = $winlen;
283 $sudivstack->{_note} = $sudivstack->{_note}.' winlen='.$sudivstack->{_winlen};
284 $sudivstack->{_Step} = $sudivstack->{_Step}.' winlen='.$sudivstack->{_winlen};
285  
286 } else {
287 print("sudivstack, winlen, missing winlen,\n");
288 }
289 }
290  
291  
292 =head2 sub get_max_index
293  
294 max index = number of input variables -1
295
296 =cut
297
298 sub get_max_index {
299 my ($self) = @_;
300 my $max_index = 2;
301  
302 return($max_index);
303 }
304
305
306 1;