« lib/App/SeismicUnixGui/sunix/par/unisam2.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/transform/succwt.pm »
| 1 | package App::SeismicUnixGui::sunix::statsMath::suxmax; | ||
| 2 | |||
| 3 | |||
| 4 | =head1 DOCUMENTATION | ||
| 5 | |||
| 6 | =head2 SYNOPSIS | ||
| 7 | |||
| 8 | PERL PROGRAM NAME: SUXMAX - X-windows graph of the MAX, min, or absolute max value on | ||
| 9 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 10 | DATE: | ||
| 11 | DESCRIPTION: | ||
| 12 | Version: | ||
| 13 | |||
| 14 | =head2 USE | ||
| 15 | |||
| 16 | =head3 NOTES | ||
| 17 | |||
| 18 | =head4 Examples | ||
| 19 | |||
| 20 | =head3 SEISMIC UNIX NOTES | ||
| 21 | |||
| 22 | SUXMAX - X-windows graph of the MAX, min, or absolute max value on | ||
| 23 | each trace of a SEGY (SU) data set | ||
| 24 | |||
| 25 | suxmax <stdin [optional parameters] | ||
| 26 | |||
| 27 | Optional parameters: | ||
| 28 | mode=max max value | ||
| 29 | =min min value | ||
| 30 | =abs absolute max value | ||
| 31 | |||
| 32 | n2=tr.ntr or number of traces in the data set (ntr is an alias for n2) | ||
| 33 | |||
| 34 | d1=tr.d1 or tr.dt/10^6 sampling interval in the fast dimension | ||
| 35 | =.004 for seismic (if not set) | ||
| 36 | =1.0 for nonseismic (if not set) | ||
| 37 | |||
| 38 | d2=tr.d2 sampling interval in the slow dimension | ||
| 39 | =1.0 (if not set) | ||
| 40 | |||
| 41 | f1=tr.f1 or tr.delrt/10^3 or 0.0 first sample in the fast dimension | ||
| 42 | |||
| 43 | f2=tr.f2 or tr.tracr or tr.tracl first sample in the slow dimension | ||
| 44 | =1.0 for seismic (if not set) | ||
| 45 | =d2 for nonseismic (if not set) | ||
| 46 | |||
| 47 | verbose=0 =1 to print some useful information | ||
| 48 | |||
| 49 | tmpdir= if non-empty, use the value as a directory path | ||
| 50 | prefix for storing temporary files; else if the | ||
| 51 | the CWP_TMPDIR environment variable is set use | ||
| 52 | its value for the path; else use tmpfile() | ||
| 53 | |||
| 54 | Note that for seismic time domain data, the "fast dimension" is | ||
| 55 | time and the "slow dimension" is usually trace number or range. | ||
| 56 | Also note that "foreign" data tapes may have something unexpected | ||
| 57 | in the d2,f2 fields, use segyclean to clear these if you can afford | ||
| 58 | the processing time or use d2= f2= to over-ride the header values if | ||
| 59 | not. | ||
| 60 | |||
| 61 | See the sumax selfdoc for additional parameter. | ||
| 62 | See the xgraph selfdoc for the remaining parameters. | ||
| 63 | |||
| 64 | |||
| 65 | Credits: | ||
| 66 | |||
| 67 | CWP: John Stockwell, based on Jack Cohen's SU JACKet | ||
| 68 | |||
| 69 | Notes: | ||
| 70 | When the number of traces isn't known, we need to count | ||
| 71 | the traces for xgraph. You can make this value "known" | ||
| 72 | either by getparring n2 or by having the ntr field set | ||
| 73 | in the trace header. A getparred value takes precedence | ||
| 74 | over the value in the trace header. | ||
| 75 | |||
| 76 | When we do have to count the traces, we use the "tmpfile" | ||
| 77 | routine because on many machines it is implemented | ||
| 78 | as a memory area instead of a disk file. | ||
| 79 | |||
| 80 | SUMAX - get trace by trace local/global maxima, minima, or absolute maximum | ||
| 81 | |||
| 82 | sumax <stdin >stdout [optional parameters] | ||
| 83 | |||
| 84 | Required parameters: | ||
| 85 | none | ||
| 86 | |||
| 87 | Optional parameters: | ||
| 88 | output=ascii write ascii data to outpar | ||
| 89 | =binary for binary floats to stdout | ||
| 90 | =segy for SEGY traces to stdout | ||
| 91 | |||
| 92 | mode=maxmin output both minima and maxima | ||
| 93 | =max maxima only | ||
| 94 | =min minima only | ||
| 95 | =abs absolute maxima only | ||
| 96 | =rms RMS | ||
| 97 | =thd search first max above threshold | ||
| 98 | |||
| 99 | threshamp=0 threshold amplitude value | ||
| 100 | threshtime=0 tmin to start search for threshold | ||
| 101 | |||
| 102 | verbose=0 writes global quantities to outpar | ||
| 103 | =1 trace number, values, sample location | ||
| 104 | =2 key1 & key2 instead of trace number | ||
| 105 | key1=fldr key for verbose=2 | ||
| 106 | key2=ep key for verbose=2 | ||
| 107 | |||
| 108 | outpar=/dev/tty output parameter file; contains output | ||
| 109 | from verbose | ||
| 110 | |||
| 111 | Examples: | ||
| 112 | For global max and min values: sumax < segy_data | ||
| 113 | For local and global max and min values: sumax < segy_data verbose=1 | ||
| 114 | To plot values specified by mode: | ||
| 115 | sumax < segy_data output=binary mode=modeval | xgraph n=npairs | ||
| 116 | To plot seismic data with the only values nonzero being those specified | ||
| 117 | by mode=modeval: | ||
| 118 | sumax < segy_data output=segy mode=modeval | suxwigb | ||
| 119 | |||
| 120 | Note: while traces are counted from 1, sample values are counted from 0. | ||
| 121 | Also, if multiple min, max, or abs max values exist on a trace, | ||
| 122 | only the first one is captured. | ||
| 123 | |||
| 124 | See also: suxmax, supsmax | ||
| 125 | |||
| 126 | Credits: | ||
| 127 | CWP : John Stockwell (total rewrite) | ||
| 128 | Geocon : Garry Perratt (all ASCII output changed from 0.000000e+00 to 0.000000e+00) | ||
| 129 | (added mode=rms). | ||
| 130 | ESCI: Reginald Beardsley (added header key option) | ||
| 131 | based on an original program by: | ||
| 132 | SEP: Shuki Ronen | ||
| 133 | CWP: Jack K. Cohen | ||
| 134 | IFM-GEOMAR: Gerald Klein (added threshold option) | ||
| 135 | |||
| 136 | Trace header fields accessed: ns dt & user specified keys | ||
| 137 | |||
| 138 | =head2 Additional User's notes: | ||
| 139 | |||
| 140 | Shares many of the properties of xgraph e.g., style. | ||
| 141 | Use may try to add other options from xgraph. At present I include | ||
| 142 | "style": | ||
| 143 | style=seismic $ normal (axis 1 horizontal, axis 2 vertical) or | ||
| 144 | seismic (axis 1 vertical, axis 2 horizontal) | ||
| 145 | |||
| 146 | =head2 CHANGES and their DATES | ||
| 147 | |||
| 148 | =cut | ||
| 149 | use Moose; | ||
| 150 | our $VERSION = '0.0.1'; | ||
| 151 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 152 | |||
| 153 | my $get = L_SU_global_constants->new(); | ||
| 154 | my $var = $get->var(); | ||
| 155 | my $empty_string = $var->{_empty_string}; | ||
| 156 | |||
| 157 | |||
| 158 | my $suxmax = { | ||
| 159 | _d1 => '', | ||
| 160 | _d2 => '', | ||
| 161 | _f1 => '', | ||
| 162 | _f2 => '', | ||
| 163 | _height => '', | ||
| 164 | _mode => '', | ||
| 165 | _n2 => '', | ||
| 166 | _style => '', | ||
| 167 | _tmpdir => '', | ||
| 168 | _verbose => '', | ||
| 169 | -width => '', | ||
| 170 | _Step => '', | ||
| 171 | _note => '', | ||
| 172 | }; | ||
| 173 | |||
| 174 | |||
| 175 | =head2 sub Step | ||
| 176 | |||
| 177 | collects switches and assembles bash instructions | ||
| 178 | by adding the program name | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | sub Step { | ||
| 183 | |||
| 184 | $suxmax->{_Step} = 'suxmax'.$suxmax->{_Step}; | ||
| 185 | return ( $suxmax->{_Step} ); | ||
| 186 | |||
| 187 | } | ||
| 188 | |||
| 189 | |||
| 190 | =head2 sub note | ||
| 191 | |||
| 192 | collects switches and assembles bash instructions | ||
| 193 | by adding the program name | ||
| 194 | |||
| 195 | =cut | ||
| 196 | |||
| 197 | sub note { | ||
| 198 | |||
| 199 | $suxmax->{_note} = 'suxmax'.$suxmax->{_note}; | ||
| 200 | return ( $suxmax->{_note} ); | ||
| 201 | |||
| 202 | } | ||
| 203 | |||
| 204 | |||
| 205 | =head2 sub clear | ||
| 206 | |||
| 207 | =cut | ||
| 208 | |||
| 209 | sub clear { | ||
| 210 | |||
| 211 | $suxmax->{_d1} = ''; | ||
| 212 | $suxmax->{_d2} = ''; | ||
| 213 | $suxmax->{_f1} = ''; | ||
| 214 | $suxmax->{_f2} = ''; | ||
| 215 | $suxmax->{_height} = ''; | ||
| 216 | $suxmax->{_mode} = ''; | ||
| 217 | $suxmax->{_n2} = ''; | ||
| 218 | $suxmax->{_style} = ''; | ||
| 219 | $suxmax->{_tmpdir} = ''; | ||
| 220 | $suxmax->{_verbose} = ''; | ||
| 221 | $suxmax->{_width} = ''; | ||
| 222 | $suxmax->{_Step} = ''; | ||
| 223 | $suxmax->{_note} = ''; | ||
| 224 | } | ||
| 225 | |||
| 226 | |||
| 227 | =head2 sub d1 | ||
| 228 | |||
| 229 | |||
| 230 | =cut | ||
| 231 | |||
| 232 | sub d1 { | ||
| 233 | |||
| 234 | my ( $self,$d1 ) = @_; | ||
| 235 | if ( $d1 ne $empty_string ) { | ||
| 236 | |||
| 237 | $suxmax->{_d1} = $d1; | ||
| 238 | $suxmax->{_note} = $suxmax->{_note}.' d1='.$suxmax->{_d1}; | ||
| 239 | $suxmax->{_Step} = $suxmax->{_Step}.' d1='.$suxmax->{_d1}; | ||
| 240 | |||
| 241 | } else { | ||
| 242 | print("suxmax, d1, missing d1,\n"); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | |||
| 246 | |||
| 247 | =head2 sub d2 | ||
| 248 | |||
| 249 | |||
| 250 | =cut | ||
| 251 | |||
| 252 | sub d2 { | ||
| 253 | |||
| 254 | my ( $self,$d2 ) = @_; | ||
| 255 | if ( $d2 ne $empty_string ) { | ||
| 256 | |||
| 257 | $suxmax->{_d2} = $d2; | ||
| 258 | $suxmax->{_note} = $suxmax->{_note}.' d2='.$suxmax->{_d2}; | ||
| 259 | $suxmax->{_Step} = $suxmax->{_Step}.' d2='.$suxmax->{_d2}; | ||
| 260 | |||
| 261 | } else { | ||
| 262 | print("suxmax, d2, missing d2,\n"); | ||
| 263 | } | ||
| 264 | } | ||
| 265 | |||
| 266 | |||
| 267 | =head2 sub f1 | ||
| 268 | |||
| 269 | |||
| 270 | =cut | ||
| 271 | |||
| 272 | sub f1 { | ||
| 273 | |||
| 274 | my ( $self,$f1 ) = @_; | ||
| 275 | if ( $f1 ne $empty_string ) { | ||
| 276 | |||
| 277 | $suxmax->{_f1} = $f1; | ||
| 278 | $suxmax->{_note} = $suxmax->{_note}.' f1='.$suxmax->{_f1}; | ||
| 279 | $suxmax->{_Step} = $suxmax->{_Step}.' f1='.$suxmax->{_f1}; | ||
| 280 | |||
| 281 | } else { | ||
| 282 | print("suxmax, f1, missing f1,\n"); | ||
| 283 | } | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | =head2 sub f2 | ||
| 288 | |||
| 289 | |||
| 290 | =cut | ||
| 291 | |||
| 292 | sub f2 { | ||
| 293 | |||
| 294 | my ( $self,$f2 ) = @_; | ||
| 295 | if ( $f2 ne $empty_string ) { | ||
| 296 | |||
| 297 | $suxmax->{_f2} = $f2; | ||
| 298 | $suxmax->{_note} = $suxmax->{_note}.' f2='.$suxmax->{_f2}; | ||
| 299 | $suxmax->{_Step} = $suxmax->{_Step}.' f2='.$suxmax->{_f2}; | ||
| 300 | |||
| 301 | } else { | ||
| 302 | print("suxmax, f2, missing f2,\n"); | ||
| 303 | } | ||
| 304 | } | ||
| 305 | |||
| 306 | =head2 sub height | ||
| 307 | |||
| 308 | |||
| 309 | =cut | ||
| 310 | |||
| 311 | sub height { | ||
| 312 | |||
| 313 | my ( $self,$height ) = @_; | ||
| 314 | if ( $height ne $empty_string ) { | ||
| 315 | |||
| 316 | $suxmax->{_height} = $height; | ||
| 317 | $suxmax->{_note} = $suxmax->{_note}.' height='.$suxmax->{_height}; | ||
| 318 | $suxmax->{_Step} = $suxmax->{_Step}.' height='.$suxmax->{_height}; | ||
| 319 | |||
| 320 | } else { | ||
| 321 | print("suxmax, height, missing height,\n"); | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 325 | |||
| 326 | =head2 sub mode | ||
| 327 | |||
| 328 | |||
| 329 | =cut | ||
| 330 | |||
| 331 | sub mode { | ||
| 332 | |||
| 333 | my ( $self,$mode ) = @_; | ||
| 334 | if ( $mode ne $empty_string ) { | ||
| 335 | |||
| 336 | $suxmax->{_mode} = $mode; | ||
| 337 | $suxmax->{_note} = $suxmax->{_note}.' mode='.$suxmax->{_mode}; | ||
| 338 | $suxmax->{_Step} = $suxmax->{_Step}.' mode='.$suxmax->{_mode}; | ||
| 339 | |||
| 340 | } else { | ||
| 341 | print("suxmax, mode, missing mode,\n"); | ||
| 342 | } | ||
| 343 | } | ||
| 344 | |||
| 345 | |||
| 346 | =head2 sub n2 | ||
| 347 | |||
| 348 | |||
| 349 | =cut | ||
| 350 | |||
| 351 | sub n2 { | ||
| 352 | |||
| 353 | my ( $self,$n2 ) = @_; | ||
| 354 | if ( $n2 ne $empty_string ) { | ||
| 355 | |||
| 356 | $suxmax->{_n2} = $n2; | ||
| 357 | $suxmax->{_note} = $suxmax->{_note}.' n2='.$suxmax->{_n2}; | ||
| 358 | $suxmax->{_Step} = $suxmax->{_Step}.' n2='.$suxmax->{_n2}; | ||
| 359 | |||
| 360 | } else { | ||
| 361 | print("suxmax, n2, missing n2,\n"); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | |||
| 366 | =head2 sub orientation | ||
| 367 | |||
| 368 | subs style orientation | ||
| 369 | |||
| 370 | whether the time axis is vertical (seismic stlye) | ||
| 371 | or the time axis is horizontal (normal style) | ||
| 372 | |||
| 373 | =cut | ||
| 374 | |||
| 375 | sub orientation { | ||
| 376 | |||
| 377 | my ( $self, $style ) = @_; | ||
| 378 | if ( $style ne $empty_string ) { | ||
| 379 | |||
| 380 | $suxmax->{_style} = $style; | ||
| 381 | $suxmax->{_note} = | ||
| 382 | $suxmax->{_note} . ' style=' . $suxmax->{_style}; | ||
| 383 | $suxmax->{_Step} = | ||
| 384 | $suxmax->{_Step} . ' style=' . $suxmax->{_style}; | ||
| 385 | |||
| 386 | } | ||
| 387 | else { | ||
| 388 | print("suxmax, orientation, missing orientation,\n"); | ||
| 389 | } | ||
| 390 | } | ||
| 391 | |||
| 392 | |||
| 393 | =head2 sub style | ||
| 394 | |||
| 395 | subs style orientation | ||
| 396 | |||
| 397 | whether the time axis is vertical (seismic stlye) | ||
| 398 | or the time axis is horizontal (normal style) | ||
| 399 | |||
| 400 | =cut | ||
| 401 | |||
| 402 | sub style { | ||
| 403 | |||
| 404 | my ( $self, $style ) = @_; | ||
| 405 | if ( $style ne $empty_string ) { | ||
| 406 | |||
| 407 | $suxmax->{_style} = $style; | ||
| 408 | $suxmax->{_note} = | ||
| 409 | $suxmax->{_note} . ' style=' . $suxmax->{_style}; | ||
| 410 | $suxmax->{_Step} = | ||
| 411 | $suxmax->{_Step} . ' style=' . $suxmax->{_style}; | ||
| 412 | |||
| 413 | } | ||
| 414 | else { | ||
| 415 | print("suxmax, style, missing style,\n"); | ||
| 416 | } | ||
| 417 | } | ||
| 418 | |||
| 419 | =head2 sub tmpdir | ||
| 420 | |||
| 421 | |||
| 422 | =cut | ||
| 423 | |||
| 424 | sub tmpdir { | ||
| 425 | |||
| 426 | my ( $self,$tmpdir ) = @_; | ||
| 427 | if ( $tmpdir ne $empty_string ) { | ||
| 428 | |||
| 429 | $suxmax->{_tmpdir} = $tmpdir; | ||
| 430 | $suxmax->{_note} = $suxmax->{_note}.' tmpdir='.$suxmax->{_tmpdir}; | ||
| 431 | $suxmax->{_Step} = $suxmax->{_Step}.' tmpdir='.$suxmax->{_tmpdir}; | ||
| 432 | |||
| 433 | } else { | ||
| 434 | print("suxmax, tmpdir, missing tmpdir,\n"); | ||
| 435 | } | ||
| 436 | } | ||
| 437 | |||
| 438 | |||
| 439 | =head2 sub verbose | ||
| 440 | |||
| 441 | |||
| 442 | =cut | ||
| 443 | |||
| 444 | sub verbose { | ||
| 445 | |||
| 446 | my ( $self,$verbose ) = @_; | ||
| 447 | if ( $verbose ne $empty_string ) { | ||
| 448 | |||
| 449 | $suxmax->{_verbose} = $verbose; | ||
| 450 | $suxmax->{_note} = $suxmax->{_note}.' verbose='.$suxmax->{_verbose}; | ||
| 451 | $suxmax->{_Step} = $suxmax->{_Step}.' verbose='.$suxmax->{_verbose}; | ||
| 452 | |||
| 453 | } else { | ||
| 454 | print("suxmax, verbose, missing verbose,\n"); | ||
| 455 | } | ||
| 456 | } | ||
| 457 | |||
| 458 | =head2 sub width | ||
| 459 | |||
| 460 | |||
| 461 | =cut | ||
| 462 | |||
| 463 | sub width { | ||
| 464 | |||
| 465 | my ( $self,$width ) = @_; | ||
| 466 | if ( $width ne $empty_string ) { | ||
| 467 | |||
| 468 | $suxmax->{_width} = $width; | ||
| 469 | $suxmax->{_note} = $suxmax->{_note}.' width='.$suxmax->{_width}; | ||
| 470 | $suxmax->{_Step} = $suxmax->{_Step}.' width='.$suxmax->{_width}; | ||
| 471 | |||
| 472 | } else { | ||
| 473 | print("suxmax, width, missing width,\n"); | ||
| 474 | } | ||
| 475 | } | ||
| 476 | |||
| 477 | |||
| 478 | =head2 sub get_max_index | ||
| 479 | |||
| 480 | max index = number of input variables -1 | ||
| 481 | |||
| 482 | =cut | ||
| 483 | |||
| 484 | sub get_max_index { | ||
| 485 | my ($self) = @_; | ||
| 486 | my $max_index = 10; | ||
| 487 | |||
| 488 | return($max_index); | ||
| 489 | } | ||
| 490 | |||
| 491 | |||
| 492 | 1; |