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

filter: Statementstmt 0.0% 0 / 116 Branchbran 0.0% 0 / 32 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 20 totaltotal 0.0% 0 / 189 CC 17 SCAR 17.0
CC
17
Cov
0%
fn
6.0
input_file
6.0
mode
6.0
CRAP 5.5
1 package App::SeismicUnixGui::sunix::header::suresstat;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 =head1 DOCUMENTATION
6  
7 =head2 SYNOPSIS
8  
9 PERL PROGRAM NAME: suresstat
10 AUTHOR: Juan Lorenzo (Perl module only)
11 DATE: June 2 2016
12 DESCRIPTION: surface consistent receiver-source static
13 Version 1
14 Notes:
15 Package name is the same as the file name
16 Moose is a package that allows an object-oriented
17 syntax to organizing your programs
18 =========================================================
19 MODIFIED BY: Martial Morrison
20 DATE: July 14 2016
21 DESCRIPTION: Updated for Seismic Unix v44
22 Version 1.1
23  
24 Added new subroutines: fn, imax, input_file (fn), max_fldr_cdp_tracf (imax), iterations (niter), max_sample_shift (ntpick)
25 -These parameters were added to suresstat in SU v44
26  
27 Removed outdated subroutines: cfold, rfold, ntraces, nr, nc, nshot, number_of_traces
28 -These parameters are no longer part of suresstat
29  
30 =cut
31  
32 =head2 Notes from Seismic Unix
33  
34 SURESSTAT - Surface consistent source and receiver statics calculation
35
36 suresstat fn= [optional parameters]
37
38 Required parameters:
39 fn= seismic file
40 ssol= output file source statics
41 rsol= output file receiver statics
42
43 Optional parameters:
44 ntpick=50 maximum static shift (samples)
45 niter=5 number of iterations
46 imax=100000 largest shot (fldr),reciver(tracf) or cmp(cdp) number
47 sub=0 subtract super trace 1 from super trace 2 (=1)
48 sub=0 strongly biases static to a value of 0
49 mode=0 use global maximum in cross-correllation window
50 =1 choose the peak perc=percent smaller than the global max.
51 perc=10. percent of global max (used only for mode=1)
52 verbose=0 print diagnostic output (verbose=1)
53
54 Notes:
55 Estimates surface-consistent source and receiver statics, meaning that
56 there is one static correction value estimated for each shot and receiver
57 position.
58
59 The method employed here is based on the method of Ronen and Claerbout:
60 Geophysics 50, 2759-2767 (1985).
61
62 The input data are NMO-corrected and sorted into shot gathers (fldr).
63 Receiver id position should be stored in headerword tracf.
64 The output files are binary files containing the source and receiver
65 statics, as a function of shot number (trace header fldr) and
66 receiver station number (trace header tracf).
67
68 The code builds a supertrace1 and supertrace2, which are subsequently
69 cross-correllated. The program then picks the time lag associated with
70 the largest peak in the cross-correllation according to two possible
71 criteria set by the parameter "mode". If mode=0, the maximum of the
72 cross-correllation window is chosen. If mode=1, the program will pick
73 a peak which is up to perc=percent smaller than the global maximum, but
74 closer to zero lag than the global maximum. (Choosing mode=0 is
75 recommended.)
76
77 The geometry can be irregular: the program simply computes a static
78 correction for each shot record (fldr=1 to fldr=nshot), with any missing
79 shots being assigned a static of 0. A static correction for each
80 receiver station (tracf=1 to tracf=nr) is calculated, with missing
81 receivers again assigned a static of 0.
82 To window out the most cohherent region use suwind tmin= tmax= and
83 save the result into a file. This will reduce the amount of time
84 the code will spent on scaning the file,since the file is much smaller
85 The ntpick parameter sets the maximum allowable shift desired (in
86 samples NOT time).
87
88 To apply the static corrections, use sustatic with hdrs=3
89
90  
91 =cut
92  
93 =head2 USAGE 1
94  
95 Read a file with one colume of text
96 Read each line
97  
98 Example
99 $suresstat->ssol($source_statics_output_file);
100 $suresstat->rsol($receiver_statics_output_file);
101 $suresstat->imax($max_cdp);
102 $readfiles-Step();
103 =cut
104  
105 my $suresstat = {
106 _fn => '',
107 _input_file => '',
108 _imax => '',
109 _max_fldr_cdp_tracf => '',
110 _ntpick => '',
111 _max_sample_shift => '',
112 _niter => '',
113 _iterations => '',
114 _subtract => '',
115 _mode => '',
116 _perc => '',
117 _ssol => '',
118 _source_statics_file_output => '',
119 _rsol => '',
120 _receiver_statics_file_output => '',
121 _note => '',
122 _Step => '',
123 _verbose => ''
124 };
125  
126 =pod
127  
128 Notes:
129 Estimates surface-consistent source and receiver statics, meaning that
130 there is one static correction value estimated for each shot and receiver
131 position.
132  
133 The output files are binary files containing the source and receiver statics.
134  
135 Output source (sstat) and receiver (gstat) statics are in microseconds.
136 Total statics (tstats) are in milliseconds.
137  
138 The method employed here is based on the method of Ronen and Claerbout:
139 Geophysics 50, 2759-2767 (1985).
140  
141  
142 =head2 sub clear:
143  
144 clean hash of its values
145  
146 =cut
147  
148 sub clear {
149 $suresstat->{_fn} = '';
150 $suresstat->{_input_file} = '';
151 $suresstat->{_imax} = '';
152 $suresstat->{_max_fldr_cdp_tracf} = '';
153 $suresstat->{_ntpick} = '';
154 $suresstat->{_max_sample_shift} = '';
155 $suresstat->{_niter} = '';
156 $suresstat->{_iterations} = '';
157 $suresstat->{_subtract} = '';
158 $suresstat->{_mode} = '';
159 $suresstat->{_perc} = '';
160 $suresstat->{_ssol} = '';
161 $suresstat->{_source_statics_file_output} = '';
162 $suresstat->{_rsol} = '';
163 $suresstat->{_receiver_statics_file_output} = '';
164 $suresstat->{_note} = '';
165 $suresstat->{_Step} = '';
166 $suresstat->{_verbose} = '';
167 }
168  
169 =head2 subroutine fn
170  
171 =cut
172  
173 sub fn {
174 my ( $variable, $fn ) = @_;
175 if ($fn) {
176 $suresstat->{_fn} = $fn;
177 $suresstat->{_Step} =
178 $suresstat->{_Step} . ' fn=' . $suresstat->{_fn};
179 $suresstat->{_note} =
180 $suresstat->{_note} . ' fn=' . $suresstat->{_fn};
181 }
182  
183 }
184  
185 =head2 subroutine input_file
186  
187 =cut
188  
189 sub input_file {
190 my ( $variable, $input_file ) = @_;
191 if ($input_file) {
192 $suresstat->{_input_file} = $input_file;
193 $suresstat->{_Step} =
194 $suresstat->{_Step} . ' fn=' . $suresstat->{_input_file};
195 $suresstat->{_note} =
196 $suresstat->{_note} . ' input_file=' . $suresstat->{_input_file};
197 }
198  
199 }
200  
201 =head2 subroutine mode
202  
203 =cut
204  
205 sub mode {
206 my ( $variable, $mode ) = @_;
207 if ($mode) {
208 $suresstat->{_mode} = $mode;
209 $suresstat->{_Step} =
210 $suresstat->{_Step} . ' mode=' . $suresstat->{_mode};
211 $suresstat->{_note} =
212 $suresstat->{_note} . ' mode=' . $suresstat->{_mode};
213 }
214 }
215  
216 =head2 subroutine imax
217  
218 =cut
219  
220 sub imax {
221 my ( $variable, $imax ) = @_;
222 if ($imax) {
223 $suresstat->{_imax} = $imax;
224 $suresstat->{_Step} =
225 $suresstat->{_Step} . ' imax=' . $suresstat->{_imax};
226 $suresstat->{_note} =
227 $suresstat->{_note} . ' imax=' . $suresstat->{_imax};
228 }
229 }
230  
231 =head2 subroutine max_fldr_cdp_tracf
232  
233 =cut
234  
235 sub max_fldr_cdp_tracf {
236 my ( $variable, $max_fldr_cdp_tracf ) = @_;
237 if ($max_fldr_cdp_tracf) {
238 $suresstat->{_max_fldr_cdp_tracf} = $max_fldr_cdp_tracf;
239 $suresstat->{_Step} =
240 $suresstat->{_Step} . ' imax=' . $suresstat->{_max_fldr_cdp_tracf};
241 $suresstat->{_note} =
242 $suresstat->{_note}
243 . ' max_fldr_cdp_tracf='
244 . $suresstat->{_max_fldr_cdp_tracf};
245 }
246 }
247  
248 =head2 subroutine niter
249  
250 =cut
251  
252 sub niter {
253 my ( $variable, $niter ) = @_;
254  
255 if ($niter) {
256 $suresstat->{_niter} = $niter;
257 $suresstat->{_Step} =
258 $suresstat->{_Step} . ' niter=' . $suresstat->{_niter};
259 $suresstat->{_note} =
260 $suresstat->{_note} . ' niter=' . $suresstat->{_niter};
261 }
262 }
263  
264 =head2 subroutine iterations
265  
266 =cut
267  
268 sub iterations {
269 my ( $variable, $iterations ) = @_;
270  
271 if ($iterations) {
272 $suresstat->{_iterations} = $iterations;
273 $suresstat->{_Step} =
274 $suresstat->{_Step} . ' niter=' . $suresstat->{_iterations};
275 $suresstat->{_note} =
276 $suresstat->{_note} . ' iterations=' . $suresstat->{_iterations};
277 }
278 }
279  
280 =head2 subroutine note
281  
282 =cut
283  
284 sub note {
285 my ( $variable, $note ) = @_;
286 $suresstat->{_note} = $note;
287 return $suresstat->{_note};
288 }
289  
290 =head2 subroutine ntpick
291  
292 =cut
293  
294 sub ntpick {
295  
296 my ( $variable, $ntpick ) = @_;
297 if ($ntpick) {
298 $suresstat->{_ntpick} = $ntpick;
299 $suresstat->{_Step} =
300 $suresstat->{_Step} . ' ntpick=' . $suresstat->{_ntpick};
301 $suresstat->{_note} =
302 $suresstat->{_note} . ' ntpick=' . $suresstat->{_ntpick};
303 }
304 }
305  
306 =head2 subroutine max_sample_shift
307  
308 =cut
309  
310 sub max_sample_shift {
311  
312 my ( $variable, $max_sample_shift ) = @_;
313 if ($max_sample_shift) {
314 $suresstat->{_max_sample_shift} = $max_sample_shift;
315 $suresstat->{_Step} =
316 $suresstat->{_Step} . ' ntpick=' . $suresstat->{_max_sample_shift};
317 $suresstat->{_note} =
318 $suresstat->{_note}
319 . ' max_sample_shift='
320 . $suresstat->{_max_sample_shift};
321 }
322 }
323  
324 =head2 subroutine perc
325  
326 =cut
327  
328 sub perc {
329 my ( $variable, $perc ) = @_;
330 if ($perc) {
331 $suresstat->{_perc} = $perc;
332 $suresstat->{_Step} =
333 $suresstat->{_Step} . ' perc=' . $suresstat->{_perc};
334 $suresstat->{_note} =
335 $suresstat->{_note} . ' perc=' . $suresstat->{_perc};
336 }
337 }
338  
339 =head2 subroutine receiver_statics_output_file
340  
341 =cut
342  
343 sub receiver_statics_file_output {
344 my ( $variable, $receiver_statics_file_output ) = @_;
345 if ($receiver_statics_file_output) {
346 $suresstat->{_receiver_statics_file_output} =
347 $receiver_statics_file_output;
348 print 'receiver_statics_file_output='
349 . $receiver_statics_file_output . "\n\n";
350 $suresstat->{_Step} =
351 $suresstat->{_Step}
352 . ' rsol='
353 . $suresstat->{_receiver_statics_file_output};
354 $suresstat->{_note} =
355 $suresstat->{_note}
356 . ' receiver_statics_file_output='
357 . $suresstat->{_receiver_statics_file_output};
358 }
359 }
360  
361 =head2 subroutine rsol
362  
363 =cut
364  
365 sub rsol {
366 my ( $variable, $rsol ) = @_;
367 if ($rsol) {
368 $suresstat->{_rsol} = $rsol;
369 print 'rsol=' . $rsol . "\n\n";
370 $suresstat->{_Step} =
371 $suresstat->{_Step} . ' rsol=' . $suresstat->{_rsol};
372 $suresstat->{_note} =
373 $suresstat->{_note}
374 . ' receiver_statics_file_output='
375 . $suresstat->{_rsol};
376 }
377 }
378  
379 =head2 subroutine ssol
380  
381 =cut
382  
383 sub source_statics_file_output {
384 my ( $variable, $source_statics_file_output ) = @_;
385 if ($source_statics_file_output) {
386 $suresstat->{_source_statics_file_output} = $source_statics_file_output;
387 print 'source_statics_file_output='
388 . $source_statics_file_output . "\n\n";
389 $suresstat->{_Step} =
390 $suresstat->{_Step}
391 . ' ssol='
392 . $suresstat->{_source_statics_file_output};
393 $suresstat->{_note} =
394 $suresstat->{_note}
395 . ' ssol='
396 . $suresstat->{_source_statics_file_output};
397 }
398 }
399  
400 =head2 subroutine source_statics_file
401  
402 =cut
403  
404 sub ssol {
405 my ( $variable, $ssol ) = @_;
406 if ($ssol) {
407 $suresstat->{_ssol} = $ssol;
408 print 'ssol=' . $ssol . "\n\n";
409 $suresstat->{_Step} =
410 $suresstat->{_Step} . ' ssol=' . $suresstat->{_ssol};
411 $suresstat->{_note} =
412 $suresstat->{_note}
413 . ' source_statics_file_output='
414 . $suresstat->{_ssol};
415 }
416 }
417  
418 =head2 subroutine sub
419  
420 =cut
421  
422 sub subtract {
423 my ( $variable, $subtract ) = @_;
424 if ($subtract) {
425 $suresstat->{_subtract} = $subtract;
426 print 'subtract=' . $subtract . "\n\n";
427 $suresstat->{_Step} =
428 $suresstat->{_Step} . ' sub=' . $suresstat->{_subtract};
429 $suresstat->{_note} =
430 $suresstat->{_note} . ' subtract=' . $suresstat->{_subtract};
431 }
432 }
433  
434 =head2 subroutine Step
435  
436 =cut
437  
438 sub Step {
439  
440 $suresstat->{_Step} = 'suresstat ' . $suresstat->{_Step};
441 return $suresstat->{_Step};
442 }
443  
444 =head2 subroutine verbose
445  
446 =cut
447  
448 sub verbose {
449  
450 my ( $variable, $verbose ) = @_;
451 if ($verbose) {
452 $suresstat->{_verbose} = $verbose;
453 $suresstat->{_Step} =
454 $suresstat->{_Step} . ' verbose=' . $suresstat->{_verbose};
455 $suresstat->{_note} =
456 $suresstat->{_note} . ' verbose=' . $suresstat->{_verbose};
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  
469 # only file_name : index=6
470 my $max_index = 6;
471  
472 return ($max_index);
473 }
474  
475 1;