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

filter: Statementstmt 0.0% 0 / 105 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 14 totaltotal 0.0% 0 / 157 CC 11 SCAR 15.8
CC
11
Cov
0%
elevation
6.0
hdrs
6.0
no
6.0
CRAP 4.9
1 package App::SeismicUnixGui::sunix::header::sustatic;
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 SUSTATIC - Elevation static corrections, apply corrections from
25  
26 headers or from a source and receiver statics file
27  
28  
29  
30 sustatic <stdin >stdout [optional parameters]
31  
32  
33  
34 Required parameters:
35  
36 none
37  
38 Optional Parameters:
39  
40 v0=v1 or user-defined or from header, weathering velocity
41  
42 v1=user-defined or from header, subweathering velocity
43  
44 hdrs=0 =1 to read statics from headers
45  
46 =2 to read statics from files
47  
48 =3 to read from output files of suresstat
49  
50 sign=1 apply static correction (add tstat values)
51  
52 =-1 apply negative of tstat values
53  
54 Options when hdrs=2 and hdrs=3:
55  
56 sou_file= input file for source statics (ms)
57  
58 rec_file= input file for receiver statics (ms)
59  
60 ns=240 number of souces
61  
62 nr=335 number of receivers
63  
64 no=96 number of offsets
65  
66  
67  
68 Notes:
69  
70 For hdrs=1, statics calculation is not performed, statics correction
71  
72 is applied to the data by reading statics (in ms) from the header.
73  
74  
75  
76 For hdrs=0, field statics are calculated, and
77  
78 input field sut is assumed measured in ms.
79  
80 output field sstat equals 10^scalel*(sdel - selev + sdepth)/swevel
81  
82 output field gstat equals sstat - sut/1000.
83  
84 output field tstat equals sstat + gstat + 10^scalel*(selev - gelev)/wevel
85  
86  
87  
88 For hdrs=2, statics are surface consistently obtained from the
89  
90 statics files. The geometry should be regular.
91  
92 The source- and receiver-statics files should be unformated C binary
93  
94 floats and contain the statics (in ms) as a function of surface location.
95  
96  
97  
98 For hdrs=3, statics are read from the output files of suresstat, with
99  
100 the same options as hdrs=2 (but use no=max traces per shot and assume
101  
102 that ns=max shot number and nr=max receiver number).
103  
104 For each shot number (trace header fldr) and each receiver number
105  
106 (trace header tracf) the program will look up the appropriate static
107  
108 correction. The geometry need not be regular as each trace is treated
109  
110 independently.
111  
112  
113  
114 Caveat: The static shifts are computed with the assumption that the
115  
116 desired datum is sea level (elevation=0). You may need to shift the
117  
118 selev and gelev header values via suchw.
119  
120 Example: subtracting min(selev,gelev)=25094431
121  
122  
123  
124 suchw < CR290.su key1->selev,gelev key2 -> elev,gelev key3 -> selev,gelev \\
125  
126 a->-25094431,-25094431 b->1,1 c->0,0 > CR290datum.su
127  
128  
129  
130 Credits:
131  
132 CWP: Jamie Burns
133  
134  
135  
136 CWP: Modified by Mohammed Alfaraj, 11/10/1992, for reading
137  
138 statics from headers and including sign (+-) option
139  
140  
141  
142 CWP: Modified by Timo Tjan, 29 June 1995, to include input of
143  
144 source and receiver statics from files.
145  
146  
147  
148 modified by Thomas Pratt, USGS, Feb, 2000 to read statics from
149  
150 the output files of suresstat
151  
152  
153  
154 Trace header fields accessed: ns, dt, delrt, gelev, selev,
155  
156 sdepth, gdel, sdel, swevel, sut, scalel, fldr, tracf
157  
158 Trace header fields modified: sstat, gstat, tstat
159  
160  
161  
162  
163  
164 =head2 User's notes (Juan Lorenzo)
165 untested
166  
167 =cut
168  
169  
170 =head2 CHANGES and their DATES
171  
172 =cut
173  
174 use Moose;
175 our $VERSION = '0.0.1';
176  
177  
178 =head2 Import packages
179  
180 =cut
181  
182 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
183  
184 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
185 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
186  
187  
188 =head2 instantiation of packages
189  
190 =cut
191  
192 my $get = L_SU_global_constants->new();
193 my $Project = Project_config->new();
194 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
195 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
196 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
197  
198 my $PS_SEISMIC = $Project->PS_SEISMIC();
199  
200 my $var = $get->var();
201 my $on = $var->{_on};
202 my $off = $var->{_off};
203 my $true = $var->{_true};
204 my $false = $var->{_false};
205 my $empty_string = $var->{_empty_string};
206  
207 =head2 Encapsulated
208 hash of private variables
209  
210 =cut
211  
212 my $sustatic = {
213 _elevation => '',
214 _hdrs => '',
215 _no => '',
216 _nr => '',
217 _ns => '',
218 _rec_file => '',
219 _sign => '',
220 _sou_file => '',
221 _v0 => '',
222 _v1 => '',
223 _Step => '',
224 _note => '',
225  
226 };
227  
228 =head2 sub Step
229  
230 collects switches and assembles bash instructions
231 by adding the program name
232  
233 =cut
234  
235 sub Step {
236  
237 $sustatic->{_Step} = 'sustatic'.$sustatic->{_Step};
238 return ( $sustatic->{_Step} );
239  
240 }
241  
242  
243 =head2 sub note
244  
245 collects switches and assembles bash instructions
246 by adding the program name
247  
248 =cut
249  
250 sub note {
251  
252 $sustatic->{_note} = 'sustatic'.$sustatic->{_note};
253 return ( $sustatic->{_note} );
254  
255 }
256  
257  
258  
259 =head2 sub clear
260  
261 =cut
262  
263 sub clear {
264  
265 $sustatic->{_elevation} = '';
266 $sustatic->{_hdrs} = '';
267 $sustatic->{_no} = '';
268 $sustatic->{_nr} = '';
269 $sustatic->{_ns} = '';
270 $sustatic->{_rec_file} = '';
271 $sustatic->{_sign} = '';
272 $sustatic->{_sou_file} = '';
273 $sustatic->{_v0} = '';
274 $sustatic->{_v1} = '';
275 $sustatic->{_Step} = '';
276 $sustatic->{_note} = '';
277 }
278  
279  
280 =head2 sub elevation
281  
282  
283 =cut
284  
285 sub elevation {
286  
287 my ( $self,$elevation ) = @_;
288 if ( $elevation ne $empty_string ) {
289  
290 $sustatic->{_elevation} = $elevation;
291 $sustatic->{_note} = $sustatic->{_note}.' elevation='.$sustatic->{_elevation};
292 $sustatic->{_Step} = $sustatic->{_Step}.' elevation='.$sustatic->{_elevation};
293  
294 } else {
295 print("sustatic, elevation, missing elevation,\n");
296 }
297 }
298  
299  
300 =head2 sub hdrs
301  
302  
303 =cut
304  
305 sub hdrs {
306  
307 my ( $self,$hdrs ) = @_;
308 if ( $hdrs ne $empty_string ) {
309  
310 $sustatic->{_hdrs} = $hdrs;
311 $sustatic->{_note} = $sustatic->{_note}.' hdrs='.$sustatic->{_hdrs};
312 $sustatic->{_Step} = $sustatic->{_Step}.' hdrs='.$sustatic->{_hdrs};
313  
314 } else {
315 print("sustatic, hdrs, missing hdrs,\n");
316 }
317 }
318  
319  
320 =head2 sub no
321  
322  
323 =cut
324  
325 sub no {
326  
327 my ( $self,$no ) = @_;
328 if ( $no ne $empty_string ) {
329  
330 $sustatic->{_no} = $no;
331 $sustatic->{_note} = $sustatic->{_note}.' no='.$sustatic->{_no};
332 $sustatic->{_Step} = $sustatic->{_Step}.' no='.$sustatic->{_no};
333  
334 } else {
335 print("sustatic, no, missing no,\n");
336 }
337 }
338  
339  
340 =head2 sub nr
341  
342  
343 =cut
344  
345 sub nr {
346  
347 my ( $self,$nr ) = @_;
348 if ( $nr ne $empty_string ) {
349  
350 $sustatic->{_nr} = $nr;
351 $sustatic->{_note} = $sustatic->{_note}.' nr='.$sustatic->{_nr};
352 $sustatic->{_Step} = $sustatic->{_Step}.' nr='.$sustatic->{_nr};
353  
354 } else {
355 print("sustatic, nr, missing nr,\n");
356 }
357 }
358  
359  
360 =head2 sub ns
361  
362  
363 =cut
364  
365 sub ns {
366  
367 my ( $self,$ns ) = @_;
368 if ( $ns ne $empty_string ) {
369  
370 $sustatic->{_ns} = $ns;
371 $sustatic->{_note} = $sustatic->{_note}.' ns='.$sustatic->{_ns};
372 $sustatic->{_Step} = $sustatic->{_Step}.' ns='.$sustatic->{_ns};
373  
374 } else {
375 print("sustatic, ns, missing ns,\n");
376 }
377 }
378  
379  
380 =head2 sub rec_file
381  
382  
383 =cut
384  
385 sub rec_file {
386  
387 my ( $self,$rec_file ) = @_;
388 if ( $rec_file ne $empty_string ) {
389  
390 $sustatic->{_rec_file} = $rec_file;
391 $sustatic->{_note} = $sustatic->{_note}.' rec_file='.$sustatic->{_rec_file};
392 $sustatic->{_Step} = $sustatic->{_Step}.' rec_file='.$sustatic->{_rec_file};
393  
394 } else {
395 print("sustatic, rec_file, missing rec_file,\n");
396 }
397 }
398  
399  
400 =head2 sub sign
401  
402  
403 =cut
404  
405 sub sign {
406  
407 my ( $self,$sign ) = @_;
408 if ( $sign ne $empty_string ) {
409  
410 $sustatic->{_sign} = $sign;
411 $sustatic->{_note} = $sustatic->{_note}.' sign='.$sustatic->{_sign};
412 $sustatic->{_Step} = $sustatic->{_Step}.' sign='.$sustatic->{_sign};
413  
414 } else {
415 print("sustatic, sign, missing sign,\n");
416 }
417 }
418  
419  
420 =head2 sub sou_file
421  
422  
423 =cut
424  
425 sub sou_file {
426  
427 my ( $self,$sou_file ) = @_;
428 if ( $sou_file ne $empty_string ) {
429  
430 $sustatic->{_sou_file} = $sou_file;
431 $sustatic->{_note} = $sustatic->{_note}.' sou_file='.$sustatic->{_sou_file};
432 $sustatic->{_Step} = $sustatic->{_Step}.' sou_file='.$sustatic->{_sou_file};
433  
434 } else {
435 print("sustatic, sou_file, missing sou_file,\n");
436 }
437 }
438  
439  
440 =head2 sub v0
441  
442  
443 =cut
444  
445 sub v0 {
446  
447 my ( $self,$v0 ) = @_;
448 if ( $v0 ne $empty_string ) {
449  
450 $sustatic->{_v0} = $v0;
451 $sustatic->{_note} = $sustatic->{_note}.' v0='.$sustatic->{_v0};
452 $sustatic->{_Step} = $sustatic->{_Step}.' v0='.$sustatic->{_v0};
453  
454 } else {
455 print("sustatic, v0, missing v0,\n");
456 }
457 }
458  
459  
460 =head2 sub v1
461  
462  
463 =cut
464  
465 sub v1 {
466  
467 my ( $self,$v1 ) = @_;
468 if ( $v1 ne $empty_string ) {
469  
470 $sustatic->{_v1} = $v1;
471 $sustatic->{_note} = $sustatic->{_note}.' v1='.$sustatic->{_v1};
472 $sustatic->{_Step} = $sustatic->{_Step}.' v1='.$sustatic->{_v1};
473  
474 } else {
475 print("sustatic, v1, missing v1,\n");
476 }
477 }
478  
479  
480 =head2 sub get_max_index
481  
482 max index = number of input variables -1
483
484 =cut
485
486 sub get_max_index {
487 my ($self) = @_;
488 my $max_index = 9;
489  
490 return($max_index);
491 }
492
493
494 1;