lib/App/SeismicUnixGui/misc/unif2.pm untested

filter: Statementstmt 0.0% 0 / 187 Branchbran 0.0% 0 / 58 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 33 Podpod 0.0% 0 / 32 totaltotal 0.0% 0 / 310 CC 30 SCAR 17.5
CC
30
Cov
0%
numberOfBuriedSurfaces
6.0
ninf
6.0
numberXGridPoints
6.0
CRAP 5.7
1 package App::SeismicUnixGui::misc::unif2;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 =head1 DOCUMENTATION
6  
7 =head2 SYNOPSIS
8  
9 PERL PROGRAM NAME: unif2
10 AUTHOR: Juan Lorenzo
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 UNIF2 - generate a 2-D UNIFormly sampled velocity profile
24 from a layered
25 model. In each layer, velocity is a linear functio
26 n of position.
27
28 unif2 < infile > outfile [parameters]
29
30 Required parameters:
31 none
32
33 Optional Parameters:
34 ninf=5 number of interfaces
35 nx=100 number of x samples (2nd dimension)
36 nz=100 number of z samples (1st dimension)
37 dx=10 x sampling interval
38 dz=10 z sampling interval
39
40 npmax=201 maximum number of points on interfaces
41
42 fx=0.0 first x sample
43 fz=0.0 first z sample
44
45 x0=0.0,0.0,..., distance x at which v00 is specifie
46 d
47 z0=0.0,0.0,..., depth z at which v00 is specified
48 v00=1500,2000,2500..., velocity at each x0,z0 (m/sec)
49 dvdx=0.0,0.0,..., derivative of velocity with distanc
50 e x (dv/dx)
51 method=linear for linear interpolation of interfa
52 ce
53 =mono for monotonic cubic interpola
54 tion of interface
55 =akima for Akima's cubic interpolat
56 ion of interface
57 =spline for cubic spline interpolat
58 ion of interface
59
60 tfile= =testfilename if set, a sample input datas
61 et is
62 output to "testfilename".
63
64 Notes:
65 The input file is an ASCII file containing x z values repr
66 esenting a
67 piecewise continuous velocity model with a flat surface on
68 top. The surface
69 and each successive boundary between media are represented
70 by a list of
71 selected x z pairs written column form. The first and last
72 x values must
73 be the same for all boundaries. Use the entry 1.0 -9999
74 9 to separate
75 entries for successive boundaries. No boundary may cross a
76 nother. Note
77 that the choice of the method of interpolation may cause b
78 oundaries
79 to cross that do not appear to cross in the input data fil
80 e.
81 The number of interfaces is specified by the parameter "ni
82 nf". This
83 number does not include the top surface of the model. The
84 input data
85 format is the same as a CSHOT model file with all comments
86 removed.
87
88 Example using test input file generating feature:
89 unif2 tfile=testfilename produces a 5 interface demonst
90 ration model
91 unif2 < testfilename | psimage n1=100 n2=100 d1=10 d2=10 |
92 ...
93  
94  
95 =head2 USAGE 1
96  
97 Example
98  
99 $unif2->numberOfBuriedSurfaces;
100 $unif2->numberXGridPoints;
101 $unif2->numberZGridPoints;
102 $unif2->horizontalGridSpacing_m;
103 $unif2->verticalGridSpacing_m;
104 $unif2->maxNumberGridPointsOnBuriedSurfaces;
105 $unif2->firstXvalue_m;
106 $unif2->firstZvalue_m;
107 $unif2->horizontalVelocityGradient;
108 $unif2->verticalVelocityGradient;
109 $unif2->XVelocityList_m
110 $unif2->ZVelocityList_m
111 $unif2->velocityList_mps
112 $unif2->interpolateBuriedSurfaceWith;
113 $unif2->outboundTestFile;
114 $unif2->Step();
115  
116  
117 =cut
118  
119 my $unif2 = {
120 _numberOfBuriedSurfaces => '',
121 _ninf => '',
122 _numberXGridPoints => '',
123 _nx => '',
124 _note => '',
125 _numberZGridPoints => '',
126 _nz => '',
127 _maxNumberGridPointsOnBuriedSurfaces => '',
128 _npmax => '',
129 _verticalGridSpacing_m => '',
130 _dz => '',
131 _horizontalGridSpacing_m => '',
132 _dx => '',
133 _Step => '',
134 _firstXvalue_m => '',
135 _fx => '',
136 _firstZvalue_m => '',
137 _fz => '',
138 _verticalVelocityGradient => '',
139 _dvdz => '',
140 _horizontalVelocityGradient => '',
141 _dvdx => '',
142 _XVelocityList_m => '',
143 _x0 => '',
144 _ZVelocityList_m => '',
145 _z0 => '',
146 _velocityList_mps => '',
147 _v00 => '',
148 _interpolateBuriedSurfaceWith => '',
149 _method => '',
150 _outboundTestFile => '',
151 _tfile => '',
152 _Step => ''
153 };
154  
155 =head2 Notes
156  
157 Create mesh for finite difference modeling
158  
159 =head2 sub clear:
160  
161 clean hash of its values
162  
163 =cut
164  
165 sub clear {
166 $unif2->{_numberOfBuriedSurfaces} = '';
167 $unif2->{_ninf} = '';
168 $unif2->{_numberXGridPoints} = '';
169 $unif2->{_nx} = '';
170 $unif2->{_numberZGridPoints} = '';
171 $unif2->{_nz} = '';
172 $unif2->{_maxNumberGridPointsOnBuriedSurfaces} = '';
173 $unif2->{_npmax} = '';
174 $unif2->{_verticalGridSpacing_m} = '';
175 $unif2->{_dz} = '';
176 $unif2->{_horizontalGridSpacing_m} = '';
177 $unif2->{_dx} = '';
178 $unif2->{_firstXvalue_m} = '';
179 $unif2->{_fx} = '';
180 $unif2->{_firstZvalue_m} = '';
181 $unif2->{_fz} = '';
182 $unif2->{_verticalVelocityGradient} = '';
183 $unif2->{_dvdz} = '';
184 $unif2->{_horizontalVelocityGradient} = '';
185 $unif2->{_dvdx} = '';
186 $unif2->{_XVelocityList_m} = '';
187 $unif2->{_x0} = '';
188 $unif2->{_ZVelocityList_m} = '';
189 $unif2->{_z0} = '';
190 $unif2->{_velocityList_mps} = '';
191 $unif2->{_v00} = '';
192 $unif2->{_interpolateBuriedSurfaceWith} = '';
193 $unif2->{_method} = '';
194 $unif2->{_outboundTestFile} = '';
195 $unif2->{_tfile} = '';
196 $unif2->{_note} = '';
197 $unif2->{_Step} = '';
198 }
199  
200 =head2 subroutine numberOfBuriedSurfaces
201  
202  
203 =cut
204  
205 sub numberOfBuriedSurfaces {
206 my ( $variable, $numberOfBuriedSurfaces ) = @_;
207 if ($numberOfBuriedSurfaces) {
208 $unif2->{_numberOfBuriedSurfaces} = $numberOfBuriedSurfaces;
209 $unif2->{_Step} =
210 $unif2->{_Step}
211 . ' numberOfBuriedSurfaces='
212 . $unif2->{_numberOfBuriedSurfaces};
213 $unif2->{_note} =
214 $unif2->{_note}
215 . ' numberOfBuriedSurfaces='
216 . $unif2->{_numberOfBuriedSurfaces};
217 }
218 }
219  
220 =head2 subroutine ninf
221  
222 =cut
223  
224 sub ninf {
225 my ( $variable, $ninf ) = @_;
226 if ($ninf) {
227 $unif2->{_ninf} = $ninf;
228 $unif2->{_Step} = $unif2->{_Step} . ' ninf=' . $unif2->{_ninf};
229 $unif2->{_note} = $unif2->{_note} . ' ninf=' . $unif2->{_ninf};
230 }
231 }
232  
233 =head2 subroutine numberXGridPoints
234  
235 =cut
236  
237 sub numberXGridPoints {
238 my ( $variable, $numberXGridPoints ) = @_;
239 if ($numberXGridPoints) {
240 $unif2->{_numberXGridPoints} = $numberXGridPoints;
241  
242 $unif2->{_Step} =
243 $unif2->{_Step}
244 . ' numberXGridPoints='
245 . $unif2->{_numberXGridPoints};
246 $unif2->{_note} =
247 $unif2->{_note}
248 . ' numberXGridPoints='
249 . $unif2->{_numberXGridPoints};
250 }
251 }
252  
253 =head2 subroutine nx
254  
255 =cut
256  
257 sub nx {
258  
259 my ( $variable, $nx ) = @_;
260 if ($nx) {
261 $unif2->{_nx} = $nx;
262 $unif2->{_Step} = $unif2->{_Step} . ' nx=' . $unif2->{_nx};
263 $unif2->{_note} = $unif2->{_note} . ' nx=' . $unif2->{_nx};
264 }
265 }
266  
267 =head2 subroutine numberZGridPoints
268  
269  
270 =cut
271  
272 sub numberZGridPoints {
273  
274 my ( $variable, $numberZGridPoints ) = @_;
275 if ($numberZGridPoints) {
276 $unif2->{_numberZGridPoints} = $numberZGridPoints;
277 $unif2->{_Step} =
278 $unif2->{_Step}
279 . ' numberZGridPoints='
280 . $unif2->{_numberZGridPoints};
281 $unif2->{_note} =
282 $unif2->{_note}
283 . ' numberZGridPoints='
284 . $unif2->{_numberZGridPoints};
285 }
286 }
287  
288 =head2 subroutine nz
289  
290 =cut
291  
292 sub nz {
293 my ( $variable, $nz ) = @_;
294 if ($nz) {
295 $unif2->{_nz} = $nz;
296 $unif2->{_Step} = $unif2->{_Step} . ' nz=' . $unif2->{_nz};
297 $unif2->{_note} = $unif2->{_note} . ' nz=' . $unif2->{_nz};
298 }
299 }
300  
301 =head2 subroutine maxNumberGridPointsOnBuriedSurfaces
302  
303 =cut
304  
305 sub maxNumberGridPointsOnBuriedSurfaces {
306 my ( $variable, $maxNumberGridPointsOnBuriedSurfaces ) = @_;
307 if ($maxNumberGridPointsOnBuriedSurfaces) {
308 $unif2->{_maxNumberGridPointsOnBuriedSurfaces} =
309 $maxNumberGridPointsOnBuriedSurfaces;
310 $unif2->{_Step} =
311 $unif2->{_Step}
312 . ' maxNumberGridPointsOnBuriedSurfaces='
313 . $unif2->{_maxNumberGridPointsOnBuriedSurfaces};
314 $unif2->{_note} =
315 $unif2->{_note}
316 . ' maxNumberGridPointsOnBuriedSurfaces='
317 . $unif2->{_maxNumberGridPointsOnBuriedSurfaces};
318 }
319 }
320  
321 =head2 subroutine npmax
322  
323 =cut
324  
325 sub npmax {
326 my ( $variable, $npmax ) = @_;
327 if ($npmax) {
328 $unif2->{_npmax} = $npmax;
329 $unif2->{_Step} = $unif2->{_Step} . ' npmax=' . $unif2->{_npmax};
330 $unif2->{_note} = $unif2->{_note} . ' npmax=' . $unif2->{_npmax};
331 }
332 }
333  
334 =head2 subroutine verticalGridSpacing_m
335  
336 =cut
337  
338 sub verticalGridSpacing_m {
339 my ( $variable, $verticalGridSpacing_m ) = @_;
340 if ($verticalGridSpacing_m) {
341 $unif2->{_verticalGridSpacing_m} = $verticalGridSpacing_m;
342 $unif2->{_Step} =
343 $unif2->{_Step}
344 . ' verticalGridSpacing_m='
345 . $unif2->{_verticalGridSpacing_m};
346 $unif2->{_note} =
347 $unif2->{_note}
348 . ' verticalGridSpacing_m='
349 . $unif2->{_verticalGridSpacing_m};
350 }
351 }
352  
353 =head2 subroutine dz
354  
355 =cut
356  
357 sub dz {
358 my ( $variable, $dz ) = @_;
359 if ($dz) {
360 $unif2->{_dz} = $dz;
361 $unif2->{_Step} = $unif2->{_Step} . ' dz=' . $unif2->{_dz};
362 $unif2->{_note} = $unif2->{_note} . ' dz=' . $unif2->{_dz};
363 }
364 }
365  
366 =head2 subroutine horizontalGridSpacing_m
367  
368 =cut
369  
370 sub horizontalGridSpacing_m {
371 my ( $variable, $horizontalGridSpacing_m ) = @_;
372 if ($horizontalGridSpacing_m) {
373 $unif2->{_horizontalGridSpacing_m} = $horizontalGridSpacing_m;
374 $unif2->{_Step} =
375 $unif2->{_Step}
376 . ' horizontalGridSpacing_m='
377 . $unif2->{_horizontalGridSpacing_m};
378 $unif2->{_note} =
379 $unif2->{_note}
380 . ' horizontalGridSpacing_m='
381 . $unif2->{_horizontalGridSpacing_m};
382 }
383 }
384  
385 =head2 subroutine dx
386  
387 =cut
388  
389 sub dx {
390 my ( $variable, $dx ) = @_;
391 if ($dx) {
392 $unif2->{_dx} = $dx;
393 $unif2->{_Step} = $unif2->{_Step} . ' dx=' . $unif2->{_dx};
394 $unif2->{_note} = $unif2->{_note} . ' dx=' . $unif2->{_dx};
395 }
396 }
397  
398 =head2 subroutine firstXvalue_m
399  
400 =cut
401  
402 sub firstXvalue {
403 my ( $variable, $firstXvalue ) = @_;
404 if ($firstXvalue) {
405 $unif2->{_firstXvalue} = $firstXvalue;
406 $unif2->{_Step} =
407 $unif2->{_Step} . ' firstXvalue=' . $unif2->{_firstXvalue};
408 $unif2->{_note} =
409 $unif2->{_note} . ' firstXvalue=' . $unif2->{_firstXvalue};
410 }
411 }
412  
413 =head2 subroutine firstZvalue_m
414  
415 =cut
416  
417 sub firstZvalue_m {
418 my ( $variable, $firstZvalue_m ) = @_;
419 if ($firstZvalue_m) {
420 $unif2->{_firstZvalue_m} = $firstZvalue_m;
421 $unif2->{_Step} =
422 $unif2->{_Step} . ' firstZvalue_m=' . $unif2->{_firstZvalue_m};
423 $unif2->{_note} =
424 $unif2->{_note} . ' firstZvalue_m=' . $unif2->{_firstZvalue_m};
425 }
426 }
427  
428 =head2 subroutine fz
429  
430 =cut
431  
432 sub fz {
433 my ( $variable, $fz ) = @_;
434 if ($fz) {
435 $unif2->{_fz} = $fz;
436 $unif2->{_Step} = $unif2->{_Step} . ' fz=' . $unif2->{_fz};
437 $unif2->{_note} = $unif2->{_note} . ' fz=' . $unif2->{_fz};
438 }
439 }
440  
441 =head2 subroutine fx
442  
443 =cut
444  
445 sub fx {
446 my ( $variable, $fx ) = @_;
447 if ($fx) {
448 $unif2->{_fx} = $fx;
449 $unif2->{_Step} = $unif2->{_Step} . ' fx=' . $unif2->{_fx};
450 $unif2->{_note} = $unif2->{_note} . ' fx=' . $unif2->{_fx};
451 }
452 }
453  
454 =head2 subroutine verticalVelocityGradient
455  
456 =cut
457  
458 sub verticalVelocityGradient {
459 my ( $variable, $verticalVelocityGradient ) = @_;
460 if ($verticalVelocityGradient) {
461 $unif2->{_verticalVelocityGradient} = $verticalVelocityGradient;
462 $unif2->{_Step} =
463 $unif2->{_Step}
464 . ' verticalVelocityGradient='
465 . $unif2->{_verticalVelocityGradient};
466 $unif2->{_note} =
467 $unif2->{_note}
468 . ' verticalVelocityGradient='
469 . $unif2->{_verticalVelocityGradient};
470 }
471 }
472  
473 =head2 subroutine horizontalVelocityGradient
474  
475 =cut
476  
477 sub horizontalVelocityGradient {
478 my ( $variable, $horizontalVelocityGradient ) = @_;
479 if ($horizontalVelocityGradient) {
480 $unif2->{_horizontalVelocityGradient} = $horizontalVelocityGradient;
481 $unif2->{_Step} =
482 $unif2->{_Step}
483 . ' horizontalVelocityGradient='
484 . $unif2->{_horizontalVelocityGradient};
485 $unif2->{_note} =
486 $unif2->{_note}
487 . ' horizontalVelocityGradient='
488 . $unif2->{_horizontalVelocityGradient};
489 }
490 }
491  
492 =head2 subroutine dvdx
493  
494 =cut
495  
496 sub dvdx {
497 my ( $variable, $dvdx ) = @_;
498 if ($dvdx) {
499 $unif2->{_dvdx} = $dvdx;
500 $unif2->{_Step} = $unif2->{_Step} . ' dvdx=' . $unif2->{_dvdx};
501 $unif2->{_note} = $unif2->{_note} . ' dvdx=' . $unif2->{_dvdx};
502 }
503 }
504  
505 =head2 subroutine dvdz
506  
507 =cut
508  
509 sub dvdz {
510 my ( $variable, $dvdz ) = @_;
511 if ($dvdz) {
512 $unif2->{_dvdz} = $dvdz;
513 $unif2->{_Step} = $unif2->{_Step} . ' dvdz=' . $unif2->{_dvdz};
514 $unif2->{_note} = $unif2->{_note} . ' dvdz=' . $unif2->{_dvdz};
515 }
516 }
517  
518 =head2 subroutine XVelocityList_m
519  
520 =cut
521  
522 sub XVelocityList_m {
523 my ( $variable, $XVelocityList_m ) = @_;
524 if ($XVelocityList_m) {
525 $unif2->{_XVelocityList_m} = $XVelocityList_m;
526 $unif2->{_Step} =
527 $unif2->{_Step} . ' XVelocityList_m=' . $unif2->{_XVelocityList_m};
528 $unif2->{_note} =
529 $unif2->{_note} . ' XVelocityList_m=' . $unif2->{_XVelocityList_m};
530 }
531 }
532  
533 =head2 subroutine x0
534  
535 =cut
536  
537 sub x0 {
538 my ( $variable, $x0 ) = @_;
539 if ($x0) {
540 $unif2->{_x0} = $x0;
541 $unif2->{_Step} = $unif2->{_Step} . ' x0=' . $unif2->{_x0};
542 $unif2->{_note} = $unif2->{_note} . ' x0=' . $unif2->{_x0};
543 }
544 }
545  
546 =head2 subroutine ZVelocityList_m
547  
548 =cut
549  
550 sub ZVelocityList_m {
551 my ( $variable, $ZVelocityList_m ) = @_;
552 if ($ZVelocityList_m) {
553 $unif2->{_ZVelocityList_m} = $ZVelocityList_m;
554 $unif2->{_Step} =
555 $unif2->{_Step} . ' ZVelocityList_m=' . $unif2->{_ZVelocityList_m};
556 $unif2->{_note} =
557 $unif2->{_note} . ' ZVelocityList_m=' . $unif2->{_ZVelocityList_m};
558 }
559 }
560  
561 =head2 subroutine z0
562  
563 =cut
564  
565 sub z0 {
566 my ( $variable, $z0 ) = @_;
567 if ($z0) {
568 $unif2->{_z0} = $z0;
569 $unif2->{_Step} = $unif2->{_Step} . ' z0=' . $unif2->{_z0};
570 $unif2->{_note} = $unif2->{_note} . ' z0=' . $unif2->{_z0};
571 }
572 }
573  
574 =head2 subroutine velocityList_mps
575  
576 =cut
577  
578 sub velocityList_mps {
579 my ( $variable, $velocityList_mps ) = @_;
580 if ($velocityList_mps) {
581 $unif2->{_velocityList_mps} = $velocityList_mps;
582 $unif2->{_Step} =
583 $unif2->{_Step} . ' velocityList_mps=' . $unif2->{_velocityList_mps};
584 $unif2->{_note} =
585 $unif2->{_note} . ' velocityList_mps=' . $unif2->{_velocityList_mps};
586 }
587 }
588  
589 =head2 subroutine v00
590  
591 =cut
592  
593 sub v00 {
594 my ( $variable, $v00 ) = @_;
595 if ($v00) {
596 $unif2->{_v00} = $v00;
597 $unif2->{_Step} = $unif2->{_Step} . ' v00=' . $unif2->{_v00};
598 $unif2->{_note} = $unif2->{_note} . ' v00=' . $unif2->{_v00};
599 }
600 }
601  
602 =head2 subroutine interpolateBuriedSurfaceWith
603  
604 =cut
605  
606 sub interpolateBuriedSurfaceWith {
607 my ( $variable, $interpolateBuriedSurfaceWith ) = @_;
608 if ($interpolateBuriedSurfaceWith) {
609 $unif2->{_interpolateBuriedSurfaceWith} = $interpolateBuriedSurfaceWith;
610 $unif2->{_Step} =
611 $unif2->{_Step}
612 . ' interpolateBuriedSurfaceWith='
613 . $unif2->{_interpolateBuriedSurfaceWith};
614 $unif2->{_note} =
615 $unif2->{_note}
616 . ' interpolateBuriedSurfaceWith='
617 . $unif2->{_interpolateBuriedSurfaceWith};
618 }
619 }
620  
621 =head2 subroutine method
622  
623 =cut
624  
625 sub method {
626 my ( $variable, $method ) = @_;
627 if ($method) {
628 $unif2->{_method} = $method;
629 $unif2->{_Step} = $unif2->{_Step} . ' method=' . $unif2->{_method};
630 $unif2->{_note} = $unif2->{_note} . ' method=' . $unif2->{_method};
631 }
632 }
633  
634 =head2 subroutine outboundTestFile
635  
636 =cut
637  
638 sub outboundTestFile {
639 my ( $variable, $outboundTestFile ) = @_;
640 if ($outboundTestFile) {
641 $unif2->{_outboundTestFile} = $outboundTestFile;
642 $unif2->{_Step} =
643 $unif2->{_Step} . ' outboundTestFile=' . $unif2->{_outboundTestFile};
644 $unif2->{_note} =
645 $unif2->{_note} . ' outboundTestFile=' . $unif2->{_outboundTestFile};
646 }
647 }
648  
649 =head2 subroutine note
650  
651 =cut
652  
653 sub note {
654 my ( $variable, $note ) = @_;
655 $unif2->{_note} = 'unif2 ' . $unif2->{_note};
656 return $unif2->{_note};
657 }
658  
659 =head2 subroutine Step
660  
661 =cut
662  
663 sub Step {
664  
665 $unif2->{_Step} = 'unif2 ' . $unif2->{_Step};
666 return $unif2->{_Step};
667 }
668  
669 =head2
670  
671 place 1; at end of the package
672  
673 =cut
674  
675 1;