« lib/App/SeismicUnixGui/sunix/migration/sumiggbzoan.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/statsMath/suop2.pm »
| 1 | package App::SeismicUnixGui::sunix::par::unif2; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: UNIF2 - generate a 2-D UNIFormly sampled velocity profile from a layered | ||
| 8 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 9 | DATE: | ||
| 10 | DESCRIPTION: | ||
| 11 | Version: | ||
| 12 | |||
| 13 | =head2 USE | ||
| 14 | |||
| 15 | =head3 NOTES | ||
| 16 | |||
| 17 | =head4 Examples | ||
| 18 | |||
| 19 | =head3 SEISMIC UNIX NOTES | ||
| 20 | |||
| 21 | UNIF2 - generate a 2-D UNIFormly sampled velocity profile from a layered | ||
| 22 | model. In each layer, velocity is a linear function of position. | ||
| 23 | |||
| 24 | unif2 < infile > outfile [parameters] | ||
| 25 | |||
| 26 | Required parameters: | ||
| 27 | none | ||
| 28 | |||
| 29 | Optional Parameters: | ||
| 30 | ninf=5 number of interfaces | ||
| 31 | nx=100 number of x samples (2nd dimension) | ||
| 32 | nz=100 number of z samples (1st dimension) | ||
| 33 | dx=10 x sampling interval | ||
| 34 | dz=10 z sampling interval | ||
| 35 | |||
| 36 | npmax=201 maximum number of points on interfaces | ||
| 37 | Is relatively independent of nx: | ||
| 38 | e.g., | ||
| 39 | nx =100 and npmax= 10 is OK | ||
| 40 | |||
| 41 | fx=0.0 first x sample | ||
| 42 | fz=0.0 first z sample | ||
| 43 | |||
| 44 | x0=0.0,0.0,..., distance x at which v00 is specified | ||
| 45 | z0=0.0,0.0,..., depth z at which v00 is specified | ||
| 46 | v00=1500,2000,2500..., velocity at each x0,z0 (m/sec) | ||
| 47 | dvdx=0.0,0.0,..., derivative of velocity with distance x (dv/dx) | ||
| 48 | dvdz=0.0,0.0,..., derivative of velocity with depth z (dv/dz) | ||
| 49 | |||
| 50 | method=linear for linear interpolation of interface | ||
| 51 | =mono for monotonic cubic interpolation of interface | ||
| 52 | =akima for Akima's cubic interpolation of interface | ||
| 53 | =spline for cubic spline interpolation of interface | ||
| 54 | |||
| 55 | tfile= =testfilename if set, a sample input dataset is | ||
| 56 | output to "testfilename". | ||
| 57 | |||
| 58 | Notes: | ||
| 59 | The input file is an ASCII file containing x z values representing a | ||
| 60 | piecewise continuous velocity model with a flat surface on top. The surface | ||
| 61 | and each successive boundary between media are represented by a list of | ||
| 62 | selected x z pairs written column form. The first and last x values must | ||
| 63 | be the same for all boundaries. Use the entry 1.0 -99999 to separate | ||
| 64 | entries for successive boundaries. No boundary may cross another. Note | ||
| 65 | that the choice of the method of interpolation may cause boundaries | ||
| 66 | to cross that do not appear to cross in the input data file. | ||
| 67 | The number of interfaces is specified by the parameter "ninf". This | ||
| 68 | number does not include the top surface of the model. The input data | ||
| 69 | format is the same as a CSHOT model file with all comments removed. | ||
| 70 | |||
| 71 | Example using test input file generating feature: | ||
| 72 | unif2 tfile=testfilename produces a 5 interface demonstration model | ||
| 73 | unif2 < testfilename | psimage n1=100 n2=100 d1=10 d2=10 | ... | ||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | Credits: | ||
| 78 | CWP: Zhenyue Liu, 1994 | ||
| 79 | CWP: John Stockwell, 1994, added demonstration model stuff. | ||
| 80 | |||
| 81 | |||
| 82 | =head2 CHANGES and their DATES | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | use Moose; | ||
| 87 | our $VERSION = '0.0.1'; | ||
| 88 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 89 | |||
| 90 | my $get = L_SU_global_constants->new(); | ||
| 91 | |||
| 92 | my $var = $get->var(); | ||
| 93 | my $empty_string = $var->{_empty_string}; | ||
| 94 | |||
| 95 | my $unif2 = { | ||
| 96 | _dvdx => '', | ||
| 97 | _dvdz => '', | ||
| 98 | _dx => '', | ||
| 99 | _dz => '', | ||
| 100 | _fx => '', | ||
| 101 | _fz => '', | ||
| 102 | _method => '', | ||
| 103 | _ninf => '', | ||
| 104 | _npmax => '', | ||
| 105 | _nx => '', | ||
| 106 | _nz => '', | ||
| 107 | _tfile => '', | ||
| 108 | _v00 => '', | ||
| 109 | _x0 => '', | ||
| 110 | _z0 => '', | ||
| 111 | _Step => '', | ||
| 112 | _note => '', | ||
| 113 | }; | ||
| 114 | |||
| 115 | =head2 sub Step | ||
| 116 | |||
| 117 | collects switches and assembles bash instructions | ||
| 118 | by adding the program name | ||
| 119 | |||
| 120 | =cut | ||
| 121 | |||
| 122 | sub Step { | ||
| 123 | |||
| 124 | $unif2->{_Step} = 'unif2' . $unif2->{_Step}; | ||
| 125 | return ( $unif2->{_Step} ); | ||
| 126 | |||
| 127 | } | ||
| 128 | |||
| 129 | =head2 sub note | ||
| 130 | |||
| 131 | collects switches and assembles bash instructions | ||
| 132 | by adding the program name | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | sub note { | ||
| 137 | |||
| 138 | $unif2->{_note} = 'unif2' . $unif2->{_note}; | ||
| 139 | return ( $unif2->{_note} ); | ||
| 140 | |||
| 141 | } | ||
| 142 | |||
| 143 | =head2 sub clear | ||
| 144 | |||
| 145 | =cut | ||
| 146 | |||
| 147 | sub clear { | ||
| 148 | |||
| 149 | $unif2->{_dvdx} = ''; | ||
| 150 | $unif2->{_dvdz} = ''; | ||
| 151 | $unif2->{_dx} = ''; | ||
| 152 | $unif2->{_dz} = ''; | ||
| 153 | $unif2->{_fx} = ''; | ||
| 154 | $unif2->{_fz} = ''; | ||
| 155 | $unif2->{_method} = ''; | ||
| 156 | $unif2->{_ninf} = ''; | ||
| 157 | $unif2->{_npmax} = ''; | ||
| 158 | $unif2->{_nx} = ''; | ||
| 159 | $unif2->{_nz} = ''; | ||
| 160 | $unif2->{_tfile} = ''; | ||
| 161 | $unif2->{_v00} = ''; | ||
| 162 | $unif2->{_x0} = ''; | ||
| 163 | $unif2->{_z0} = ''; | ||
| 164 | $unif2->{_Step} = ''; | ||
| 165 | $unif2->{_note} = ''; | ||
| 166 | } | ||
| 167 | |||
| 168 | =head2 sub dvdx | ||
| 169 | |||
| 170 | |||
| 171 | =cut | ||
| 172 | |||
| 173 | sub dvdx { | ||
| 174 | |||
| 175 | my ( $self, $dvdx ) = @_; | ||
| 176 | if ( $dvdx ne $empty_string ) { | ||
| 177 | |||
| 178 | $unif2->{_dvdx} = $dvdx; | ||
| 179 | $unif2->{_note} = $unif2->{_note} . ' dvdx=' . $unif2->{_dvdx}; | ||
| 180 | $unif2->{_Step} = $unif2->{_Step} . ' dvdx=' . $unif2->{_dvdx}; | ||
| 181 | |||
| 182 | } | ||
| 183 | else { | ||
| 184 | print("unif2, dvdx, missing dvdx,\n"); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 188 | =head2 sub dvdz | ||
| 189 | |||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | sub dvdz { | ||
| 194 | |||
| 195 | my ( $self, $dvdz ) = @_; | ||
| 196 | if ( $dvdz ne $empty_string ) { | ||
| 197 | |||
| 198 | $unif2->{_dvdz} = $dvdz; | ||
| 199 | $unif2->{_note} = $unif2->{_note} . ' dvdz=' . $unif2->{_dvdz}; | ||
| 200 | $unif2->{_Step} = $unif2->{_Step} . ' dvdz=' . $unif2->{_dvdz}; | ||
| 201 | |||
| 202 | } | ||
| 203 | else { | ||
| 204 | print("unif2, dvdz, missing dvdz,\n"); | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 208 | =head2 sub dx | ||
| 209 | |||
| 210 | |||
| 211 | =cut | ||
| 212 | |||
| 213 | sub dx { | ||
| 214 | |||
| 215 | my ( $self, $dx ) = @_; | ||
| 216 | if ( $dx ne $empty_string ) { | ||
| 217 | |||
| 218 | $unif2->{_dx} = $dx; | ||
| 219 | $unif2->{_note} = $unif2->{_note} . ' dx=' . $unif2->{_dx}; | ||
| 220 | $unif2->{_Step} = $unif2->{_Step} . ' dx=' . $unif2->{_dx}; | ||
| 221 | |||
| 222 | } | ||
| 223 | else { | ||
| 224 | print("unif2, dx, missing dx,\n"); | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | =head2 sub dz | ||
| 229 | |||
| 230 | |||
| 231 | =cut | ||
| 232 | |||
| 233 | sub dz { | ||
| 234 | |||
| 235 | my ( $self, $dz ) = @_; | ||
| 236 | if ( $dz ne $empty_string ) { | ||
| 237 | |||
| 238 | $unif2->{_dz} = $dz; | ||
| 239 | $unif2->{_note} = $unif2->{_note} . ' dz=' . $unif2->{_dz}; | ||
| 240 | $unif2->{_Step} = $unif2->{_Step} . ' dz=' . $unif2->{_dz}; | ||
| 241 | |||
| 242 | } | ||
| 243 | else { | ||
| 244 | print("unif2, dz, missing dz,\n"); | ||
| 245 | } | ||
| 246 | } | ||
| 247 | |||
| 248 | =head2 sub fx | ||
| 249 | |||
| 250 | |||
| 251 | =cut | ||
| 252 | |||
| 253 | sub fx { | ||
| 254 | |||
| 255 | my ( $self, $fx ) = @_; | ||
| 256 | if ( $fx ne $empty_string ) { | ||
| 257 | |||
| 258 | $unif2->{_fx} = $fx; | ||
| 259 | $unif2->{_note} = $unif2->{_note} . ' fx=' . $unif2->{_fx}; | ||
| 260 | $unif2->{_Step} = $unif2->{_Step} . ' fx=' . $unif2->{_fx}; | ||
| 261 | |||
| 262 | } | ||
| 263 | else { | ||
| 264 | print("unif2, fx, missing fx,\n"); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | =head2 sub fz | ||
| 269 | |||
| 270 | |||
| 271 | =cut | ||
| 272 | |||
| 273 | sub fz { | ||
| 274 | |||
| 275 | my ( $self, $fz ) = @_; | ||
| 276 | if ( $fz ne $empty_string ) { | ||
| 277 | |||
| 278 | $unif2->{_fz} = $fz; | ||
| 279 | $unif2->{_note} = $unif2->{_note} . ' fz=' . $unif2->{_fz}; | ||
| 280 | $unif2->{_Step} = $unif2->{_Step} . ' fz=' . $unif2->{_fz}; | ||
| 281 | |||
| 282 | } | ||
| 283 | else { | ||
| 284 | print("unif2, fz, missing fz,\n"); | ||
| 285 | } | ||
| 286 | } | ||
| 287 | |||
| 288 | =head2 sub method | ||
| 289 | |||
| 290 | |||
| 291 | =cut | ||
| 292 | |||
| 293 | sub method { | ||
| 294 | |||
| 295 | my ( $self, $method ) = @_; | ||
| 296 | if ( $method ne $empty_string ) { | ||
| 297 | |||
| 298 | $unif2->{_method} = $method; | ||
| 299 | $unif2->{_note} = $unif2->{_note} . ' method=' . $unif2->{_method}; | ||
| 300 | $unif2->{_Step} = $unif2->{_Step} . ' method=' . $unif2->{_method}; | ||
| 301 | |||
| 302 | } | ||
| 303 | else { | ||
| 304 | print("unif2, method, missing method,\n"); | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | =head2 sub ninf | ||
| 309 | |||
| 310 | |||
| 311 | =cut | ||
| 312 | |||
| 313 | sub ninf { | ||
| 314 | |||
| 315 | my ( $self, $ninf ) = @_; | ||
| 316 | if ( $ninf ne $empty_string ) { | ||
| 317 | |||
| 318 | $unif2->{_ninf} = $ninf; | ||
| 319 | $unif2->{_note} = $unif2->{_note} . ' ninf=' . $unif2->{_ninf}; | ||
| 320 | $unif2->{_Step} = $unif2->{_Step} . ' ninf=' . $unif2->{_ninf}; | ||
| 321 | |||
| 322 | } | ||
| 323 | else { | ||
| 324 | print("unif2, ninf, missing ninf,\n"); | ||
| 325 | } | ||
| 326 | } | ||
| 327 | |||
| 328 | =head2 sub npmax | ||
| 329 | |||
| 330 | |||
| 331 | =cut | ||
| 332 | |||
| 333 | sub npmax { | ||
| 334 | |||
| 335 | my ( $self, $npmax ) = @_; | ||
| 336 | if ( $npmax ne $empty_string ) { | ||
| 337 | |||
| 338 | $unif2->{_npmax} = $npmax; | ||
| 339 | $unif2->{_note} = $unif2->{_note} . ' npmax=' . $unif2->{_npmax}; | ||
| 340 | $unif2->{_Step} = $unif2->{_Step} . ' npmax=' . $unif2->{_npmax}; | ||
| 341 | |||
| 342 | } | ||
| 343 | else { | ||
| 344 | print("unif2, npmax, missing npmax,\n"); | ||
| 345 | } | ||
| 346 | } | ||
| 347 | |||
| 348 | =head2 sub nx | ||
| 349 | |||
| 350 | |||
| 351 | =cut | ||
| 352 | |||
| 353 | sub nx { | ||
| 354 | |||
| 355 | my ( $self, $nx ) = @_; | ||
| 356 | if ( $nx ne $empty_string ) { | ||
| 357 | |||
| 358 | $unif2->{_nx} = $nx; | ||
| 359 | $unif2->{_note} = $unif2->{_note} . ' nx=' . $unif2->{_nx}; | ||
| 360 | $unif2->{_Step} = $unif2->{_Step} . ' nx=' . $unif2->{_nx}; | ||
| 361 | |||
| 362 | } | ||
| 363 | else { | ||
| 364 | print("unif2, nx, missing nx,\n"); | ||
| 365 | } | ||
| 366 | } | ||
| 367 | |||
| 368 | =head2 sub nz | ||
| 369 | |||
| 370 | |||
| 371 | =cut | ||
| 372 | |||
| 373 | sub nz { | ||
| 374 | |||
| 375 | my ( $self, $nz ) = @_; | ||
| 376 | if ( $nz ne $empty_string ) { | ||
| 377 | |||
| 378 | $unif2->{_nz} = $nz; | ||
| 379 | $unif2->{_note} = $unif2->{_note} . ' nz=' . $unif2->{_nz}; | ||
| 380 | $unif2->{_Step} = $unif2->{_Step} . ' nz=' . $unif2->{_nz}; | ||
| 381 | |||
| 382 | } | ||
| 383 | else { | ||
| 384 | print("unif2, nz, missing nz,\n"); | ||
| 385 | } | ||
| 386 | } | ||
| 387 | |||
| 388 | =head2 sub tfile | ||
| 389 | |||
| 390 | |||
| 391 | =cut | ||
| 392 | |||
| 393 | sub tfile { | ||
| 394 | |||
| 395 | my ( $self, $tfile ) = @_; | ||
| 396 | if ( $tfile ne $empty_string ) { | ||
| 397 | |||
| 398 | $unif2->{_tfile} = $tfile; | ||
| 399 | $unif2->{_note} = $unif2->{_note} . ' tfile=' . $unif2->{_tfile}; | ||
| 400 | $unif2->{_Step} = $unif2->{_Step} . ' tfile=' . $unif2->{_tfile}; | ||
| 401 | |||
| 402 | } | ||
| 403 | else { | ||
| 404 | print("unif2, tfile, missing tfile,\n"); | ||
| 405 | } | ||
| 406 | } | ||
| 407 | |||
| 408 | =head2 sub v00 | ||
| 409 | |||
| 410 | |||
| 411 | =cut | ||
| 412 | |||
| 413 | sub v00 { | ||
| 414 | |||
| 415 | my ( $self, $v00 ) = @_; | ||
| 416 | if ( $v00 ne $empty_string ) { | ||
| 417 | |||
| 418 | $unif2->{_v00} = $v00; | ||
| 419 | $unif2->{_note} = $unif2->{_note} . ' v00=' . $unif2->{_v00}; | ||
| 420 | $unif2->{_Step} = $unif2->{_Step} . ' v00=' . $unif2->{_v00}; | ||
| 421 | |||
| 422 | } | ||
| 423 | else { | ||
| 424 | print("unif2, v00, missing v00,\n"); | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | =head2 sub x0 | ||
| 429 | |||
| 430 | |||
| 431 | =cut | ||
| 432 | |||
| 433 | sub x0 { | ||
| 434 | |||
| 435 | my ( $self, $x0 ) = @_; | ||
| 436 | if ( $x0 ne $empty_string ) { | ||
| 437 | |||
| 438 | $unif2->{_x0} = $x0; | ||
| 439 | $unif2->{_note} = $unif2->{_note} . ' x0=' . $unif2->{_x0}; | ||
| 440 | $unif2->{_Step} = $unif2->{_Step} . ' x0=' . $unif2->{_x0}; | ||
| 441 | |||
| 442 | } | ||
| 443 | else { | ||
| 444 | print("unif2, x0, missing x0,\n"); | ||
| 445 | } | ||
| 446 | } | ||
| 447 | |||
| 448 | =head2 sub z0 | ||
| 449 | |||
| 450 | |||
| 451 | =cut | ||
| 452 | |||
| 453 | sub z0 { | ||
| 454 | |||
| 455 | my ( $self, $z0 ) = @_; | ||
| 456 | if ( $z0 ne $empty_string ) { | ||
| 457 | |||
| 458 | $unif2->{_z0} = $z0; | ||
| 459 | $unif2->{_note} = $unif2->{_note} . ' z0=' . $unif2->{_z0}; | ||
| 460 | $unif2->{_Step} = $unif2->{_Step} . ' z0=' . $unif2->{_z0}; | ||
| 461 | |||
| 462 | } | ||
| 463 | else { | ||
| 464 | print("unif2, z0, missing z0,\n"); | ||
| 465 | } | ||
| 466 | } | ||
| 467 | |||
| 468 | =head2 sub get_max_index | ||
| 469 | |||
| 470 | max index = number of input variables -1 | ||
| 471 | |||
| 472 | =cut | ||
| 473 | |||
| 474 | sub get_max_index { | ||
| 475 | my ($self) = @_; | ||
| 476 | my $max_index = 14; | ||
| 477 | |||
| 478 | return ($max_index); | ||
| 479 | } | ||
| 480 | |||
| 481 | 1; |