« lib/App/SeismicUnixGui/sunix/NMO_Vel_Stk/suvel2df.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/migration/sumigpsti.pm »
| 1 | package App::SeismicUnixGui::sunix::header::suazimuth; | ||
| 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 | SUAZIMUTH - compute trace AZIMUTH, offset, and midpoint coordinates | ||
| 25 | |||
| 26 | and set user-specified header fields to these values | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | suazimuth <stdin >stdout [optional parameters] | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | Required parameters: | ||
| 35 | |||
| 36 | none | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | Optional parameters: | ||
| 41 | |||
| 42 | key=otrav header field to store computed azimuths in | ||
| 43 | |||
| 44 | scale=1.0 value(key) = scale * azimuth | ||
| 45 | |||
| 46 | az=0 azimuth convention flag | ||
| 47 | |||
| 48 | 0: 0-179.999 deg, reciprocity assumed | ||
| 49 | |||
| 50 | 1: 0-359.999 deg, points from receiver to source | ||
| 51 | |||
| 52 | -1: 0-359.999 deg, points from source to receiver | ||
| 53 | |||
| 54 | sector=1.0 if set, defines output in sectors of size | ||
| 55 | |||
| 56 | sector=degrees_per_sector, the default mode is | ||
| 57 | |||
| 58 | the full range of angles specified by az | ||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | offset=0 if offset=1 then set offset header field | ||
| 63 | |||
| 64 | offkey=offset header field to store computed offsets in | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | cmp=0 if cmp=1, then compute midpoint coordinates and | ||
| 69 | |||
| 70 | set header fields for (cmpx, cmpy) | ||
| 71 | |||
| 72 | mxkey=ep header field to store computed cmpx in | ||
| 73 | |||
| 74 | mykey=cdp header field to store computed cmpy in | ||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | Notes: | ||
| 79 | |||
| 80 | All values are computed from the values in the coordinate fields | ||
| 81 | |||
| 82 | sx,sy (source) and gx,gy (receiver). | ||
| 83 | |||
| 84 | The output field "otrav" for the azimuth was chosen arbitrarily as | ||
| 85 | |||
| 86 | an example of a little-used header field, however, the user may | ||
| 87 | |||
| 88 | choose any field that is convenient for his or her application. | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | Setting the sector=number_of_degrees_per_sector sets key field to | ||
| 93 | |||
| 94 | sector number rather than an angle in degrees. | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | For az=0, azimuths are measured from the North, however, reciprocity | ||
| 99 | |||
| 100 | is assumed, so azimuths go from 0 to 179.9999 degrees. If sector | ||
| 101 | |||
| 102 | option is set, then the range is from 0 to 180/sector. | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | For az=1, azimuths are measured from the North, with the assumption | ||
| 107 | |||
| 108 | that the direction vector points from the receiver to the source. | ||
| 109 | |||
| 110 | For az=-1, the direction vector points from the source to the | ||
| 111 | |||
| 112 | receiver. No reciprocity is assumed in these cases, so the angles go | ||
| 113 | |||
| 114 | from 0 to 359.999 degrees. | ||
| 115 | |||
| 116 | If the sector option is set, then the range is from 0 to 360/sector. | ||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | Caveat: | ||
| 121 | |||
| 122 | This program honors the value of scalco in scaling the values of | ||
| 123 | |||
| 124 | sx,sy,gx,gy. Type "sukeyword scalco" for more information. | ||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | Type "sukeyword -o" to see the keywords and descriptions of all | ||
| 129 | |||
| 130 | header fields. | ||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | To plot midpoints, use: su3dchart | ||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | Credits: | ||
| 141 | |||
| 142 | based on suchw, su3dchart | ||
| 143 | |||
| 144 | CWP: John Stockwell and UTulsa: Chris Liner, Oct. 1998 | ||
| 145 | |||
| 146 | UTulsa: Chris Liner added offset option, Feb. 2002 | ||
| 147 | |||
| 148 | cll: fixed offset option and added cmp option, May 2003 | ||
| 149 | |||
| 150 | RISSC: Nils Maercklin added key options for offset and | ||
| 151 | |||
| 152 | midpoints, and added azimuth direction option, Sep. 2006 | ||
| 153 | |||
| 154 | |||
| 155 | |||
| 156 | Algorithms: | ||
| 157 | |||
| 158 | offset = osign * sqrt( (gx-sx)*(gx-sx) + (gy-sy)*(gy-sy) ) | ||
| 159 | |||
| 160 | with osign = sgn( min((sx-gx),(sy-gy)) ) | ||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | midpoint x value xm = (sx + gx)/2 | ||
| 165 | |||
| 166 | midpoint y value ym = (sy + gy)/2 | ||
| 167 | |||
| 168 | |||
| 169 | |||
| 170 | Azimuth will be defined as the angle, measured in degrees, | ||
| 171 | |||
| 172 | turned from North, of a vector pointing to the source from the midpoint, | ||
| 173 | |||
| 174 | or from the midpoint to the source. Azimuths go from 0-179.000 degrees | ||
| 175 | |||
| 176 | or from 0-180.0 degrees. | ||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | value(key) = scale*[90.0 - (180.0/PI)*(atan((sy - ym)/(sx - xm))) ] | ||
| 181 | |||
| 182 | or | ||
| 183 | |||
| 184 | value(key) = scale*[180.0 - (180.0/PI)*(atan2((ym - sy),(xm - sx)) ] | ||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | Trace header fields accessed: sx, sy, gx, gy, scalco. | ||
| 189 | |||
| 190 | Trace header fields modified: (user-specified keys) | ||
| 191 | |||
| 192 | |||
| 193 | |||
| 194 | |||
| 195 | |||
| 196 | =head2 User's notes (Juan Lorenzo) | ||
| 197 | untested | ||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | |||
| 202 | =head2 CHANGES and their DATES | ||
| 203 | |||
| 204 | =cut | ||
| 205 | |||
| 206 | use Moose; | ||
| 207 | our $VERSION = '0.0.1'; | ||
| 208 | |||
| 209 | |||
| 210 | =head2 Import packages | ||
| 211 | |||
| 212 | =cut | ||
| 213 | |||
| 214 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 215 | |||
| 216 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 217 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 218 | |||
| 219 | |||
| 220 | =head2 instantiation of packages | ||
| 221 | |||
| 222 | =cut | ||
| 223 | |||
| 224 | my $get = L_SU_global_constants->new(); | ||
| 225 | my $Project = Project_config->new(); | ||
| 226 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 227 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 228 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 229 | |||
| 230 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 231 | |||
| 232 | my $var = $get->var(); | ||
| 233 | my $on = $var->{_on}; | ||
| 234 | my $off = $var->{_off}; | ||
| 235 | my $true = $var->{_true}; | ||
| 236 | my $false = $var->{_false}; | ||
| 237 | my $empty_string = $var->{_empty_string}; | ||
| 238 | |||
| 239 | =head2 Encapsulated | ||
| 240 | hash of private variables | ||
| 241 | |||
| 242 | =cut | ||
| 243 | |||
| 244 | my $suazimuth = { | ||
| 245 | _az => '', | ||
| 246 | _cmp => '', | ||
| 247 | _key => '', | ||
| 248 | _mxkey => '', | ||
| 249 | _mykey => '', | ||
| 250 | _offkey => '', | ||
| 251 | _offset => '', | ||
| 252 | _osign => '', | ||
| 253 | _scale => '', | ||
| 254 | _sector => '', | ||
| 255 | _xm => '', | ||
| 256 | _ym => '', | ||
| 257 | _Step => '', | ||
| 258 | _note => '', | ||
| 259 | |||
| 260 | }; | ||
| 261 | |||
| 262 | =head2 sub Step | ||
| 263 | |||
| 264 | collects switches and assembles bash instructions | ||
| 265 | by adding the program name | ||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | sub Step { | ||
| 270 | |||
| 271 | $suazimuth->{_Step} = 'suazimuth'.$suazimuth->{_Step}; | ||
| 272 | return ( $suazimuth->{_Step} ); | ||
| 273 | |||
| 274 | } | ||
| 275 | |||
| 276 | |||
| 277 | =head2 sub note | ||
| 278 | |||
| 279 | collects switches and assembles bash instructions | ||
| 280 | by adding the program name | ||
| 281 | |||
| 282 | =cut | ||
| 283 | |||
| 284 | sub note { | ||
| 285 | |||
| 286 | $suazimuth->{_note} = 'suazimuth'.$suazimuth->{_note}; | ||
| 287 | return ( $suazimuth->{_note} ); | ||
| 288 | |||
| 289 | } | ||
| 290 | |||
| 291 | |||
| 292 | |||
| 293 | =head2 sub clear | ||
| 294 | |||
| 295 | =cut | ||
| 296 | |||
| 297 | sub clear { | ||
| 298 | |||
| 299 | $suazimuth->{_az} = ''; | ||
| 300 | $suazimuth->{_cmp} = ''; | ||
| 301 | $suazimuth->{_key} = ''; | ||
| 302 | $suazimuth->{_mxkey} = ''; | ||
| 303 | $suazimuth->{_mykey} = ''; | ||
| 304 | $suazimuth->{_offkey} = ''; | ||
| 305 | $suazimuth->{_offset} = ''; | ||
| 306 | $suazimuth->{_osign} = ''; | ||
| 307 | $suazimuth->{_scale} = ''; | ||
| 308 | $suazimuth->{_sector} = ''; | ||
| 309 | $suazimuth->{_xm} = ''; | ||
| 310 | $suazimuth->{_ym} = ''; | ||
| 311 | $suazimuth->{_Step} = ''; | ||
| 312 | $suazimuth->{_note} = ''; | ||
| 313 | } | ||
| 314 | |||
| 315 | |||
| 316 | =head2 sub az | ||
| 317 | |||
| 318 | |||
| 319 | =cut | ||
| 320 | |||
| 321 | sub az { | ||
| 322 | |||
| 323 | my ( $self,$az ) = @_; | ||
| 324 | if ( $az ne $empty_string ) { | ||
| 325 | |||
| 326 | $suazimuth->{_az} = $az; | ||
| 327 | $suazimuth->{_note} = $suazimuth->{_note}.' az='.$suazimuth->{_az}; | ||
| 328 | $suazimuth->{_Step} = $suazimuth->{_Step}.' az='.$suazimuth->{_az}; | ||
| 329 | |||
| 330 | } else { | ||
| 331 | print("suazimuth, az, missing az,\n"); | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | |||
| 336 | =head2 sub cmp | ||
| 337 | |||
| 338 | |||
| 339 | =cut | ||
| 340 | |||
| 341 | sub cmp { | ||
| 342 | |||
| 343 | my ( $self,$cmp ) = @_; | ||
| 344 | if ( $cmp ne $empty_string ) { | ||
| 345 | |||
| 346 | $suazimuth->{_cmp} = $cmp; | ||
| 347 | $suazimuth->{_note} = $suazimuth->{_note}.' cmp='.$suazimuth->{_cmp}; | ||
| 348 | $suazimuth->{_Step} = $suazimuth->{_Step}.' cmp='.$suazimuth->{_cmp}; | ||
| 349 | |||
| 350 | } else { | ||
| 351 | print("suazimuth, cmp, missing cmp,\n"); | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 | |||
| 356 | =head2 sub key | ||
| 357 | |||
| 358 | |||
| 359 | =cut | ||
| 360 | |||
| 361 | sub key { | ||
| 362 | |||
| 363 | my ( $self,$key ) = @_; | ||
| 364 | if ( $key ne $empty_string ) { | ||
| 365 | |||
| 366 | $suazimuth->{_key} = $key; | ||
| 367 | $suazimuth->{_note} = $suazimuth->{_note}.' key='.$suazimuth->{_key}; | ||
| 368 | $suazimuth->{_Step} = $suazimuth->{_Step}.' key='.$suazimuth->{_key}; | ||
| 369 | |||
| 370 | } else { | ||
| 371 | print("suazimuth, key, missing key,\n"); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | |||
| 376 | =head2 sub mxkey | ||
| 377 | |||
| 378 | |||
| 379 | =cut | ||
| 380 | |||
| 381 | sub mxkey { | ||
| 382 | |||
| 383 | my ( $self,$mxkey ) = @_; | ||
| 384 | if ( $mxkey ne $empty_string ) { | ||
| 385 | |||
| 386 | $suazimuth->{_mxkey} = $mxkey; | ||
| 387 | $suazimuth->{_note} = $suazimuth->{_note}.' mxkey='.$suazimuth->{_mxkey}; | ||
| 388 | $suazimuth->{_Step} = $suazimuth->{_Step}.' mxkey='.$suazimuth->{_mxkey}; | ||
| 389 | |||
| 390 | } else { | ||
| 391 | print("suazimuth, mxkey, missing mxkey,\n"); | ||
| 392 | } | ||
| 393 | } | ||
| 394 | |||
| 395 | |||
| 396 | =head2 sub mykey | ||
| 397 | |||
| 398 | |||
| 399 | =cut | ||
| 400 | |||
| 401 | sub mykey { | ||
| 402 | |||
| 403 | my ( $self,$mykey ) = @_; | ||
| 404 | if ( $mykey ne $empty_string ) { | ||
| 405 | |||
| 406 | $suazimuth->{_mykey} = $mykey; | ||
| 407 | $suazimuth->{_note} = $suazimuth->{_note}.' mykey='.$suazimuth->{_mykey}; | ||
| 408 | $suazimuth->{_Step} = $suazimuth->{_Step}.' mykey='.$suazimuth->{_mykey}; | ||
| 409 | |||
| 410 | } else { | ||
| 411 | print("suazimuth, mykey, missing mykey,\n"); | ||
| 412 | } | ||
| 413 | } | ||
| 414 | |||
| 415 | |||
| 416 | =head2 sub offkey | ||
| 417 | |||
| 418 | |||
| 419 | =cut | ||
| 420 | |||
| 421 | sub offkey { | ||
| 422 | |||
| 423 | my ( $self,$offkey ) = @_; | ||
| 424 | if ( $offkey ne $empty_string ) { | ||
| 425 | |||
| 426 | $suazimuth->{_offkey} = $offkey; | ||
| 427 | $suazimuth->{_note} = $suazimuth->{_note}.' offkey='.$suazimuth->{_offkey}; | ||
| 428 | $suazimuth->{_Step} = $suazimuth->{_Step}.' offkey='.$suazimuth->{_offkey}; | ||
| 429 | |||
| 430 | } else { | ||
| 431 | print("suazimuth, offkey, missing offkey,\n"); | ||
| 432 | } | ||
| 433 | } | ||
| 434 | |||
| 435 | |||
| 436 | =head2 sub offset | ||
| 437 | |||
| 438 | |||
| 439 | =cut | ||
| 440 | |||
| 441 | sub offset { | ||
| 442 | |||
| 443 | my ( $self,$offset ) = @_; | ||
| 444 | if ( $offset ne $empty_string ) { | ||
| 445 | |||
| 446 | $suazimuth->{_offset} = $offset; | ||
| 447 | $suazimuth->{_note} = $suazimuth->{_note}.' offset='.$suazimuth->{_offset}; | ||
| 448 | $suazimuth->{_Step} = $suazimuth->{_Step}.' offset='.$suazimuth->{_offset}; | ||
| 449 | |||
| 450 | } else { | ||
| 451 | print("suazimuth, offset, missing offset,\n"); | ||
| 452 | } | ||
| 453 | } | ||
| 454 | |||
| 455 | |||
| 456 | =head2 sub osign | ||
| 457 | |||
| 458 | |||
| 459 | =cut | ||
| 460 | |||
| 461 | sub osign { | ||
| 462 | |||
| 463 | my ( $self,$osign ) = @_; | ||
| 464 | if ( $osign ne $empty_string ) { | ||
| 465 | |||
| 466 | $suazimuth->{_osign} = $osign; | ||
| 467 | $suazimuth->{_note} = $suazimuth->{_note}.' osign='.$suazimuth->{_osign}; | ||
| 468 | $suazimuth->{_Step} = $suazimuth->{_Step}.' osign='.$suazimuth->{_osign}; | ||
| 469 | |||
| 470 | } else { | ||
| 471 | print("suazimuth, osign, missing osign,\n"); | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 475 | |||
| 476 | =head2 sub scale | ||
| 477 | |||
| 478 | |||
| 479 | =cut | ||
| 480 | |||
| 481 | sub scale { | ||
| 482 | |||
| 483 | my ( $self,$scale ) = @_; | ||
| 484 | if ( $scale ne $empty_string ) { | ||
| 485 | |||
| 486 | $suazimuth->{_scale} = $scale; | ||
| 487 | $suazimuth->{_note} = $suazimuth->{_note}.' scale='.$suazimuth->{_scale}; | ||
| 488 | $suazimuth->{_Step} = $suazimuth->{_Step}.' scale='.$suazimuth->{_scale}; | ||
| 489 | |||
| 490 | } else { | ||
| 491 | print("suazimuth, scale, missing scale,\n"); | ||
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 | |||
| 496 | =head2 sub sector | ||
| 497 | |||
| 498 | |||
| 499 | =cut | ||
| 500 | |||
| 501 | sub sector { | ||
| 502 | |||
| 503 | my ( $self,$sector ) = @_; | ||
| 504 | if ( $sector ne $empty_string ) { | ||
| 505 | |||
| 506 | $suazimuth->{_sector} = $sector; | ||
| 507 | $suazimuth->{_note} = $suazimuth->{_note}.' sector='.$suazimuth->{_sector}; | ||
| 508 | $suazimuth->{_Step} = $suazimuth->{_Step}.' sector='.$suazimuth->{_sector}; | ||
| 509 | |||
| 510 | } else { | ||
| 511 | print("suazimuth, sector, missing sector,\n"); | ||
| 512 | } | ||
| 513 | } | ||
| 514 | |||
| 515 | |||
| 516 | =head2 sub xm | ||
| 517 | |||
| 518 | |||
| 519 | =cut | ||
| 520 | |||
| 521 | sub xm { | ||
| 522 | |||
| 523 | my ( $self,$xm ) = @_; | ||
| 524 | if ( $xm ne $empty_string ) { | ||
| 525 | |||
| 526 | $suazimuth->{_xm} = $xm; | ||
| 527 | $suazimuth->{_note} = $suazimuth->{_note}.' xm='.$suazimuth->{_xm}; | ||
| 528 | $suazimuth->{_Step} = $suazimuth->{_Step}.' xm='.$suazimuth->{_xm}; | ||
| 529 | |||
| 530 | } else { | ||
| 531 | print("suazimuth, xm, missing xm,\n"); | ||
| 532 | } | ||
| 533 | } | ||
| 534 | |||
| 535 | |||
| 536 | =head2 sub ym | ||
| 537 | |||
| 538 | |||
| 539 | =cut | ||
| 540 | |||
| 541 | sub ym { | ||
| 542 | |||
| 543 | my ( $self,$ym ) = @_; | ||
| 544 | if ( $ym ne $empty_string ) { | ||
| 545 | |||
| 546 | $suazimuth->{_ym} = $ym; | ||
| 547 | $suazimuth->{_note} = $suazimuth->{_note}.' ym='.$suazimuth->{_ym}; | ||
| 548 | $suazimuth->{_Step} = $suazimuth->{_Step}.' ym='.$suazimuth->{_ym}; | ||
| 549 | |||
| 550 | } else { | ||
| 551 | print("suazimuth, ym, missing ym,\n"); | ||
| 552 | } | ||
| 553 | } | ||
| 554 | |||
| 555 | |||
| 556 | =head2 sub get_max_index | ||
| 557 | |||
| 558 | max index = number of input variables -1 | ||
| 559 | |||
| 560 | =cut | ||
| 561 | |||
| 562 | sub get_max_index { | ||
| 563 | my ($self) = @_; | ||
| 564 | my $max_index = 11; | ||
| 565 | |||
| 566 | return($max_index); | ||
| 567 | } | ||
| 568 | |||
| 569 | |||
| 570 | 1; |