lib/App/SeismicUnixGui/sunix/transform/sutaup.pm untested

filter: Statementstmt 0.0% 0 / 206 Branchbran 0.0% 0 / 54 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 32 Podpod 0.0% 0 / 26 totaltotal 0.0% 0 / 337 CC 28 SCAR 20.2
CC
28
Cov
0%
vmax
20.0
vmin
20.0
dp
12.0
CRAP 7.5
1 package App::SeismicUnixGui::sunix::transform::sutaup;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUTAUP - forward and inverse T-X and F-K global slant stacks
8 AUTHOR: Juan Lorenzo (Perl module only)
9 DATE:
10 DESCRIPTION:
11 Version:
12  
13 =head2 USE
14  
15 =head3 NOTES
16  
17 =head4 Examples
18  
19 =head3 SEISMIC UNIX NOTES
20  
21 SUTAUP - forward and inverse T-X and F-K global slant stacks
22  
23 sutaup <infile >outfile [optional parameters]
24  
25 Optional Parameters:
26 option=1 =1 for forward F-K domian computation
27 =2 for forward T-X domain computation
28 =3 for inverse F-K domain computation
29 =4 for inverse T-X domain computation
30 dt=tr.dt (from header) time sampling interval (secs)
31 nx=ntr (counted from data) number of horizontal samples (traces)
32 dx=1 horizontal sampling interval (m)
33 npoints=71 number of points for rho filter
34 pmin=0.0 minimum slope for Tau-P transform (s/m)
35 pmax=.006 maximum slope for Tau-P transform (s/m)
36 np=nx number of slopes for Tau-P transform
37 ntau=nt number of time samples in Tau-P domain
38 fmin=3 minimum frequency of interest
39 xmin=0 offset on first trace
40  
41 verbose=0 verbose = 1 echoes information
42  
43 tmpdir= if non-empty, use the value as a directory path
44 prefix for storing temporary files; else if the
45 the CWP_TMPDIR environment variable is set use
46 its value for the path; else use tmpfile()
47  
48 Notes:
49 The cascade of a forward and inverse tau-p transform preserves the
50 relative amplitudes in a data panel, but not the absolute amplitudes
51 meaning that a scale factor must be applied to data output by such a
52 a cascade before the output may be compared to the original data.
53 This is a characteristic of the algorithm employed in this program.
54 (Suradon does not have this problem.)
55  
56  
57  
58 Credits: CWP: Gabriel Alvarez, 1995.
59  
60 Reference:
61 Levin, F., editor, 1991, Slant-Stack Processing, Geophysics Reprint
62 Series #14, SEG Press, Tulsa.
63  
64 Trace header fields accessed: ns, dt
65 Trace header fields modified: dt,d2,f2
66  
67 Additional substitute subroutines: Juan Lorenzo March 1 2019
68  
69 inverse_via_fk=3
70  
71 inverse_via_tx=4
72  
73 forward_via_fk=1
74  
75 forward_via_tx=2
76  
77 compute_via_in=number
78  
79 outbound_pickfile=pick
80  
81 dp=1
82 vmin=1
83 vmax=2
84  
85 =head2 CHANGES and their DATES
86  
87 =cut
88  
89 use Moose;
90 our $VERSION = '0.0.1';
91 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
92  
93 my $get = L_SU_global_constants->new();
94  
95 my $var = $get->var();
96 my $empty_string = $var->{_empty_string};
97  
98 my $sutaup = {
99 _compute_via_in => '',
100 _dp => '',
101 _dt => '',
102 _dx => '',
103 _fmin => '',
104 _forward_via_fk => '1',
105 _forward_via_tx => '2',
106 _inverse_via_fk => '3',
107 _inverse_via_tx => '4',
108 _np => '',
109 _npoints => '',
110 _ntau => '',
111 _nx => '',
112 _option => '',
113 _outbound_pickfile => '',
114 _pmax => '',
115 _pmin => '',
116 _tmpdir => '',
117 _verbose => '',
118 _vmax => '',
119 _vmin => '',
120 _xmin => '',
121 _Step => '',
122 _note => '',
123 };
124  
125 =head2 sub Step
126  
127 collects switches and assembles bash instructions
128 by adding the program name
129  
130 =cut
131  
132 sub Step {
133  
134 $sutaup->{_Step} = 'sutaup' . $sutaup->{_Step};
135 return ( $sutaup->{_Step} );
136  
137 }
138  
139 =head2 sub note
140  
141 collects switches and assembles bash instructions
142 by adding the program name
143  
144 =cut
145  
146 sub note {
147  
148 $sutaup->{_note} = 'sutaup' . $sutaup->{_note};
149 return ( $sutaup->{_note} );
150  
151 }
152  
153 =head2 sub clear
154  
155 =cut
156  
157 sub clear {
158  
159 $sutaup->{_compute_via_in} = '';
160 $sutaup->{_dp} = '';
161 $sutaup->{_dt} = '';
162 $sutaup->{_dx} = '';
163 $sutaup->{_fmin} = '';
164 $sutaup->{_forward_via_fk} = '';
165 $sutaup->{_forward_via_tx} = '';
166 $sutaup->{_inverse_via_fk} = '';
167 $sutaup->{_inverse_via_tx} = '';
168 $sutaup->{_np} = '';
169 $sutaup->{_npoints} = '';
170 $sutaup->{_ntau} = '';
171 $sutaup->{_nx} = '';
172 $sutaup->{_option} = '';
173 $sutaup->{_outbound_pickfile} = '';
174 $sutaup->{_pmax} = '';
175 $sutaup->{_pmin} = '';
176 $sutaup->{_tmpdir} = '';
177 $sutaup->{_verbose} = '';
178 $sutaup->{_vmax} = '';
179 $sutaup->{_vmin} = '';
180 $sutaup->{_xmin} = '';
181 $sutaup->{_Step} = '';
182 $sutaup->{_note} = '';
183 }
184  
185 =head2 sub compute_via_in
186  
187  
188 =cut
189  
190 sub compute_via_in {
191  
192 my ( $self, $compute_via_in ) = @_;
193 if ( $compute_via_in ne $empty_string ) {
194  
195 $sutaup->{_compute_via_in} = $compute_via_in;
196 $sutaup->{_note} =
197 $sutaup->{_note} . ' compute_via_in=' . $sutaup->{_compute_via_in};
198 $sutaup->{_Step} =
199 $sutaup->{_Step} . ' compute_via_in=' . $sutaup->{_compute_via_in};
200  
201 }
202 else {
203 print("sutaup, compute_via_in, missing compute_via_in,\n");
204 }
205 }
206  
207 =head2 sub dp
208  
209 Old was:
210 if (defined($sutaup->{_pmin}) && $sutaup->{_pmax} && $sutaup->{_np} ) {
211 $sutaup->{_note} = $sutaup->{_note}.' dp='.$sutaup->{_dp};
212 $sutaup->{_dp} = ($sutaup->{_pmax} - $sutaup->{_pmin})/ ($sutaup->{_np} -1) ;
213 print("dp is $sutaup->{_dp}\n\n");
214 }
215 else {
216 print("Warning: dp requires np, and pmax and pmin\n");
217 print("Declare pmax and pmin and np earlier \n\n");
218 print("\tnp is $sutaup->{_np}\n\n");
219 print("\tpmax is $sutaup->{_pmax} and pmin is $sutaup->{_pmin}\n\n");
220 }
221 return $sutaup->{_dp};
222 =cut
223  
224 sub dp {
225  
226 my ( $self, $dp ) = @_;
227 if ( $dp ne $empty_string ) {
228 if ( defined( $sutaup->{_pmin} )
229 && $sutaup->{_pmax}
230 && $sutaup->{_np} )
231 {
232 $sutaup->{_note} = $sutaup->{_note} . ' dp=' . $sutaup->{_dp};
233 $sutaup->{_dp} =
234 ( $sutaup->{_pmax} - $sutaup->{_pmin} ) / ( $sutaup->{_np} - 1 );
235 print("dp is $sutaup->{_dp}\n\n");
236 }
237 else {
238 print("Warning: dp requires np, and pmax and pmin\n");
239 print("Declare pmax and pmin and np earlier \n\n");
240 print("\tnp is $sutaup->{_np}\n\n");
241 print(
242 "\tpmax is $sutaup->{_pmax} and pmin is $sutaup->{_pmin}\n\n");
243 }
244 return $sutaup->{_dp};
245  
246 }
247 else {
248 print("sutaup, dp, missing dp,\n");
249 }
250 }
251  
252 =head2 sub dt
253  
254  
255 =cut
256  
257 sub dt {
258  
259 my ( $self, $dt ) = @_;
260 if ( $dt ne $empty_string ) {
261  
262 $sutaup->{_dt} = $dt;
263 $sutaup->{_note} = $sutaup->{_note} . ' dt=' . $sutaup->{_dt};
264 $sutaup->{_Step} = $sutaup->{_Step} . ' dt=' . $sutaup->{_dt};
265  
266 }
267 else {
268 print("sutaup, dt, missing dt,\n");
269 }
270 }
271  
272 =head2 sub dx
273  
274  
275 =cut
276  
277 sub dx {
278  
279 my ( $self, $dx ) = @_;
280 if ( $dx ne $empty_string ) {
281  
282 $sutaup->{_dx} = $dx;
283 $sutaup->{_note} = $sutaup->{_note} . ' dx=' . $sutaup->{_dx};
284 $sutaup->{_Step} = $sutaup->{_Step} . ' dx=' . $sutaup->{_dx};
285  
286 }
287 else {
288 print("sutaup, dx, missing dx,\n");
289 }
290 }
291  
292 =head2 sub fmin
293  
294  
295 =cut
296  
297 sub fmin {
298  
299 my ( $self, $fmin ) = @_;
300 if ( $fmin ne $empty_string ) {
301  
302 $sutaup->{_fmin} = $fmin;
303 $sutaup->{_note} = $sutaup->{_note} . ' fmin=' . $sutaup->{_fmin};
304 $sutaup->{_Step} = $sutaup->{_Step} . ' fmin=' . $sutaup->{_fmin};
305  
306 }
307 else {
308 print("sutaup, fmin, missing fmin,\n");
309 }
310 }
311  
312 =head2 sub forward_via_fk
313 same as subroutine option=1
314  
315  
316 =cut
317  
318 sub forward_via_fk {
319  
320 my ( $self, $forward_via_fk ) = @_;
321 if ( $forward_via_fk ne $empty_string ) {
322  
323 $sutaup->{_note} =
324 $sutaup->{_note} . ' option=' . $sutaup->{_forward_via_fk};
325 $sutaup->{_Step} =
326 $sutaup->{_Step} . ' option=' . $sutaup->{_forward_via_fk};
327  
328 }
329 else {
330 print("sutaup, forward_via_fk, missing forward_via_fk,\n");
331 }
332 }
333  
334 =head2 sub forward_via_tx
335  
336 same as subroutine option=2
337  
338 =cut
339  
340 sub forward_via_tx {
341  
342 my ( $self, $forward_via_tx ) = @_;
343 if ( $forward_via_tx ne $empty_string ) {
344  
345 $sutaup->{_note} =
346 $sutaup->{_note} . ' option=' . $sutaup->{_forward_via_tx};
347 $sutaup->{_Step} =
348 $sutaup->{_Step} . ' option=' . $sutaup->{_forward_via_tx};
349  
350 }
351 else {
352 print("sutaup, forward_via_tx, missing forward_via_tx,\n");
353 }
354 }
355  
356 =head2 sub inverse_via_fk
357  
358 same as subroutine option=3
359  
360 =cut
361  
362 sub inverse_via_fk {
363  
364 my ( $self, $inverse_via_fk ) = @_;
365 if ( $inverse_via_fk ne $empty_string ) {
366  
367 $sutaup->{_note} =
368 $sutaup->{_note} . ' option=' . $sutaup->{_inverse_via_fk};
369 $sutaup->{_Step} =
370 $sutaup->{_Step} . ' option=' . $sutaup->{_inverse_via_fk};
371  
372 }
373 else {
374 print("sutaup, inverse_via_fk, missing inverse_via_fk,\n");
375 }
376 }
377  
378 =head2 sub inverse_via_tx
379  
380 same as subroutine option
381 =4
382
383 =cut
384  
385 sub inverse_via_tx {
386  
387 my ( $self, $inverse_via_tx ) = @_;
388 if ( $inverse_via_tx ne $empty_string ) {
389
390 print("made it, sutaup\n");
391  
392 $sutaup->{_note} =
393 $sutaup->{_note} . ' option=' . $sutaup->{_inverse_via_tx};
394 $sutaup->{_Step} =
395 $sutaup->{_Step} . ' option=' . $sutaup->{_inverse_via_tx};
396  
397 }
398 else {
399 print("sutaup, inverse_via_tx, missing inverse_via_tx,\n");
400 }
401 }
402  
403 =head2 sub np
404  
405  
406 =cut
407  
408 sub np {
409  
410 my ( $self, $np ) = @_;
411 if ( $np ne $empty_string ) {
412  
413 $sutaup->{_np} = $np;
414 $sutaup->{_note} = $sutaup->{_note} . ' np=' . $sutaup->{_np};
415 $sutaup->{_Step} = $sutaup->{_Step} . ' np=' . $sutaup->{_np};
416  
417 }
418 else {
419 print("sutaup, np, missing np,\n");
420 }
421 }
422  
423 =head2 sub npoints
424  
425  
426 =cut
427  
428 sub npoints {
429  
430 my ( $self, $npoints ) = @_;
431 if ( $npoints ne $empty_string ) {
432  
433 $sutaup->{_npoints} = $npoints;
434 $sutaup->{_note} =
435 $sutaup->{_note} . ' npoints=' . $sutaup->{_npoints};
436 $sutaup->{_Step} =
437 $sutaup->{_Step} . ' npoints=' . $sutaup->{_npoints};
438  
439 }
440 else {
441 print("sutaup, npoints, missing npoints,\n");
442 }
443 }
444  
445 =head2 sub ntau
446  
447  
448 =cut
449  
450 sub ntau {
451  
452 my ( $self, $ntau ) = @_;
453 if ( $ntau ne $empty_string ) {
454  
455 $sutaup->{_ntau} = $ntau;
456 $sutaup->{_note} = $sutaup->{_note} . ' ntau=' . $sutaup->{_ntau};
457 $sutaup->{_Step} = $sutaup->{_Step} . ' ntau=' . $sutaup->{_ntau};
458  
459 }
460 else {
461 print("sutaup, ntau, missing ntau,\n");
462 }
463 }
464  
465 =head2 sub nx
466  
467  
468 =cut
469  
470 sub nx {
471  
472 my ( $self, $nx ) = @_;
473 if ( $nx ne $empty_string ) {
474  
475 $sutaup->{_nx} = $nx;
476 $sutaup->{_note} = $sutaup->{_note} . ' nx=' . $sutaup->{_nx};
477 $sutaup->{_Step} = $sutaup->{_Step} . ' nx=' . $sutaup->{_nx};
478  
479 }
480 else {
481 print("sutaup, nx, missing nx,\n");
482 }
483 }
484  
485 =head2 sub option
486  
487  
488 =cut
489  
490 sub option {
491  
492 my ( $self, $option ) = @_;
493 if ( $option ne $empty_string ) {
494  
495 $sutaup->{_option} = $option;
496 $sutaup->{_note} = $sutaup->{_note} . ' option=' . $sutaup->{_option};
497 $sutaup->{_Step} = $sutaup->{_Step} . ' option=' . $sutaup->{_option};
498  
499 }
500 else {
501 print("sutaup, option, missing option,\n");
502 }
503 }
504  
505 =head2 sub outbound_pickfile
506  
507 Provides a default output file name
508 for picking data points
509  
510 i/p requires a base-file name (i.e. no *.su extension)
511 e.g. All_cmp
512 o/p ~/seismics_LSU/FalseRiver/seismics/pl/Bueche/All/H/1/gom/All_cmp_fp_picks
513 if ($file_in) {
514  
515 Use directory navigation system
516 and default parameter file names from
517 SeismicUnix class
518  
519  
520 sub outbound_pickfile {
521 my ($variable,$file_in) = @_;
522 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
523 my $Project = Project_config->new();
524 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
525 my ($PL_SEISMIC) = $Project->PL_SEISMIC();
526 use App::SeismicUnixGui::misc::SeismicUnix qw($suffix_fp $suffix_su) ;
527  
528 my $sufile_in = $file_in.$suffix_su;
529 my $inbound = $DATA_SEISMIC_SU.'/'.$sufile_in;
530 my $file_out = $file_in.$suffix_fp;
531 $sutaup->{_outbound_pickfile} = $PL_SEISMIC.'/'.$file_out.'_picks';
532  
533 return ($sutaup->{_outbound_pickfile});
534  
535 }
536 }
537
538 =cut
539  
540 sub outbound_pickfile {
541  
542 my ( $self, $outbound_pickfile ) = @_;
543  
544 if ( $outbound_pickfile ne $empty_string ) {
545  
546 =head2 Use directory navigation system
547 and default parameter file names from
548 SeismicUnix class
549  
550 =cut
551  
552 use App::SeismicUnixGui::configs::big_streams::Project_config;
553 my $Project = Project_config->new();
554 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
555 my ($PL_SEISMIC) = $Project->PL_SEISMIC();
556 use App::SeismicUnixGui::misc::SeismicUnix qw($suffix_fp $suffix_su);
557  
558 my $sufile_in = $outbound_pickfile . $suffix_su;
559 my $inbound = $DATA_SEISMIC_SU . '/' . $sufile_in;
560 my $file_out = $outbound_pickfile . $suffix_fp;
561 $sutaup->{_outbound_pickfile} =
562 $PL_SEISMIC . '/' . $file_out . '_picks';
563  
564 return ( $sutaup->{_outbound_pickfile} );
565  
566 }
567 else {
568 print("sutaup, outbound_pickfile, missing outbound_pickfile,\n");
569 }
570 }
571  
572 =head2 sub pmax
573  
574  
575 =cut
576  
577 sub pmax {
578  
579 my ( $self, $pmax ) = @_;
580 if ( $pmax ne $empty_string ) {
581  
582 $sutaup->{_pmax} = $pmax;
583 $sutaup->{_note} = $sutaup->{_note} . ' pmax=' . $sutaup->{_pmax};
584 $sutaup->{_Step} = $sutaup->{_Step} . ' pmax=' . $sutaup->{_pmax};
585  
586 }
587 else {
588 print("sutaup, pmax, missing pmax,\n");
589 }
590 }
591  
592 =head2 sub pmin
593  
594  
595 =cut
596  
597 sub pmin {
598  
599 my ( $self, $pmin ) = @_;
600 if ( $pmin ne $empty_string ) {
601  
602 $sutaup->{_pmin} = $pmin;
603 $sutaup->{_note} = $sutaup->{_note} . ' pmin=' . $sutaup->{_pmin};
604 $sutaup->{_Step} = $sutaup->{_Step} . ' pmin=' . $sutaup->{_pmin};
605  
606 }
607 else {
608 print("sutaup, pmin, missing pmin,\n");
609 }
610 }
611  
612 =head2 sub tmpdir
613  
614  
615 =cut
616  
617 sub tmpdir {
618  
619 my ( $self, $tmpdir ) = @_;
620 if ( $tmpdir ne $empty_string ) {
621  
622 $sutaup->{_tmpdir} = $tmpdir;
623 $sutaup->{_note} = $sutaup->{_note} . ' tmpdir=' . $sutaup->{_tmpdir};
624 $sutaup->{_Step} = $sutaup->{_Step} . ' tmpdir=' . $sutaup->{_tmpdir};
625  
626 }
627 else {
628 print("sutaup, tmpdir, missing tmpdir,\n");
629 }
630 }
631  
632 =head2 sub verbose
633  
634  
635 =cut
636  
637 sub verbose {
638  
639 my ( $self, $verbose ) = @_;
640 if ( $verbose ne $empty_string ) {
641  
642 $sutaup->{_verbose} = $verbose;
643 $sutaup->{_note} =
644 $sutaup->{_note} . ' verbose=' . $sutaup->{_verbose};
645 $sutaup->{_Step} =
646 $sutaup->{_Step} . ' verbose=' . $sutaup->{_verbose};
647  
648 }
649 else {
650 print("sutaup, verbose, missing verbose,\n");
651 }
652 }
653  
654 =head2 sub vmax
655  
656  
657 =cut
658  
659 sub vmax {
660  
661 my ( $self, $vmax ) = @_;
662 if ( $vmax ne $empty_string ) {
663  
664 if ( $vmax > 0 || $vmax < 0 ) {
665  
666 $sutaup->{_vmax} = $vmax;
667 $sutaup->{_vmax} = $vmax;
668 $sutaup->{_pmin} = 1 / $sutaup->{_vmax};
669 $sutaup->{_note} =
670 $sutaup->{_note}
671 . ' vmax='
672 . $sutaup->{_vmax}
673 . ' pmin='
674 . $sutaup->{_pmin};
675 $sutaup->{_Step} = $sutaup->{_Step} . ' pmin=' . $sutaup->{_pmin};
676  
677 }
678 elsif ( $vmax == 0 ) {
679 $vmax = $vmax + .001;
680 }
681 else {
682 print("sutaup, vmax, unexpected vmax,\n");
683 }
684  
685 }
686 else {
687 print("sutaup, vmax, missing vmax,\n");
688 }
689 }
690  
691 =head2 sub vmin
692  
693 print("vmin is $sutaup->{_vmin}}\n\n");
694 =cut
695  
696 sub vmin {
697  
698 my ( $self, $vmin ) = @_;
699 if ( $vmin ne $empty_string ) {
700 use App::SeismicUnixGui::misc::control '0.0.3';
701 use aliased 'App::SeismicUnixGui::misc::control';
702 my $control = control->new();
703
704 $control->set_back_slashBgone($vmin );
705 $vmin = $control->get_back_slashBgone();
706  
707 if ( $vmin > 0 || $vmin < 0 ) {
708  
709 $sutaup->{_vmin} = $vmin;
710 $sutaup->{_pmax} = 1 / $sutaup->{_vmin};
711 $sutaup->{_Step} = $sutaup->{_Step} . ' pmax=' . $sutaup->{_pmax};
712 $sutaup->{_note} =
713 $sutaup->{_note}
714 . ' vmin='
715 . $sutaup->{_vmin}
716 . ' pmax='
717 . $sutaup->{_pmax};
718  
719 }
720 elsif ( $vmin == 0 ) {
721 $vmin = $vmin + .001;
722 }
723 else {
724 print("sutaup, vmin, unexpected vmin,\n");
725 }
726 }
727 else {
728 print("sutaup, vmin, missing vmin,\n");
729 }
730 }
731  
732 =head2 sub xmin
733  
734  
735 =cut
736  
737 sub xmin {
738  
739 my ( $self, $xmin ) = @_;
740 if ( $xmin ne $empty_string ) {
741  
742 $sutaup->{_xmin} = $xmin;
743 $sutaup->{_note} = $sutaup->{_note} . ' xmin=' . $sutaup->{_xmin};
744 $sutaup->{_Step} = $sutaup->{_Step} . ' xmin=' . $sutaup->{_xmin};
745  
746 }
747 else {
748 print("sutaup, xmin, missing xmin,\n");
749 }
750 }
751  
752 =head2 sub get_max_index
753
754 max index = number of input variables -1
755
756 =cut
757  
758 sub get_max_index {
759 my ($self) = @_;
760 my $max_index = 18;
761  
762 return ($max_index);
763 }
764  
765 1;