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

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