lib/App/SeismicUnixGui/sunix/NMO_Vel_Stk/sustkvel.pm untested

filter: Statementstmt 0.0% 0 / 77 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 113 CC 7 SCAR 14.8
CC
7
Cov
0%
dip
6.0
h
6.0
outpar
6.0
CRAP 4.4
1 package App::SeismicUnixGui::sunix::NMO_Vel_Stk::sustkvel;
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 SUSTKVEL - convert constant dip layer interval velocity model to the
25  
26 stacking velocity model required by sunmo
27  
28  
29  
30 sustkvel v= h= dip=0.0 outpar=/dev/tty
31  
32  
33  
34 Required parameters:
35  
36 v= interval velocities
37  
38 h= layer thicknesses at the cmp
39  
40  
41  
42 Optional parameters:
43  
44 dip=0.0 (constant) dip of the layers (degrees)
45  
46 outpar=/dev/tty output parameter file in the form
47  
48 required by sunmo:
49  
50 tv=zero incidence time pick vector
51  
52 v=stacking velocities vector
53  
54  
55  
56 Examples:
57  
58 sustkvel v=5000,6000,8000,10000 h=1000,1200,1300,1500 outpar=stkpar
59  
60 sunmo <data.cdp par=stkpar >data.nmo
61  
62  
63  
64 sustkvel par=intpar outpar=stkpar
65  
66 sunmo <data.cdp par=stkpar >data.nmo
67  
68  
69  
70 If the file, intpar, contains:
71  
72 v=5000,6000,8000,10000
73  
74 h=1000,1200,1300,1500
75  
76 then the two examples are equivalent. The created parameter file,
77  
78 stkpar, is in the form of the velocity model required by sunmo.
79  
80  
81  
82 Note: sustkvel does not have standard su syntax since it does not
83  
84 operate on seismic data. Hence stdin and stdout are not used.
85  
86  
87  
88 Caveat: Does not accept a series of interval velocity models to
89  
90 produce a variable velocity file for sunmo.
91  
92  
93  
94  
95  
96 Credits:
97  
98 CWP: Jack
99  
100  
101  
102 Technical Reference:
103  
104 The Common Depth Point Stack
105  
106 William A. Schneider
107  
108 Proc. IEEE, v. 72, n. 10, p. 1238-1254
109  
110 1984
111  
112  
113  
114 Formulas:
115  
116 Note: All sums on i are from 1 to k
117  
118  
119  
120 From Schneider:
121  
122 Let h[i] be the ith layer thickness measured at the cmp and
123  
124 v[i] the ith interval velocity.
125  
126 Set:
127  
128 t[i] = h[i]/v[i]
129  
130 t0[k] = 2 Sum t[i] * cos(dip)
131  
132 vs[k] = (1.0/cos(dip)) sqrt(Sum v[i]*v[i]*t[i] / Sum t[i])
133  
134 Define:
135  
136 t0by2[k] = Sum h[i]/v[i]
137  
138 vh[k] = Sum v[i]*h[i]
139  
140 Then:
141  
142 t0[k] = 2 * t0by2[k] * cos(dip)
143  
144 vs[k] = sqrt(vh[k] / t0by2[k]) / cos(dip)
145  
146  
147  
148  
149  
150  
151  
152 =head2 User's notes (Juan Lorenzo)
153 untested
154  
155 =cut
156  
157  
158 =head2 CHANGES and their DATES
159  
160 =cut
161  
162 use Moose;
163 our $VERSION = '0.0.1';
164  
165  
166 =head2 Import packages
167  
168 =cut
169  
170 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
171  
172 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
173 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
174  
175  
176 =head2 instantiation of packages
177  
178 =cut
179  
180 my $get = L_SU_global_constants->new();
181 my $Project = Project_config->new();
182 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
183 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
184 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
185  
186 my $PS_SEISMIC = $Project->PS_SEISMIC();
187  
188 my $var = $get->var();
189 my $on = $var->{_on};
190 my $off = $var->{_off};
191 my $true = $var->{_true};
192 my $false = $var->{_false};
193 my $empty_string = $var->{_empty_string};
194  
195 =head2 Encapsulated
196 hash of private variables
197  
198 =cut
199  
200 my $sustkvel = {
201 _dip => '',
202 _h => '',
203 _outpar => '',
204 _par => '',
205 _tv => '',
206 _v => '',
207 _Step => '',
208 _note => '',
209  
210 };
211  
212 =head2 sub Step
213  
214 collects switches and assembles bash instructions
215 by adding the program name
216  
217 =cut
218  
219 sub Step {
220  
221 $sustkvel->{_Step} = 'sustkvel'.$sustkvel->{_Step};
222 return ( $sustkvel->{_Step} );
223  
224 }
225  
226  
227 =head2 sub note
228  
229 collects switches and assembles bash instructions
230 by adding the program name
231  
232 =cut
233  
234 sub note {
235  
236 $sustkvel->{_note} = 'sustkvel'.$sustkvel->{_note};
237 return ( $sustkvel->{_note} );
238  
239 }
240  
241  
242  
243 =head2 sub clear
244  
245 =cut
246  
247 sub clear {
248  
249 $sustkvel->{_dip} = '';
250 $sustkvel->{_h} = '';
251 $sustkvel->{_outpar} = '';
252 $sustkvel->{_par} = '';
253 $sustkvel->{_tv} = '';
254 $sustkvel->{_v} = '';
255 $sustkvel->{_Step} = '';
256 $sustkvel->{_note} = '';
257 }
258  
259  
260 =head2 sub dip
261  
262  
263 =cut
264  
265 sub dip {
266  
267 my ( $self,$dip ) = @_;
268 if ( $dip ne $empty_string ) {
269  
270 $sustkvel->{_dip} = $dip;
271 $sustkvel->{_note} = $sustkvel->{_note}.' dip='.$sustkvel->{_dip};
272 $sustkvel->{_Step} = $sustkvel->{_Step}.' dip='.$sustkvel->{_dip};
273  
274 } else {
275 print("sustkvel, dip, missing dip,\n");
276 }
277 }
278  
279  
280 =head2 sub h
281  
282  
283 =cut
284  
285 sub h {
286  
287 my ( $self,$h ) = @_;
288 if ( $h ne $empty_string ) {
289  
290 $sustkvel->{_h} = $h;
291 $sustkvel->{_note} = $sustkvel->{_note}.' h='.$sustkvel->{_h};
292 $sustkvel->{_Step} = $sustkvel->{_Step}.' h='.$sustkvel->{_h};
293  
294 } else {
295 print("sustkvel, h, missing h,\n");
296 }
297 }
298  
299  
300 =head2 sub outpar
301  
302  
303 =cut
304  
305 sub outpar {
306  
307 my ( $self,$outpar ) = @_;
308 if ( $outpar ne $empty_string ) {
309  
310 $sustkvel->{_outpar} = $outpar;
311 $sustkvel->{_note} = $sustkvel->{_note}.' outpar='.$sustkvel->{_outpar};
312 $sustkvel->{_Step} = $sustkvel->{_Step}.' outpar='.$sustkvel->{_outpar};
313  
314 } else {
315 print("sustkvel, outpar, missing outpar,\n");
316 }
317 }
318  
319  
320 =head2 sub par
321  
322  
323 =cut
324  
325 sub par {
326  
327 my ( $self,$par ) = @_;
328 if ( $par ne $empty_string ) {
329  
330 $sustkvel->{_par} = $par;
331 $sustkvel->{_note} = $sustkvel->{_note}.' par='.$sustkvel->{_par};
332 $sustkvel->{_Step} = $sustkvel->{_Step}.' par='.$sustkvel->{_par};
333  
334 } else {
335 print("sustkvel, par, missing par,\n");
336 }
337 }
338  
339  
340 =head2 sub tv
341  
342  
343 =cut
344  
345 sub tv {
346  
347 my ( $self,$tv ) = @_;
348 if ( $tv ne $empty_string ) {
349  
350 $sustkvel->{_tv} = $tv;
351 $sustkvel->{_note} = $sustkvel->{_note}.' tv='.$sustkvel->{_tv};
352 $sustkvel->{_Step} = $sustkvel->{_Step}.' tv='.$sustkvel->{_tv};
353  
354 } else {
355 print("sustkvel, tv, missing tv,\n");
356 }
357 }
358  
359  
360 =head2 sub v
361  
362  
363 =cut
364  
365 sub v {
366  
367 my ( $self,$v ) = @_;
368 if ( $v ne $empty_string ) {
369  
370 $sustkvel->{_v} = $v;
371 $sustkvel->{_note} = $sustkvel->{_note}.' v='.$sustkvel->{_v};
372 $sustkvel->{_Step} = $sustkvel->{_Step}.' v='.$sustkvel->{_v};
373  
374 } else {
375 print("sustkvel, v, missing v,\n");
376 }
377 }
378  
379  
380 =head2 sub get_max_index
381  
382 max index = number of input variables -1
383
384 =cut
385
386 sub get_max_index {
387 my ($self) = @_;
388 my $max_index = 5;
389  
390 return($max_index);
391 }
392
393
394 1;