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

filter: Statementstmt 0.0% 0 / 64 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 105 CC 9 SCAR 16.2
CC
9
Cov
0%
hdrs
6.0
no
6.0
nr
6.0
CRAP 5.0
1 package App::SeismicUnixGui::sunix::header::sustatic_old;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 =head1 DOCUMENTATION
6  
7 =head2 SYNOPSIS
8  
9 PERL PROGRAM NAME: sustatic
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 =cut
20  
21 =head2 Notes from Seismic Unix
22  
23 SUSTATIC - Elevation static corrections, apply corrections from
24 headers or from a source and receiver statics file
25
26 sustatic <stdin >stdout [optional parameters]
27
28 Required parameters:
29 none
30 Optional Parameters:
31 v0=v1 or user-defined or from header, weathering velocity
32 v1=user-defined or from header, subweathering velocity
33 hdrs=0 =1 to read statics from headers
34 =2 to read statics from files
35 =3 to read from output files of suresstat
36 sign=1 apply static correction (add tstat values)
37 =-1 apply negative of tstat values
38 Options when hdrs=2 and hdrs=3:
39 sou_file= input file for source statics (ms)
40 rec_file= input file for receiver statics (ms)
41 ns=240 number of souces
42 nr=335 number of receivers
43 no=96 number of offsets
44
45 Notes:
46 For hdrs=1, statics calculation is not performed, statics correction
47 is applied to the data by reading statics (in ms) from the header.
48
49 For hdrs=0, field statics are calculated, and
50 input field sut is assumed measured in ms.
51 output field sstat = 10^scalel*(sdel - selev + sdepth)/swevel
52 output field gstat = sstat - sut/1000.
53 output field tstat = sstat + gstat + 10^scalel*(selev - gelev)/wevel
54
55 For hdrs=2, statics are surface consistently obtained from the
56 statics files. The geometry should be regular.
57 The source- and receiver-statics files should be unformated C binary
58 floats and contain the statics (in ms) as a function of surface location.
59  
60 For hdrs=3, statics are read from the output files of suresstat, with
61 the same options as hdrs=2 (but use no=max traces per shot and assume
62 that ns=max shot number and nr=max receiver number).
63 For each shot number (trace header fldr) and each receiver number
64 (trace header tracf) the program will look up the appropriate static
65 correction. The geometry need not be regular as each trace is treated
66 independently.
67
68 Caveat: The static shifts are computed with the assumption that the
69 desired datum is sea level (elevation=0). You may need to shift the
70 selev and gelev header values via suchw.
71 Example: subtracting min(selev,gelev)=25094431
72
73 suchw < CR290.su key1=selev,gelev key2=selev,gelev key3=selev,gelev \
74 a=-25094431,-25094431 b=1,1 c=0,0 > CR290datum.su
75  
76 =cut
77  
78 =head2 USAGE 1
79  
80 Example
81 $sustatic->hdr(3);
82 $sustatic->Step();
83 =cut
84  
85 my $sustatic = {
86 _hdrs => '',
87 _no => '',
88 _note => '',
89 _nr => '',
90 _ns => '',
91 _rec_file => '',
92 _sign => '',
93 _sou_file => '',
94 _Step => '',
95 _v0 => '',
96 _v1 => ''
97 };
98  
99 =head2 Notes
100  
101 Apply statics
102  
103 =head2 sub clear:
104  
105 clean hash of its values
106  
107 =cut
108  
109 sub clear {
110 $sustatic->{_hdrs} = '';
111 $sustatic->{_no} = '';
112 $sustatic->{_note} = '';
113 $sustatic->{_nr} = '';
114 $sustatic->{_ns} = '';
115 $sustatic->{_rec_file} = '';
116 $sustatic->{_sign} = '';
117 $sustatic->{_sou_file} = '';
118 $sustatic->{_Step} = '';
119 $sustatic->{_v0} = '';
120 $sustatic->{_v1} = '';
121 }
122  
123 =head2 subroutine hdrs
124  
125  
126 =cut
127  
128 sub hdrs {
129 my ( $variable, $hdrs ) = @_;
130 if ($hdrs) {
131 $sustatic->{_hdrs} = $hdrs;
132 $sustatic->{_Step} =
133 $sustatic->{_Step} . ' hdrs=' . $sustatic->{_hdrs};
134 $sustatic->{_note} =
135 $sustatic->{_note} . ' hdrs=' . $sustatic->{_hdrs};
136 }
137 }
138  
139 =head2 subroutine no
140  
141 =cut
142  
143 sub no {
144 my ( $variable, $no ) = @_;
145 if ($no) {
146 $sustatic->{_no} = $no;
147 $sustatic->{_Step} = $sustatic->{_Step} . ' no=' . $sustatic->{_no};
148 $sustatic->{_note} = $sustatic->{_note} . ' no=' . $sustatic->{_no};
149 }
150 }
151  
152 =head2 subroutine note
153  
154 =cut
155  
156 sub note {
157 my ( $variable, $note ) = @_;
158 $sustatic->{_note} = $note;
159 return $sustatic->{_note};
160 }
161  
162 =head2 subroutine nr
163  
164 =cut
165  
166 sub nr {
167 my ( $variable, $nr ) = @_;
168 if ($nr) {
169 $sustatic->{_nr} = $nr;
170  
171 $sustatic->{_Step} = $sustatic->{_Step} . ' nr=' . $sustatic->{_nr};
172 $sustatic->{_note} = $sustatic->{_note} . ' nr=' . $sustatic->{_nr};
173 }
174 }
175  
176 =head2 subroutine rec_file
177  
178 =cut
179  
180 sub rec_file {
181  
182 my ( $variable, $rec_file ) = @_;
183 if ($rec_file) {
184 $sustatic->{_rec_file} = $rec_file;
185 $sustatic->{_Step} =
186 $sustatic->{_Step} . ' rec_file=' . $sustatic->{_rec_file};
187 $sustatic->{_note} =
188 $sustatic->{_note} . ' rec_file=' . $sustatic->{_rec_file};
189 }
190 }
191  
192 =head2 subroutine sign
193  
194  
195 =cut
196  
197 sub sign {
198  
199 my ( $variable, $sign ) = @_;
200 if ($sign) {
201 $sustatic->{_sign} = $sign;
202 $sustatic->{_Step} =
203 $sustatic->{_Step} . ' sign=' . $sustatic->{_sign};
204 $sustatic->{_note} =
205 $sustatic->{_note} . ' sign=' . $sustatic->{_sign};
206 }
207 }
208  
209 =head2 subroutine sou_file
210  
211 =cut
212  
213 sub sou_file {
214 my ( $variable, $sou_file ) = @_;
215 if ($sou_file) {
216 $sustatic->{_sou_file} = $sou_file;
217 $sustatic->{_Step} =
218 $sustatic->{_Step} . ' sou_file=' . $sustatic->{_sou_file};
219 $sustatic->{_note} =
220 $sustatic->{_note} . ' sou_file=' . $sustatic->{_sou_file};
221 }
222 }
223  
224 =head2 subroutine Step
225  
226 =cut
227  
228 sub Step {
229  
230 $sustatic->{_Step} = 'sustatic ' . $sustatic->{_Step};
231 return $sustatic->{_Step};
232 }
233  
234 =head2 subroutine v0
235  
236 =cut
237  
238 sub v0 {
239 my ( $variable, $v0 ) = @_;
240 if ($v0) {
241 $sustatic->{_v0} = $v0;
242 $sustatic->{_Step} = $sustatic->{_Step} . ' v0='
243 . $sustatic->{_source_statics_output_file};
244 $sustatic->{_note} = $sustatic->{_note} . ' v0='
245 . $sustatic->{_source_statics_output_file};
246 }
247 }
248  
249 =head2 subroutine v1
250  
251 =cut
252  
253 sub v1 {
254 my ( $variable, $v1 ) = @_;
255 if ($v1) {
256 $sustatic->{_v1} = $v1;
257 $sustatic->{_Step} = $sustatic->{_Step} . ' v1='
258 . $sustatic->{_source_statics_output_file};
259 $sustatic->{_note} = $sustatic->{_note} . ' v1='
260 . $sustatic->{_source_statics_output_file};
261 }
262 }
263  
264 =head2 sub get_max_index
265  
266 max index = number of input variables -1
267  
268 =cut
269  
270 sub get_max_index {
271 my ($self) = @_;
272  
273 # only file_name : index=6
274 my $max_index = 6;
275  
276 return ($max_index);
277 }
278  
279 1;