lib/App/SeismicUnixGui/sunix/header/suresstat.pm untested

filter: Statementstmt 0.0% 0 / 161 Branchbran 0.0% 0 / 36 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 26 Podpod 0.0% 0 / 22 totaltotal 0.0% 0 / 245 CC 19 SCAR 16.6
CC
19
Cov
0%
cfold
6.0
fldr
6.0
hdrs
6.0
CRAP 5.3
1 package App::SeismicUnixGui::sunix::header::suresstat;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR:
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 SURESSTAT - Surface consistent source and receiver statics calculation
25  
26  
27  
28 suresstat <stdin [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 ssol= output file source statics
35  
36 rsol= output file receiver statics
37  
38 ntraces= number of traces in input data set (must be correct!)
39  
40  
41  
42 Optional parameters:
43  
44 ntpick=50 maximum static shift (samples)
45  
46 niter=5 number of iterations
47  
48 nshot=240 largest shot number (fldr=1 to nshot)
49  
50 nr=335 largest receiver number (tracf=1 to nr)
51  
52 nc=574 maximum number of cmp's (for array allocation)
53  
54 sfold=96 maximum shot gather fold
55  
56 rfold=96 maximum receiver gather fold
57  
58 cfold=48 maximum cmp gather fold
59  
60 sub=0 subtract super trace 1 from super trace 2 (=1)
61  
62 sub=0 strongly biases static to a value of 0
63  
64 mode=0 use global maximum in cross-correllation window
65  
66 =1 choose the peak perc=percent smaller than the global max.
67  
68 perc=10. percent of global max (used only for mode=1)
69  
70 verbose=0 print diagnostic output (verbose=1)
71  
72  
73  
74 Notes:
75  
76 Estimates surface-consistent source and receiver statics, meaning that
77  
78 there is one static correction value estimated for each shot and receiver
79  
80 position.
81  
82  
83  
84 The method employed here is based on the method of Ronen and Claerbout:
85  
86 Geophysics 50, 2759-2767 (1985).
87  
88  
89  
90 The output files are binary files containing the source and receiver
91  
92 statics, as a function of shot number (trace header fldr) and
93  
94 receiver station number (trace header tracf).
95  
96  
97  
98 The code builds a supertrace1 and supertrace2, which are subsequently
99  
100 cross-correllated. The program then picks the time lag associated with
101  
102 the largest peak in the cross-correllation according to two possible
103  
104 criteria set by the parameter "mode". If mode=0, the maximum of the
105  
106 cross-correllation window is chosen. If mode=1, the program will pick
107  
108 a peak which is up to perc=percent smaller than the global maximum, but
109  
110 closer to zero lag than the global maximum. (Choosing mode=0 is
111  
112 recommended.)
113  
114  
115  
116 The geometry can be irregular: the program simply computes a static
117  
118 correction for each shot record (fldr=1 to fldr=nshot), with any missing
119  
120 shots being assigned a static of 0. A static correction for each
121  
122 receiver station (tracf=1 to tracf=nr) is calculated, with missing
123  
124 receivers again assigned a static of 0. ",
125  
126  
127  
128 The ntracesces parameter must be equal to the number of prestack traces.
129  
130 The ntpick parameter sets the maximum allowable shift desired (in
131  
132 samples NOT time).
133  
134 The niter parameter sets the number of iterations desired.
135  
136 The nshot parameter must be equal to the maximum fldr number in
137  
138 the data. Note that this number might be different from the actual
139  
140 number of shot records in the data (i.e., the maximum ep number).
141  
142 For getting the correct maximum fldr number, you may use the surange
143  
144 command.
145  
146 The nr parameter must be equal to the largest number of receivers
147  
148 per shot in the whole data.
149  
150 The nc parameter must be equal to the number of prestack traces in
151  
152 the data.
153  
154 The sfold parameter must be equal to the nr parameter.
155  
156 The rfold parameter must be equal to the maximum ep number.
157  
158 The cfold parameter must be equal to the maximum CDP fold,
159  
160 which is equal to the maximum number under the cdpt entry in the
161  
162 output of the surange command.
163  
164  
165  
166 To apply the static corrections, use sustatic with hdrs=3
167  
168  
169  
170 Reference:
171  
172  
173  
174 Ronen, J. and Claerbout, J., 1985, Surface-consistent residual statics
175  
176 estimation by stack-power maximization: Geophysics, vol. 50,
177  
178 2759-2767.
179  
180  
181  
182 Credits:
183  
184 CWP: Timo Tjan, 4 October 1994
185  
186  
187  
188 rewritten by Thomas Pratt, USGS, Feb. 2000.
189  
190  
191  
192 Trace header fields accessed: ns, dt, tracf, fldr, cdp
193  
194  
195  
196 =head2 User's notes (Juan Lorenzo)
197 untested
198  
199 =cut
200  
201  
202 =head2 CHANGES and their DATES
203  
204 =cut
205  
206 use Moose;
207 our $VERSION = '0.0.1';
208  
209  
210 =head2 Import packages
211  
212 =cut
213  
214 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
215  
216 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
217 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
218  
219  
220 =head2 instantiation of packages
221  
222 =cut
223  
224 my $get = L_SU_global_constants->new();
225 my $Project = Project_config->new();
226 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
227 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
228 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
229  
230 my $PS_SEISMIC = $Project->PS_SEISMIC();
231  
232 my $var = $get->var();
233 my $on = $var->{_on};
234 my $off = $var->{_off};
235 my $true = $var->{_true};
236 my $false = $var->{_false};
237 my $empty_string = $var->{_empty_string};
238  
239 =head2 Encapsulated
240 hash of private variables
241  
242 =cut
243  
244 my $suresstat = {
245 _cfold => '',
246 _fldr => '',
247 _hdrs => '',
248 _mode => '',
249 _nc => '',
250 _niter => '',
251 _nr => '',
252 _nshot => '',
253 _ntpick => '',
254 _ntraces => '',
255 _perc => '',
256 _rfold => '',
257 _rsol => '',
258 _sfold => '',
259 _ssol => '',
260 _sub => '',
261 _tracf => '',
262 _verbose => '',
263 _Step => '',
264 _note => '',
265  
266 };
267  
268 =head2 sub Step
269  
270 collects switches and assembles bash instructions
271 by adding the program name
272  
273 =cut
274  
275 sub Step {
276  
277 $suresstat->{_Step} = 'suresstat'.$suresstat->{_Step};
278 return ( $suresstat->{_Step} );
279  
280 }
281  
282  
283 =head2 sub note
284  
285 collects switches and assembles bash instructions
286 by adding the program name
287  
288 =cut
289  
290 sub note {
291  
292 $suresstat->{_note} = 'suresstat'.$suresstat->{_note};
293 return ( $suresstat->{_note} );
294  
295 }
296  
297  
298  
299 =head2 sub clear
300  
301 =cut
302  
303 sub clear {
304  
305 $suresstat->{_cfold} = '';
306 $suresstat->{_fldr} = '';
307 $suresstat->{_hdrs} = '';
308 $suresstat->{_mode} = '';
309 $suresstat->{_nc} = '';
310 $suresstat->{_niter} = '';
311 $suresstat->{_nr} = '';
312 $suresstat->{_nshot} = '';
313 $suresstat->{_ntpick} = '';
314 $suresstat->{_ntraces} = '';
315 $suresstat->{_perc} = '';
316 $suresstat->{_rfold} = '';
317 $suresstat->{_rsol} = '';
318 $suresstat->{_sfold} = '';
319 $suresstat->{_ssol} = '';
320 $suresstat->{_sub} = '';
321 $suresstat->{_tracf} = '';
322 $suresstat->{_verbose} = '';
323 $suresstat->{_Step} = '';
324 $suresstat->{_note} = '';
325 }
326  
327  
328 =head2 sub cfold
329  
330  
331 =cut
332  
333 sub cfold {
334  
335 my ( $self,$cfold ) = @_;
336 if ( $cfold ne $empty_string ) {
337  
338 $suresstat->{_cfold} = $cfold;
339 $suresstat->{_note} = $suresstat->{_note}.' cfold='.$suresstat->{_cfold};
340 $suresstat->{_Step} = $suresstat->{_Step}.' cfold='.$suresstat->{_cfold};
341  
342 } else {
343 print("suresstat, cfold, missing cfold,\n");
344 }
345 }
346  
347  
348 =head2 sub fldr
349  
350  
351 =cut
352  
353 sub fldr {
354  
355 my ( $self,$fldr ) = @_;
356 if ( $fldr ne $empty_string ) {
357  
358 $suresstat->{_fldr} = $fldr;
359 $suresstat->{_note} = $suresstat->{_note}.' fldr='.$suresstat->{_fldr};
360 $suresstat->{_Step} = $suresstat->{_Step}.' fldr='.$suresstat->{_fldr};
361  
362 } else {
363 print("suresstat, fldr, missing fldr,\n");
364 }
365 }
366  
367  
368 =head2 sub hdrs
369  
370  
371 =cut
372  
373 sub hdrs {
374  
375 my ( $self,$hdrs ) = @_;
376 if ( $hdrs ne $empty_string ) {
377  
378 $suresstat->{_hdrs} = $hdrs;
379 $suresstat->{_note} = $suresstat->{_note}.' hdrs='.$suresstat->{_hdrs};
380 $suresstat->{_Step} = $suresstat->{_Step}.' hdrs='.$suresstat->{_hdrs};
381  
382 } else {
383 print("suresstat, hdrs, missing hdrs,\n");
384 }
385 }
386  
387  
388 =head2 sub mode
389  
390  
391 =cut
392  
393 sub mode {
394  
395 my ( $self,$mode ) = @_;
396 if ( $mode ne $empty_string ) {
397  
398 $suresstat->{_mode} = $mode;
399 $suresstat->{_note} = $suresstat->{_note}.' mode='.$suresstat->{_mode};
400 $suresstat->{_Step} = $suresstat->{_Step}.' mode='.$suresstat->{_mode};
401  
402 } else {
403 print("suresstat, mode, missing mode,\n");
404 }
405 }
406  
407  
408 =head2 sub nc
409  
410  
411 =cut
412  
413 sub nc {
414  
415 my ( $self,$nc ) = @_;
416 if ( $nc ne $empty_string ) {
417  
418 $suresstat->{_nc} = $nc;
419 $suresstat->{_note} = $suresstat->{_note}.' nc='.$suresstat->{_nc};
420 $suresstat->{_Step} = $suresstat->{_Step}.' nc='.$suresstat->{_nc};
421  
422 } else {
423 print("suresstat, nc, missing nc,\n");
424 }
425 }
426  
427  
428 =head2 sub niter
429  
430  
431 =cut
432  
433 sub niter {
434  
435 my ( $self,$niter ) = @_;
436 if ( $niter ne $empty_string ) {
437  
438 $suresstat->{_niter} = $niter;
439 $suresstat->{_note} = $suresstat->{_note}.' niter='.$suresstat->{_niter};
440 $suresstat->{_Step} = $suresstat->{_Step}.' niter='.$suresstat->{_niter};
441  
442 } else {
443 print("suresstat, niter, missing niter,\n");
444 }
445 }
446  
447  
448 =head2 sub nr
449  
450  
451 =cut
452  
453 sub nr {
454  
455 my ( $self,$nr ) = @_;
456 if ( $nr ne $empty_string ) {
457  
458 $suresstat->{_nr} = $nr;
459 $suresstat->{_note} = $suresstat->{_note}.' nr='.$suresstat->{_nr};
460 $suresstat->{_Step} = $suresstat->{_Step}.' nr='.$suresstat->{_nr};
461  
462 } else {
463 print("suresstat, nr, missing nr,\n");
464 }
465 }
466  
467  
468 =head2 sub nshot
469  
470  
471 =cut
472  
473 sub nshot {
474  
475 my ( $self,$nshot ) = @_;
476 if ( $nshot ne $empty_string ) {
477  
478 $suresstat->{_nshot} = $nshot;
479 $suresstat->{_note} = $suresstat->{_note}.' nshot='.$suresstat->{_nshot};
480 $suresstat->{_Step} = $suresstat->{_Step}.' nshot='.$suresstat->{_nshot};
481  
482 } else {
483 print("suresstat, nshot, missing nshot,\n");
484 }
485 }
486  
487  
488 =head2 sub ntpick
489  
490  
491 =cut
492  
493 sub ntpick {
494  
495 my ( $self,$ntpick ) = @_;
496 if ( $ntpick ne $empty_string ) {
497  
498 $suresstat->{_ntpick} = $ntpick;
499 $suresstat->{_note} = $suresstat->{_note}.' ntpick='.$suresstat->{_ntpick};
500 $suresstat->{_Step} = $suresstat->{_Step}.' ntpick='.$suresstat->{_ntpick};
501  
502 } else {
503 print("suresstat, ntpick, missing ntpick,\n");
504 }
505 }
506  
507  
508 =head2 sub ntraces
509  
510  
511 =cut
512  
513 sub ntraces {
514  
515 my ( $self,$ntraces ) = @_;
516 if ( $ntraces ne $empty_string ) {
517  
518 $suresstat->{_ntraces} = $ntraces;
519 $suresstat->{_note} = $suresstat->{_note}.' ntraces='.$suresstat->{_ntraces};
520 $suresstat->{_Step} = $suresstat->{_Step}.' ntraces='.$suresstat->{_ntraces};
521  
522 } else {
523 print("suresstat, ntraces, missing ntraces,\n");
524 }
525 }
526  
527  
528 =head2 sub perc
529  
530  
531 =cut
532  
533 sub perc {
534  
535 my ( $self,$perc ) = @_;
536 if ( $perc ne $empty_string ) {
537  
538 $suresstat->{_perc} = $perc;
539 $suresstat->{_note} = $suresstat->{_note}.' perc='.$suresstat->{_perc};
540 $suresstat->{_Step} = $suresstat->{_Step}.' perc='.$suresstat->{_perc};
541  
542 } else {
543 print("suresstat, perc, missing perc,\n");
544 }
545 }
546  
547  
548 =head2 sub rfold
549  
550  
551 =cut
552  
553 sub rfold {
554  
555 my ( $self,$rfold ) = @_;
556 if ( $rfold ne $empty_string ) {
557  
558 $suresstat->{_rfold} = $rfold;
559 $suresstat->{_note} = $suresstat->{_note}.' rfold='.$suresstat->{_rfold};
560 $suresstat->{_Step} = $suresstat->{_Step}.' rfold='.$suresstat->{_rfold};
561  
562 } else {
563 print("suresstat, rfold, missing rfold,\n");
564 }
565 }
566  
567  
568 =head2 sub rsol
569  
570  
571 =cut
572  
573 sub rsol {
574  
575 my ( $self,$rsol ) = @_;
576 if ( $rsol ne $empty_string ) {
577  
578 $suresstat->{_rsol} = $rsol;
579 $suresstat->{_note} = $suresstat->{_note}.' rsol='.$suresstat->{_rsol};
580 $suresstat->{_Step} = $suresstat->{_Step}.' rsol='.$suresstat->{_rsol};
581  
582 } else {
583 print("suresstat, rsol, missing rsol,\n");
584 }
585 }
586  
587  
588 =head2 sub sfold
589  
590  
591 =cut
592  
593 sub sfold {
594  
595 my ( $self,$sfold ) = @_;
596 if ( $sfold ne $empty_string ) {
597  
598 $suresstat->{_sfold} = $sfold;
599 $suresstat->{_note} = $suresstat->{_note}.' sfold='.$suresstat->{_sfold};
600 $suresstat->{_Step} = $suresstat->{_Step}.' sfold='.$suresstat->{_sfold};
601  
602 } else {
603 print("suresstat, sfold, missing sfold,\n");
604 }
605 }
606  
607  
608 =head2 sub ssol
609  
610  
611 =cut
612  
613 sub ssol {
614  
615 my ( $self,$ssol ) = @_;
616 if ( $ssol ne $empty_string ) {
617  
618 $suresstat->{_ssol} = $ssol;
619 $suresstat->{_note} = $suresstat->{_note}.' ssol='.$suresstat->{_ssol};
620 $suresstat->{_Step} = $suresstat->{_Step}.' ssol='.$suresstat->{_ssol};
621  
622 } else {
623 print("suresstat, ssol, missing ssol,\n");
624 }
625 }
626  
627  
628 =head2 sub sub
629  
630  
631 =cut
632  
633 sub sub {
634  
635 my ( $self,$sub ) = @_;
636 if ( $sub ne $empty_string ) {
637  
638 $suresstat->{_sub} = $sub;
639 $suresstat->{_note} = $suresstat->{_note}.' sub='.$suresstat->{_sub};
640 $suresstat->{_Step} = $suresstat->{_Step}.' sub='.$suresstat->{_sub};
641  
642 } else {
643 print("suresstat, sub, missing sub,\n");
644 }
645 }
646  
647  
648 =head2 sub tracf
649  
650  
651 =cut
652  
653 sub tracf {
654  
655 my ( $self,$tracf ) = @_;
656 if ( $tracf ne $empty_string ) {
657  
658 $suresstat->{_tracf} = $tracf;
659 $suresstat->{_note} = $suresstat->{_note}.' tracf='.$suresstat->{_tracf};
660 $suresstat->{_Step} = $suresstat->{_Step}.' tracf='.$suresstat->{_tracf};
661  
662 } else {
663 print("suresstat, tracf, missing tracf,\n");
664 }
665 }
666  
667  
668 =head2 sub verbose
669  
670  
671 =cut
672  
673 sub verbose {
674  
675 my ( $self,$verbose ) = @_;
676 if ( $verbose ne $empty_string ) {
677  
678 $suresstat->{_verbose} = $verbose;
679 $suresstat->{_note} = $suresstat->{_note}.' verbose='.$suresstat->{_verbose};
680 $suresstat->{_Step} = $suresstat->{_Step}.' verbose='.$suresstat->{_verbose};
681  
682 } else {
683 print("suresstat, verbose, missing verbose,\n");
684 }
685 }
686  
687  
688 =head2 sub get_max_index
689  
690 max index = number of input variables -1
691
692 =cut
693
694 sub get_max_index {
695 my ($self) = @_;
696 my $max_index = 17;
697  
698 return($max_index);
699 }
700
701
702 1;