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

filter: Statementstmt 0.0% 0 / 108 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 19 Podpod 0.0% 0 / 17 totaltotal 0.0% 0 / 170 CC 14 SCAR 16.6
CC
14
Cov
0%
anis1
6.0
anis2
6.0
dtratio
6.0
CRAP 5.2
1 package App::SeismicUnixGui::sunix::NMO_Vel_Stk::suvelan;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUVELAN - compute stacking velocity semblance for cdp gathers
8
9 AUTHOR: Juan Lorenzo (Perl module only)
10
11 DATE: Dec 1 2013, Nov. 2, 2018, Chang Liu
12
13 DESCRIPTION:
14
15 Version:
16  
17 =head2 USE
18  
19 =head3 NOTES
20  
21 Distances (and velocities) need to be scaled by the user
22 a scaling factor is needed to match
23 scalel found in data headers
24 suvelan DOES not take scaleco or scalel into consdieration
25 automatically
26  
27 =head4 Examples
28  
29 =head3 SEISMIC UNIX NOTES
30  
31 SUVELAN - compute stacking velocity semblance for cdp gathers
32  
33 suvelan <stdin >stdout [optional parameters]
34  
35 Optional Parameters:
36 nv=50 number of velocities
37 dv=50.0 velocity sampling interval
38 fv=1500.0 first velocity
39 anis1=0.0 quartic term, numerator of an extended quartic term
40 anis2=0.0 in denominator of an extended quartic term
41 smute=1.5 samples with NMO stretch exceeding smute are zeroed
42 dtratio=5 ratio of output to input time sampling intervals
43 nsmooth=dtratio*2+1 length of semblance num and den smoothing window
44 verbose=0 =1 for diagnostic print on stderr
45 pwr=1.0 semblance value to the power
46  
47 Notes:
48 Velocity analysis is usually a two-dimensional screen for optimal values of
49 the vertical two-way traveltime and stacking velocity. But if the travel-
50 time curve is no longer close to a hyperbola, the quartic term of the
51 traveltime series should be considered. In its easiest form (with anis2=0)
52 the optimizion of all parameters requires a three-dimensional screen. This
53 is done by a repetition of the conventional two-dimensional screen with a
54 though the function is no more a polynomial. When screening for optimal
55 values the theoretical dependencies between these paramters can be taken
56 into account. The traveltime function is defined by
57  
58 1 anis1
59 t^2 = t_0^2 + --- x^2 + ------------- x^4
60 v^2 1 + anis2 x^2
61  
62 The coefficients anis1, anis2 are assumed to be small, that means the non-
63 hyperbolicity is assumed to be small. Triplications cannot be handled.
64  
65 Semblance is defined by the following quotient:
66  
67 n-1
68 [ sum q(t,j) ]^2
69 j=0
70 s(t) = ------------------
71 n-1
72 n sum [q(t,j)]^2
73 j=0
74  
75 where n is the number of non-zero samples after muting.
76 Smoothing (nsmooth) is applied separately to the numerator and denominator
77 before computing this semblance quotient.
78  
79 Then, the semblance is set to the power of the parameter pwr. With pwr > 1
80 the difference between semblance values is stretched in the upper half of
81 the range of semblance values [0,1], but compressed in the lower half of
82 it; thus, the few large semblance values are enhanced. With pwr < 1 the
83 many small values are enhanced, thus more discernible against background
84 noise. Of course, always at the expense of the respective other feature.
85  
86 Input traces should be sorted by cdp - suvelan outputs a group of
87 semblance traces every time cdp changes. Therefore, the output will
88 be useful only if cdp gathers are input.
89  
90 Credits:
91 CWP, Colorado School of Mines:
92 Dave Hale (everything except ...)
93 Bjoern Rommel (... the quartic term)
94 SINTEF, IKU Petroleumsforskning
95 Bjoern Rommel (... the power-of-semblance function)
96  
97 Trace header fields accessed: ns, dt, delrt, offset, cdp
98 Trace header fields modified: ns, dt, offset, cdp
99  
100 =head2 CHANGES and their DATES
101  
102  
103  
104 =cut
105  
106 use Moose;
107 our $VERSION = '0.0.1';
108 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
109  
110 my $get = L_SU_global_constants->new();
111  
112 my $var = $get->var();
113 my $empty_string = $var->{_empty_string};
114  
115 my $suvelan = {
116 _anis1 => '',
117 _anis2 => '',
118 _dtratio => '',
119 _dv => '',
120 _fv => '',
121 _nsmooth => '',
122 _nv => '',
123 _pwr => '',
124 _smute => '',
125 _verbose => '',
126 _Step => '',
127 _note => '',
128 };
129  
130 =head2 sub Step
131  
132 collects switches and assembles bash instructions
133 by adding the program name
134  
135 =cut
136  
137 sub Step {
138  
139 $suvelan->{_Step} = 'suvelan' . $suvelan->{_Step};
140 return ( $suvelan->{_Step} );
141  
142 }
143  
144 =head2 sub note
145  
146 collects switches and assembles bash instructions
147 by adding the program name
148  
149 =cut
150  
151 sub note {
152  
153 $suvelan->{_note} = 'suvelan' . $suvelan->{_note};
154 return ( $suvelan->{_note} );
155  
156 }
157  
158 =head2 sub clear
159  
160 =cut
161  
162 sub clear {
163  
164 $suvelan->{_anis1} = '';
165 $suvelan->{_anis2} = '';
166 $suvelan->{_dtratio} = '';
167 $suvelan->{_dv} = '';
168 $suvelan->{_fv} = '';
169 $suvelan->{_nsmooth} = '';
170 $suvelan->{_nv} = '';
171 $suvelan->{_pwr} = '';
172 $suvelan->{_smute} = '';
173 $suvelan->{_verbose} = '';
174 $suvelan->{_Step} = '';
175 $suvelan->{_note} = '';
176 }
177  
178 =head2 sub anis1
179  
180  
181 =cut
182  
183 sub anis1 {
184  
185 my ( $self, $anis1 ) = @_;
186 if ( $anis1 ne $empty_string ) {
187  
188 $suvelan->{_anis1} = $anis1;
189 $suvelan->{_note} =
190 $suvelan->{_note} . ' anis1=' . $suvelan->{_anis1};
191 $suvelan->{_Step} =
192 $suvelan->{_Step} . ' anis1=' . $suvelan->{_anis1};
193  
194 }
195 else {
196 print("suvelan, anis1, missing anis1,\n");
197 }
198 }
199  
200 =head2 sub anis2
201  
202  
203 =cut
204  
205 sub anis2 {
206  
207 my ( $self, $anis2 ) = @_;
208 if ( $anis2 ne $empty_string ) {
209  
210 $suvelan->{_anis2} = $anis2;
211 $suvelan->{_note} =
212 $suvelan->{_note} . ' anis2=' . $suvelan->{_anis2};
213 $suvelan->{_Step} =
214 $suvelan->{_Step} . ' anis2=' . $suvelan->{_anis2};
215  
216 }
217 else {
218 print("suvelan, anis2, missing anis2,\n");
219 }
220 }
221  
222 =head2 sub dtratio
223  
224  
225 =cut
226  
227 sub dtratio {
228  
229 my ( $self, $dtratio ) = @_;
230 if ($dtratio) {
231  
232 $suvelan->{_dtratio} = $dtratio;
233 $suvelan->{_note} =
234 $suvelan->{_note} . ' dtratio=' . $suvelan->{_dtratio};
235 $suvelan->{_Step} =
236 $suvelan->{_Step} . ' dtratio=' . $suvelan->{_dtratio};
237  
238 }
239 else {
240 print("suvelan, dtratio, missing dtratio,\n");
241 }
242 }
243  
244 =head2 sub dv
245  
246 defines the size of the velocity steps
247 to use in the semblance analysis
248  
249 =cut
250  
251 sub dv {
252  
253 my ( $self, $dv ) = @_;
254 if ($dv) {
255  
256 $suvelan->{_dv} = $dv;
257 $suvelan->{_note} = $suvelan->{_note} . ' dv=' . $suvelan->{_dv};
258 $suvelan->{_Step} = $suvelan->{_Step} . ' dv=' . $suvelan->{_dv};
259  
260 }
261 else {
262 print("suvelan, dv, missing dv,\n");
263 }
264 }
265  
266 =head2 sub first_velocity
267  
268 defines the first velocity value to use in the semblance analysis
269  
270  
271 =cut
272  
273 sub first_velocity {
274  
275 my ( $self, $fv ) = @_;
276 if ($fv) {
277  
278 $suvelan->{_fv} = $fv;
279 $suvelan->{_note} = $suvelan->{_note} . ' fv=' . $suvelan->{_fv};
280 $suvelan->{_Step} = $suvelan->{_Step} . ' fv=' . $suvelan->{_fv};
281  
282 }
283 else {
284 print("suvelan, first_velocity, missing first_velocity,\n");
285 }
286 }
287  
288 =head2 sub fv
289  
290 defines the first velocity value to use in the semblance analysis
291  
292  
293 =cut
294  
295 sub fv {
296  
297 my ( $self, $fv ) = @_;
298 if ($fv) {
299  
300 $suvelan->{_fv} = $fv;
301 $suvelan->{_note} = $suvelan->{_note} . ' fv=' . $suvelan->{_fv};
302 $suvelan->{_Step} = $suvelan->{_Step} . ' fv=' . $suvelan->{_fv};
303  
304 }
305 else {
306 print("suvelan, fv, missing fv,\n");
307 }
308 }
309  
310 =head2 sub nsmooth
311  
312  
313 =cut
314  
315 sub nsmooth {
316  
317 my ( $self, $nsmooth ) = @_;
318 if ( $nsmooth ne $empty_string ) {
319  
320 $suvelan->{_nsmooth} = $nsmooth;
321 $suvelan->{_note} =
322 $suvelan->{_note} . ' nsmooth=' . $suvelan->{_nsmooth};
323 $suvelan->{_Step} =
324 $suvelan->{_Step} . ' nsmooth=' . $suvelan->{_nsmooth};
325  
326 }
327 else {
328 print("suvelan, nsmooth, missing nsmooth,\n");
329 }
330 }
331  
332 =head2 sub number_of_velocities
333  
334 sets the number of velocities
335  
336 =cut
337  
338 sub number_of_velocities {
339  
340 my ( $self, $nv ) = @_;
341 if ($nv) {
342  
343 $suvelan->{_nv} = $nv;
344 $suvelan->{_note} = $suvelan->{_note} . ' nv=' . $suvelan->{_nv};
345 $suvelan->{_Step} = $suvelan->{_Step} . ' nv=' . $suvelan->{_nv};
346  
347 }
348 else {
349 print("suvelan, number_of_velocities missing number_of_velocities\n");
350 }
351 }
352  
353 =head2 sub nv
354  
355 sets the number of velocities
356  
357 =cut
358  
359 sub nv {
360  
361 my ( $self, $nv ) = @_;
362 if ($nv) {
363  
364 $suvelan->{_nv} = $nv;
365 $suvelan->{_note} = $suvelan->{_note} . ' nv=' . $suvelan->{_nv};
366 $suvelan->{_Step} = $suvelan->{_Step} . ' nv=' . $suvelan->{_nv};
367  
368 }
369 else {
370 print("suvelan, nv, missing nv,\n");
371 }
372 }
373  
374 =head2 sub pwr
375  
376  
377 =cut
378  
379 sub pwr {
380  
381 my ( $self, $pwr ) = @_;
382 if ($pwr) {
383  
384 $suvelan->{_pwr} = $pwr;
385 $suvelan->{_note} = $suvelan->{_note} . ' pwr=' . $suvelan->{_pwr};
386 $suvelan->{_Step} = $suvelan->{_Step} . ' pwr=' . $suvelan->{_pwr};
387  
388 }
389 else {
390 print("suvelan, pwr, missing pwr,\n");
391 }
392 }
393  
394 =head2 sub smute
395  
396  
397 =cut
398  
399 sub smute {
400  
401 my ( $self, $smute ) = @_;
402 if ($smute) {
403  
404 $suvelan->{_smute} = $smute;
405 $suvelan->{_note} =
406 $suvelan->{_note} . ' smute=' . $suvelan->{_smute};
407 $suvelan->{_Step} =
408 $suvelan->{_Step} . ' smute=' . $suvelan->{_smute};
409  
410 }
411 else {
412 print("suvelan, smute, missing smute,\n");
413 }
414 }
415  
416 =head2 sub velocity_incrementdv
417  
418 defines the size of the velocity steps
419 to use in the semblance analysis
420  
421 =cut
422  
423 sub velocity_increment {
424  
425 my ( $self, $dv ) = @_;
426 if ($dv) {
427  
428 $suvelan->{_dv} = $dv;
429 $suvelan->{_note} = $suvelan->{_note} . ' dv=' . $suvelan->{_dv};
430 $suvelan->{_Step} = $suvelan->{_Step} . ' dv=' . $suvelan->{_dv};
431  
432 }
433 else {
434 print("suvelan, velocity_increment, missing velocity_increment,\n");
435 }
436 }
437  
438 =head2 sub verbose
439  
440  
441 =cut
442  
443 sub verbose {
444  
445 my ( $self, $verbose ) = @_;
446 if ( $verbose ne $empty_string ) {
447  
448 $suvelan->{_verbose} = $verbose;
449 $suvelan->{_note} =
450 $suvelan->{_note} . ' verbose=' . $suvelan->{_verbose};
451 $suvelan->{_Step} =
452 $suvelan->{_Step} . ' verbose=' . $suvelan->{_verbose};
453  
454 }
455 else {
456 print("suvelan, verbose, missing verbose,\n");
457 }
458 }
459  
460 =head2 sub get_max_index
461
462 max index = number of input variables -1
463
464 =cut
465  
466 sub get_max_index {
467 my ($self) = @_;
468 my $max_index = 9;
469  
470 return ($max_index);
471 }
472  
473 1;