lib/App/SeismicUnixGui/sunix/statsMath/sualford.pm untested

filter: Statementstmt 0.0% 0 / 153 Branchbran 0.0% 0 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 25 Podpod 0.0% 0 / 21 totaltotal 0.0% 0 / 233 CC 18 SCAR 16.6
CC
18
Cov
0%
Az_key
6.0
Q_key
6.0
angle_inc
6.0
CRAP 5.2
1 package App::SeismicUnixGui::sunix::statsMath::sualford;
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 SUALFORD - trace by trace Alford Rotation of shear wave data volumes
25  
26  
27  
28 sualford inS11=file1 inS22=file2 inS12=file3 inS21=file4
29  
30 outS11=file5 outS22=file6 outS12=file7 outS21=file8 [optional
31  
32 parameters]
33  
34  
35  
36 Required Parameters:
37  
38 inS11= input data volume for the 11 component
39  
40 inS12= input data volume for the 12 component
41  
42 inS21= input data volume for the 21 component
43  
44 inS22= input data volume for the 22 component
45  
46 outS11= output data volume for the 11 component
47  
48 outS12= output data volume for the 11 component
49  
50 outS21= output data volume for the 11 component
51  
52 outS22= output data volume for the 11 component
53  
54  
55  
56 Optional parameters:
57  
58 angle_inc= sets the increment to the angle by which
59  
60 the data sets are rotated. The minimum is
61  
62 set to be 1 degree and default is 5.
63  
64 Az_key= to set the header field storing the azimuths
65  
66 for the fast shear wave on the output volumes
67  
68 Q_key= to set the header field storing the quality
69  
70 factors of performed optimum rotations
71  
72 lag_key= to set the header field storing the lag in
73  
74 miliseconds the fast and slow shear components
75  
76 xcorr_key= to set the header field containing the maxi-
77  
78 mum normalized cross-correlation between the
79  
80 and slow shear waves.
81  
82 taper= 2*taper+1 is the length of the sample overlap
83  
84 between the unrotated data with the rotated
85  
86 data on the traces. The boundary between them
87  
88 is defined by time windowning.
89  
90 taper = -1, for no-overlap
91  
92 taper = 0, for overlap of one sample
93  
94 taper =>1, for use of cosine scale to
95  
96 to interpolate between the
97  
98 unrotated and rotated parts
99  
100 of the traces
101  
102  
103  
104 taperwin= another taper used to taper the data within
105  
106 the window of analysis to diminish the effect
107  
108 of data near the window edges.In this way one
109  
110 can focus on a given reflector. Also given in
111  
112 number of samples
113  
114  
115  
116 maxlag= maximum limit in ms for the lag between fast
117  
118 and slow shear waves. If this threshold is
119  
120 attained or surpassed, the quality factor for
121  
122 the rotation is zeroed as well as all the
123  
124 parameters found for that certain rotation
125  
126  
127  
128  
129  
130 ntraces= number of traces to be used per computation
131  
132 ntraces=3 will use three adjacent traces to
133  
134 compute the angle of rotation "
135  
136  
137  
138 Notes:
139  
140  
141  
142 The Alford Rotation is a method to rotate the four components
143  
144 of a shear wave survey into its natural coordinate system, where
145  
146 the fast and slow shear correspond to the inline to inline shear (S11)
147  
148 and xline to xline (S22) volumes, respectively.
149  
150  
151  
152 This Alford Rotation code tries to maximize the energy in the
153  
154 diagonal volumes, i.e., S11 and S22, while minimizing the energy
155  
156 in the off-diagonals, i.e., in volumes S12 and S21, in a trace by
157  
158 trace manner. It then returns the new rotated volumes, saving the
159  
160 the quality factor for the rotation and azimuth angle of the fast
161  
162 shear wave direction for each trace headers of the new rotated S11
163  
164 volume.
165  
166  
167  
168 The fields in the header containing the Azimuth and Quality factor
169  
170 and the sample lag between fast and slow shear are otrav, grnolf and
171  
172 grnofr, respectively, by default. The values are multiplied by ten in
173  
174 the case of the angles and by a thousand for quality factors. To
175  
176 change this defaults use the optional parameters Az_key, Q_key and
177  
178 lag_key
179  
180  
181  
182
183  
184 modified header fields:
185  
186 the ones specified by Az_key, Q_key, lag_key and xcorr_key. By default
187  
188 these are otrav, grnlof, tstat and grnors, respectively.
189  
190  
191  
192 Credits:
193  
194 CWP: Rodrigo Felicio Fuck
195  
196 Code translated and adapted from original version in Fortran
197  
198 by Ted Schuck (1993)
199  
200  
201  
202  
203  
204 Schuck, E. L. , 1993, Multicomponent, three dimensional seismic
205  
206 characterization of a fractured coalbed methane reservoir,
207  
208 Cedar Hill Field, San Juan County, New Mexico, Ph.D. Thesis,
209  
210 Colorado School of Mines
211  
212  
213  
214  
215  
216 =head2 User's notes (Juan Lorenzo)
217 untested
218  
219 =cut
220  
221  
222 =head2 CHANGES and their DATES
223  
224 =cut
225  
226 use Moose;
227 our $VERSION = '0.0.1';
228  
229  
230 =head2 Import packages
231  
232 =cut
233  
234 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
235  
236 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
237 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
238  
239  
240 =head2 instantiation of packages
241  
242 =cut
243  
244 my $get = L_SU_global_constants->new();
245 my $Project = Project_config->new();
246 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
247 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
248 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
249  
250 my $var = $get->var();
251 my $on = $var->{_on};
252 my $off = $var->{_off};
253 my $true = $var->{_true};
254 my $false = $var->{_false};
255 my $empty_string = $var->{_empty_string};
256  
257 =head2 Encapsulated
258 hash of private variables
259  
260 =cut
261  
262 my $sualford = {
263 _Az_key => '',
264 _Q_key => '',
265 _angle_inc => '',
266 _inS11 => '',
267 _inS12 => '',
268 _inS21 => '',
269 _inS22 => '',
270 _lag_key => '',
271 _maxlag => '',
272 _ntraces => '',
273 _outS11 => '',
274 _outS12 => '',
275 _outS21 => '',
276 _outS22 => '',
277 _taper => '',
278 _taperwin => '',
279 _xcorr_key => '',
280 _Step => '',
281 _note => '',
282  
283 };
284  
285 =head2 sub Step
286  
287 collects switches and assembles bash instructions
288 by adding the program name
289  
290 =cut
291  
292 sub Step {
293  
294 $sualford->{_Step} = 'sualford'.$sualford->{_Step};
295 return ( $sualford->{_Step} );
296  
297 }
298  
299  
300 =head2 sub note
301  
302 collects switches and assembles bash instructions
303 by adding the program name
304  
305 =cut
306  
307 sub note {
308  
309 $sualford->{_note} = 'sualford'.$sualford->{_note};
310 return ( $sualford->{_note} );
311  
312 }
313  
314  
315  
316 =head2 sub clear
317  
318 =cut
319  
320 sub clear {
321  
322 $sualford->{_Az_key} = '';
323 $sualford->{_Q_key} = '';
324 $sualford->{_angle_inc} = '';
325 $sualford->{_inS11} = '';
326 $sualford->{_inS12} = '';
327 $sualford->{_inS21} = '';
328 $sualford->{_inS22} = '';
329 $sualford->{_lag_key} = '';
330 $sualford->{_maxlag} = '';
331 $sualford->{_ntraces} = '';
332 $sualford->{_outS11} = '';
333 $sualford->{_outS12} = '';
334 $sualford->{_outS21} = '';
335 $sualford->{_outS22} = '';
336 $sualford->{_taper} = '';
337 $sualford->{_taperwin} = '';
338 $sualford->{_xcorr_key} = '';
339 $sualford->{_Step} = '';
340 $sualford->{_note} = '';
341 }
342  
343  
344 =head2 sub Az_key
345  
346  
347 =cut
348  
349 sub Az_key {
350  
351 my ( $self,$Az_key ) = @_;
352 if ( $Az_key ne $empty_string ) {
353  
354 $sualford->{_Az_key} = $Az_key;
355 $sualford->{_note} = $sualford->{_note}.' Az_key='.$sualford->{_Az_key};
356 $sualford->{_Step} = $sualford->{_Step}.' Az_key='.$sualford->{_Az_key};
357  
358 } else {
359 print("sualford, Az_key, missing Az_key,\n");
360 }
361 }
362  
363  
364 =head2 sub Q_key
365  
366  
367 =cut
368  
369 sub Q_key {
370  
371 my ( $self,$Q_key ) = @_;
372 if ( $Q_key ne $empty_string ) {
373  
374 $sualford->{_Q_key} = $Q_key;
375 $sualford->{_note} = $sualford->{_note}.' Q_key='.$sualford->{_Q_key};
376 $sualford->{_Step} = $sualford->{_Step}.' Q_key='.$sualford->{_Q_key};
377  
378 } else {
379 print("sualford, Q_key, missing Q_key,\n");
380 }
381 }
382  
383  
384 =head2 sub angle_inc
385  
386  
387 =cut
388  
389 sub angle_inc {
390  
391 my ( $self,$angle_inc ) = @_;
392 if ( $angle_inc ne $empty_string ) {
393  
394 $sualford->{_angle_inc} = $angle_inc;
395 $sualford->{_note} = $sualford->{_note}.' angle_inc='.$sualford->{_angle_inc};
396 $sualford->{_Step} = $sualford->{_Step}.' angle_inc='.$sualford->{_angle_inc};
397  
398 } else {
399 print("sualford, angle_inc, missing angle_inc,\n");
400 }
401 }
402  
403  
404 =head2 sub inS11
405  
406  
407 =cut
408  
409 sub inS11 {
410  
411 my ( $self,$inS11 ) = @_;
412 if ( $inS11 ne $empty_string ) {
413  
414 $sualford->{_inS11} = $inS11;
415 $sualford->{_note} = $sualford->{_note}.' inS11='.$sualford->{_inS11};
416 $sualford->{_Step} = $sualford->{_Step}.' inS11='.$sualford->{_inS11};
417  
418 } else {
419 print("sualford, inS11, missing inS11,\n");
420 }
421 }
422  
423  
424 =head2 sub inS12
425  
426  
427 =cut
428  
429 sub inS12 {
430  
431 my ( $self,$inS12 ) = @_;
432 if ( $inS12 ne $empty_string ) {
433  
434 $sualford->{_inS12} = $inS12;
435 $sualford->{_note} = $sualford->{_note}.' inS12='.$sualford->{_inS12};
436 $sualford->{_Step} = $sualford->{_Step}.' inS12='.$sualford->{_inS12};
437  
438 } else {
439 print("sualford, inS12, missing inS12,\n");
440 }
441 }
442  
443  
444 =head2 sub inS21
445  
446  
447 =cut
448  
449 sub inS21 {
450  
451 my ( $self,$inS21 ) = @_;
452 if ( $inS21 ne $empty_string ) {
453  
454 $sualford->{_inS21} = $inS21;
455 $sualford->{_note} = $sualford->{_note}.' inS21='.$sualford->{_inS21};
456 $sualford->{_Step} = $sualford->{_Step}.' inS21='.$sualford->{_inS21};
457  
458 } else {
459 print("sualford, inS21, missing inS21,\n");
460 }
461 }
462  
463  
464 =head2 sub inS22
465  
466  
467 =cut
468  
469 sub inS22 {
470  
471 my ( $self,$inS22 ) = @_;
472 if ( $inS22 ne $empty_string ) {
473  
474 $sualford->{_inS22} = $inS22;
475 $sualford->{_note} = $sualford->{_note}.' inS22='.$sualford->{_inS22};
476 $sualford->{_Step} = $sualford->{_Step}.' inS22='.$sualford->{_inS22};
477  
478 } else {
479 print("sualford, inS22, missing inS22,\n");
480 }
481 }
482  
483  
484 =head2 sub lag_key
485  
486  
487 =cut
488  
489 sub lag_key {
490  
491 my ( $self,$lag_key ) = @_;
492 if ( $lag_key ne $empty_string ) {
493  
494 $sualford->{_lag_key} = $lag_key;
495 $sualford->{_note} = $sualford->{_note}.' lag_key='.$sualford->{_lag_key};
496 $sualford->{_Step} = $sualford->{_Step}.' lag_key='.$sualford->{_lag_key};
497  
498 } else {
499 print("sualford, lag_key, missing lag_key,\n");
500 }
501 }
502  
503  
504 =head2 sub maxlag
505  
506  
507 =cut
508  
509 sub maxlag {
510  
511 my ( $self,$maxlag ) = @_;
512 if ( $maxlag ne $empty_string ) {
513  
514 $sualford->{_maxlag} = $maxlag;
515 $sualford->{_note} = $sualford->{_note}.' maxlag='.$sualford->{_maxlag};
516 $sualford->{_Step} = $sualford->{_Step}.' maxlag='.$sualford->{_maxlag};
517  
518 } else {
519 print("sualford, maxlag, missing maxlag,\n");
520 }
521 }
522  
523  
524 =head2 sub ntraces
525  
526  
527 =cut
528  
529 sub ntraces {
530  
531 my ( $self,$ntraces ) = @_;
532 if ( $ntraces ne $empty_string ) {
533  
534 $sualford->{_ntraces} = $ntraces;
535 $sualford->{_note} = $sualford->{_note}.' ntraces='.$sualford->{_ntraces};
536 $sualford->{_Step} = $sualford->{_Step}.' ntraces='.$sualford->{_ntraces};
537  
538 } else {
539 print("sualford, ntraces, missing ntraces,\n");
540 }
541 }
542  
543  
544 =head2 sub outS11
545  
546  
547 =cut
548  
549 sub outS11 {
550  
551 my ( $self,$outS11 ) = @_;
552 if ( $outS11 ne $empty_string ) {
553  
554 $sualford->{_outS11} = $outS11;
555 $sualford->{_note} = $sualford->{_note}.' outS11='.$sualford->{_outS11};
556 $sualford->{_Step} = $sualford->{_Step}.' outS11='.$sualford->{_outS11};
557  
558 } else {
559 print("sualford, outS11, missing outS11,\n");
560 }
561 }
562  
563  
564 =head2 sub outS12
565  
566  
567 =cut
568  
569 sub outS12 {
570  
571 my ( $self,$outS12 ) = @_;
572 if ( $outS12 ne $empty_string ) {
573  
574 $sualford->{_outS12} = $outS12;
575 $sualford->{_note} = $sualford->{_note}.' outS12='.$sualford->{_outS12};
576 $sualford->{_Step} = $sualford->{_Step}.' outS12='.$sualford->{_outS12};
577  
578 } else {
579 print("sualford, outS12, missing outS12,\n");
580 }
581 }
582  
583  
584 =head2 sub outS21
585  
586  
587 =cut
588  
589 sub outS21 {
590  
591 my ( $self,$outS21 ) = @_;
592 if ( $outS21 ne $empty_string ) {
593  
594 $sualford->{_outS21} = $outS21;
595 $sualford->{_note} = $sualford->{_note}.' outS21='.$sualford->{_outS21};
596 $sualford->{_Step} = $sualford->{_Step}.' outS21='.$sualford->{_outS21};
597  
598 } else {
599 print("sualford, outS21, missing outS21,\n");
600 }
601 }
602  
603  
604 =head2 sub outS22
605  
606  
607 =cut
608  
609 sub outS22 {
610  
611 my ( $self,$outS22 ) = @_;
612 if ( $outS22 ne $empty_string ) {
613  
614 $sualford->{_outS22} = $outS22;
615 $sualford->{_note} = $sualford->{_note}.' outS22='.$sualford->{_outS22};
616 $sualford->{_Step} = $sualford->{_Step}.' outS22='.$sualford->{_outS22};
617  
618 } else {
619 print("sualford, outS22, missing outS22,\n");
620 }
621 }
622  
623  
624 =head2 sub taper
625  
626  
627 =cut
628  
629 sub taper {
630  
631 my ( $self,$taper ) = @_;
632 if ( $taper ne $empty_string ) {
633  
634 $sualford->{_taper} = $taper;
635 $sualford->{_note} = $sualford->{_note}.' taper='.$sualford->{_taper};
636 $sualford->{_Step} = $sualford->{_Step}.' taper='.$sualford->{_taper};
637  
638 } else {
639 print("sualford, taper, missing taper,\n");
640 }
641 }
642  
643  
644 =head2 sub taperwin
645  
646  
647 =cut
648  
649 sub taperwin {
650  
651 my ( $self,$taperwin ) = @_;
652 if ( $taperwin ne $empty_string ) {
653  
654 $sualford->{_taperwin} = $taperwin;
655 $sualford->{_note} = $sualford->{_note}.' taperwin='.$sualford->{_taperwin};
656 $sualford->{_Step} = $sualford->{_Step}.' taperwin='.$sualford->{_taperwin};
657  
658 } else {
659 print("sualford, taperwin, missing taperwin,\n");
660 }
661 }
662  
663  
664 =head2 sub xcorr_key
665  
666  
667 =cut
668  
669 sub xcorr_key {
670  
671 my ( $self,$xcorr_key ) = @_;
672 if ( $xcorr_key ne $empty_string ) {
673  
674 $sualford->{_xcorr_key} = $xcorr_key;
675 $sualford->{_note} = $sualford->{_note}.' xcorr_key='.$sualford->{_xcorr_key};
676 $sualford->{_Step} = $sualford->{_Step}.' xcorr_key='.$sualford->{_xcorr_key};
677  
678 } else {
679 print("sualford, xcorr_key, missing xcorr_key,\n");
680 }
681 }
682  
683  
684 =head2 sub get_max_index
685  
686 max index = number of input variables -1
687
688 =cut
689
690 sub get_max_index {
691 my ($self) = @_;
692 my $max_index = 16;
693  
694 return($max_index);
695 }
696
697
698 1;