« lib/App/SeismicUnixGui/misc/decisions.pm
↑ Summary
lib/App/SeismicUnixGui/big_streams/iSave_picks.pm »
| 1 | package App::SeismicUnixGui::sunix::shapeNcut::suwind; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: SUWIND - window traces by key word | ||
| 8 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 9 | DATE: Nov 1 2012 | ||
| 10 | DESCRIPTION: suwind a lists of header words | ||
| 11 | or an single value | ||
| 12 | |||
| 13 | Version: 0.0.3 | ||
| 14 | |||
| 15 | =head3 SEISMIC UNIX NOTES | ||
| 16 | |||
| 17 | SUWIND - window traces by key word | ||
| 18 | |||
| 19 | suwind <stdin >stdout [options] | ||
| 20 | |||
| 21 | Required Parameters: | ||
| 22 | none | ||
| 23 | |||
| 24 | Optional Parameters: | ||
| 25 | verbose=0 =1 for verbose | ||
| 26 | key=tracl Key header word to window on (see segy.h) | ||
| 27 | min=LONG_MIN min value of key header word to pass | ||
| 28 | max=LONG_MAX max value of key header word to pass | ||
| 29 | |||
| 30 | abs=0 =1 to take absolute value of key header word | ||
| 31 | j=1 Pass every j-th trace ... | ||
| 32 | s=0 ... based at s (if ((key - s)%j) == 0) | ||
| 33 | skip=0 skip the initial N traces | ||
| 34 | count=ULONG_MAX ... up to count traces | ||
| 35 | reject=none Skip traces with specified key values | ||
| 36 | accept=none Pass traces with specified key values(see notes) | ||
| 37 | processing, but do no window the data | ||
| 38 | ordered=0 =1 if traces sorted in increasing keyword value | ||
| 39 | =-1 if traces are sorted in a decreasing order | ||
| 40 | |||
| 41 | Options for vertical windowing (time gating): | ||
| 42 | dt=tr.dt (from header) time sampling interval (sec) (seismic data) | ||
| 43 | =tr.d1 (nonseismic) | ||
| 44 | f1=tr.delrt (from header) first sample (seismic data) | ||
| 45 | =tr.f1 (nonseismic) | ||
| 46 | |||
| 47 | tmin=0.0 min time to pass | ||
| 48 | tmax=(from header) max time to pass | ||
| 49 | itmin=0 min time sample to pass | ||
| 50 | itmax=(from header) max time sample to pass | ||
| 51 | nt=itmax-itmin+1 number of time samples to pass | ||
| 52 | |||
| 53 | Notes: | ||
| 54 | On large data sets, the count parameter should be set if | ||
| 55 | possible. Otherwise, every trace in the data set will be | ||
| 56 | examined. However, the count parameter overrides the accept | ||
| 57 | parameter, so you can't specify count if you want true | ||
| 58 | unconditional acceptance. | ||
| 59 | |||
| 60 | The skip= option allows the user to skip over traces, which helps | ||
| 61 | for selecting traces far from the beginning of the dataset. | ||
| 62 | Caveat: skip only works with disk input. | ||
| 63 | |||
| 64 | The ordered= option will speed up the process if the data are | ||
| 65 | sorted in according to the key. | ||
| 66 | |||
| 67 | The accept option is a bit strange--it does NOT mean accept ONLY | ||
| 68 | the traces on the accept list! It means accept these traces, | ||
| 69 | even if they would otherwise be rejected (except as noted in the | ||
| 70 | previous paragraph). To implement accept-only, you can use the | ||
| 71 | max=0 option (rejecting everything). For example, to accept | ||
| 72 | only the tracl values 4, 5 and 6: | ||
| 73 | ... | suwind max=0 accept=4,5,6 | ... | ||
| 74 | |||
| 75 | Another example is the case of suppressing nonseismic traces in | ||
| 76 | a seismic data set. By the SEGY standard header field trace id, | ||
| 77 | trid=1 designates traces as being seismic traces. Other traces, | ||
| 78 | such as calibration traces may be designated by another value. | ||
| 79 | |||
| 80 | Example: trid=1 seismic and trid=0 is nonseismic. To reject | ||
| 81 | nonseismic traces | ||
| 82 | ... | suwind key=trid reject=0 | ... | ||
| 83 | |||
| 84 | On most 32 bit machines, LONG_MIN, LONG_MAX and ULONG_MAX are | ||
| 85 | about -2E9,+2E9 and 4E9, they are defined in limits.h. | ||
| 86 | |||
| 87 | Selecting times beyond the maximum in the data induces | ||
| 88 | zero padding (up to SU_NFLTS). | ||
| 89 | |||
| 90 | The time gating here is to the nearest neighboring sample or | ||
| 91 | time value. Gating to the exact temporal value requires | ||
| 92 | resampling if the selected times fall between samples on the | ||
| 93 | trace. Use suresamp to perform the time gating in this case. | ||
| 94 | |||
| 95 | It doesn't really make sense to specify both itmin and tmin, | ||
| 96 | but specifying itmin takes precedence over specifying tmin. | ||
| 97 | Similarly, itmax takes precedence over tmax and tmax over nt. | ||
| 98 | If dt in header is not set, then dt is mandatory | ||
| 99 | |||
| 100 | |||
| 101 | Credits: | ||
| 102 | SEP: Einar Kjartansson | ||
| 103 | CWP: Shuki Ronen, Jack Cohen, Chris Liner | ||
| 104 | Warnemuende: Toralf Foerster | ||
| 105 | CENPET: Werner M. Heigl (modified to include well log data) | ||
| 106 | |||
| 107 | Trace header fields accessed: ns, dt, delrt, keyword | ||
| 108 | Trace header fields modified: ns, delrt, ntr | ||
| 109 | |||
| 110 | =head2 USE | ||
| 111 | |||
| 112 | =head3 NOTES | ||
| 113 | |||
| 114 | Example: | ||
| 115 | If skip is used, s is ignored e.g. s=2 skip=1 key=tracl j=2 | ||
| 116 | |||
| 117 | Example: | ||
| 118 | |||
| 119 | accept=4,9,11 max=0 (max=0 is needed) | ||
| 120 | |||
| 121 | Example: where in data, tracl=1,2,3, etc. | ||
| 122 | |||
| 123 | j=3 key=tracl,s=0, tracl's are 3, 6, 9 etc., | ||
| 124 | j=2 key=tracl s=0, tracl's are 2, 4, 6 etc. | ||
| 125 | j=2 key=tracl s=1, tracl's are 1, 3, 5,7 | ||
| 126 | j=2 key=tracl s=2, tracl's are 2, 4, 6,8 etc., | ||
| 127 | |||
| 128 | New list option: | ||
| 129 | |||
| 130 | Include a file name conatining a single-column list of numbers which | ||
| 131 | represent trace header values. Make sure to set the header as well. | ||
| 132 | |||
| 133 | |||
| 134 | =head2 CHANGES and their DATES | ||
| 135 | |||
| 136 | V 0.0.3 May 2023 | ||
| 137 | Include a file name conatining a single-column list of numbers which | ||
| 138 | represent trace header values. Make sure to set the header as well. | ||
| 139 | |||
| 140 | =cut | ||
| 141 | |||
| 142 | use Moose; | ||
| 143 | our $VERSION = '0.0.3'; | ||
| 144 | |||
| 145 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 146 | use aliased 'App::SeismicUnixGui::misc::manage_files_by2'; | ||
| 147 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 148 | |||
| 149 | my $get = App::SeismicUnixGui::misc::L_SU_global_constants->new(); | ||
| 150 | my $var = $get->var(); | ||
| 151 | my $manage_files_by2 = manage_files_by2->new(); | ||
| 152 | my $control = control->new(); | ||
| 153 | my $empty_string = $var->{_empty_string}; | ||
| 154 | |||
| 155 | my $suwind = { | ||
| 156 | _abs => '', | ||
| 157 | _accept => '', | ||
| 158 | _accept_only_list_name => '', | ||
| 159 | _count => '', | ||
| 160 | _dt => '', | ||
| 161 | _f1 => '', | ||
| 162 | _itmax => '', | ||
| 163 | _itmin => '', | ||
| 164 | _j => '', | ||
| 165 | _key => '', | ||
| 166 | _max => '', | ||
| 167 | _min => '', | ||
| 168 | _nt => '', | ||
| 169 | _ordered => '', | ||
| 170 | _reject => '', | ||
| 171 | _s => '', | ||
| 172 | _skip => '', | ||
| 173 | _tmax => '', | ||
| 174 | _tmin => '', | ||
| 175 | _verbose => '', | ||
| 176 | _Step => '', | ||
| 177 | _note => '', | ||
| 178 | }; | ||
| 179 | |||
| 180 | =head2 sub Step | ||
| 181 | |||
| 182 | collects switches and assembles bash instructions | ||
| 183 | by adding the program name | ||
| 184 | |||
| 185 | =cut | ||
| 186 | |||
| 187 | sub Step { | ||
| 188 | my ( $self, $Step ) = @_; | ||
| 189 | |||
| 190 | # print ("1. suwind, Step, $suwind->{_Step}\n"); | ||
| 191 | $suwind->{_Step} = 'suwind ' . $suwind->{_Step}; | ||
| 192 | |||
| 193 | # print ("2. suwind, Step, $suwind->{_Step}\n"); | ||
| 194 | return ( $suwind->{_Step} ); | ||
| 195 | |||
| 196 | } | ||
| 197 | |||
| 198 | =head2 sub note | ||
| 199 | |||
| 200 | collects switches and assembles bash instructions | ||
| 201 | by adding the program name | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | sub note { | ||
| 206 | |||
| 207 | my ( $self, $note ) = @_; | ||
| 208 | $suwind->{_note} = 'suwind' . $suwind->{_note}; | ||
| 209 | return ( $suwind->{_note} ); | ||
| 210 | |||
| 211 | } | ||
| 212 | |||
| 213 | =head2 sub clear | ||
| 214 | |||
| 215 | =cut | ||
| 216 | |||
| 217 | sub clear { | ||
| 218 | |||
| 219 | $suwind->{_abs} = ''; | ||
| 220 | $suwind->{_accept} = ''; | ||
| 221 | $suwind->{_accept_only_list_name} = '', | ||
| 222 | $suwind->{_count} = ''; | ||
| 223 | $suwind->{_dt} = ''; | ||
| 224 | $suwind->{_f1} = ''; | ||
| 225 | $suwind->{_itmax} = ''; | ||
| 226 | $suwind->{_itmin} = ''; | ||
| 227 | $suwind->{_j} = ''; | ||
| 228 | $suwind->{_key} = ''; | ||
| 229 | $suwind->{_max} = ''; | ||
| 230 | $suwind->{_min} = ''; | ||
| 231 | $suwind->{_nt} = ''; | ||
| 232 | $suwind->{_ordered} = ''; | ||
| 233 | $suwind->{_reject} = ''; | ||
| 234 | $suwind->{_s} = ''; | ||
| 235 | $suwind->{_skip} = ''; | ||
| 236 | $suwind->{_tmax} = ''; | ||
| 237 | $suwind->{_tmin} = ''; | ||
| 238 | $suwind->{_trid} = ''; | ||
| 239 | $suwind->{_verbose} = ''; | ||
| 240 | $suwind->{_Step} = ''; | ||
| 241 | $suwind->{_note} = ''; | ||
| 242 | } | ||
| 243 | |||
| 244 | =head2 sub abs | ||
| 245 | |||
| 246 | |||
| 247 | =cut | ||
| 248 | |||
| 249 | sub abs { | ||
| 250 | |||
| 251 | my ( $self, $abs ) = @_; | ||
| 252 | if ( $abs ne $empty_string ) { | ||
| 253 | |||
| 254 | $suwind->{_abs} = $abs; | ||
| 255 | $suwind->{_note} = $suwind->{_note} . ' abs=' . $suwind->{_abs}; | ||
| 256 | $suwind->{_Step} = $suwind->{_Step} . ' abs=' . $suwind->{_abs}; | ||
| 257 | |||
| 258 | } | ||
| 259 | else { | ||
| 260 | print("suwind, abs, missing abs,\n"); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | |||
| 264 | =head2 sub accept | ||
| 265 | |||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | sub accept { | ||
| 270 | |||
| 271 | my ( $self, $accept ) = @_; | ||
| 272 | if ( $accept ne $empty_string ) { | ||
| 273 | |||
| 274 | $suwind->{_accept} = $accept; | ||
| 275 | $suwind->{_note} = $suwind->{_note} . ' accept=' . $suwind->{_accept}; | ||
| 276 | $suwind->{_Step} = $suwind->{_Step} . ' accept=' . $suwind->{_accept}; | ||
| 277 | |||
| 278 | } | ||
| 279 | else { | ||
| 280 | print("suwind, accept, missing accept,\n"); | ||
| 281 | } | ||
| 282 | } | ||
| 283 | |||
| 284 | #=pod sub accept_only_list | ||
| 285 | # | ||
| 286 | # sub accept_only_list: when selecting multiple traces | ||
| 287 | # all at once. | ||
| 288 | # Should be used with list,setheaderword. | ||
| 289 | # | ||
| 290 | #=cut | ||
| 291 | # | ||
| 292 | #sub accept_only_list { | ||
| 293 | # | ||
| 294 | # my ( $self, $ref_list ) = @_; | ||
| 295 | # my @list = @$ref_list if defined($ref_list); | ||
| 296 | # | ||
| 297 | # if ( $ref_list ne $empty_string ) { | ||
| 298 | # | ||
| 299 | # # print("1. suwind, accept_only_list,suwind->{_Step},$suwind->{_Step}\n"); | ||
| 300 | # # perl starts lists at 0 | ||
| 301 | # my $length_list = scalar(@list); | ||
| 302 | # my $end = $length_list; | ||
| 303 | # my $start = 0; | ||
| 304 | # | ||
| 305 | # # print("suwind, accept_only_list, @list\n"); | ||
| 306 | # # print("suwind, accept_only_list,list[0], $list[0]\n"); | ||
| 307 | # # print("suwind, accept_only_list,length_list, $length_list\n"); | ||
| 308 | # | ||
| 309 | # # init | ||
| 310 | # $suwind->{_Step} = | ||
| 311 | # $suwind->{_Step} . ' max=0 accept=' . $list[$start]; | ||
| 312 | # | ||
| 313 | # # rest | ||
| 314 | # for ( my $i = $start + 1 ; $i < $end ; $i++ ) { | ||
| 315 | # | ||
| 316 | # $suwind->{_Step} = $suwind->{_Step} . ',' . $list[$i]; | ||
| 317 | # ### print("suwind, accept_only_list,i=$i \n"); | ||
| 318 | # | ||
| 319 | # } | ||
| 320 | # | ||
| 321 | # } | ||
| 322 | # else { | ||
| 323 | # print("suwind, accept_only_list, missing ref_list,\n"); | ||
| 324 | # } | ||
| 325 | # | ||
| 326 | # # print("2. suwind, accept_only_list,suwind->{_Step},$suwind->{_Step} \n"); | ||
| 327 | # | ||
| 328 | #} | ||
| 329 | |||
| 330 | =pod sub accept_only_list_name | ||
| 331 | |||
| 332 | sub accept_only_list: when selecting multiple traces | ||
| 333 | all at once. | ||
| 334 | Should be used with list, setheaderword. | ||
| 335 | |||
| 336 | =cut | ||
| 337 | |||
| 338 | sub accept_only_list_name { | ||
| 339 | |||
| 340 | my ( $self, $list_name ) = @_; | ||
| 341 | |||
| 342 | if ( length $list_name) { | ||
| 343 | |||
| 344 | $control->set_back_slashBgone($list_name); | ||
| 345 | $list_name = $control->get_back_slashBgone(); | ||
| 346 | |||
| 347 | my ($list_ref, $num_rows) = $manage_files_by2->read_1col($list_name); | ||
| 348 | my @list = @$list_ref; | ||
| 349 | |||
| 350 | my $start = 0; | ||
| 351 | |||
| 352 | # print("suwind, accept_only_list_name, list[0], $list[0]\n"); | ||
| 353 | # print("suwind, accept_only_list_name, num_rows, $num_rows\n"); | ||
| 354 | |||
| 355 | # first value of list | ||
| 356 | $suwind->{_Step} = | ||
| 357 | $suwind->{_Step} . ' max=0 accept=' . $list[$start]; | ||
| 358 | |||
| 359 | # for the rest | ||
| 360 | for ( my $i = $start + 1 ; $i < $num_rows ; $i++ ) { | ||
| 361 | |||
| 362 | $suwind->{_Step} = $suwind->{_Step} . ',' . $list[$i]; | ||
| 363 | print("suwind, accept_only_list_name,i=$i \n"); | ||
| 364 | |||
| 365 | } | ||
| 366 | |||
| 367 | } | ||
| 368 | else { | ||
| 369 | print("suwind, accept_only_list_name, missing ref_list,\n"); | ||
| 370 | } | ||
| 371 | |||
| 372 | # print("2. suwind, accept_only_list,suwind->{_Step},$suwind->{_Step} \n"); | ||
| 373 | |||
| 374 | } | ||
| 375 | |||
| 376 | =head2 sub accept_only_tracl | ||
| 377 | |||
| 378 | when selecting multiple traces | ||
| 379 | all at once | ||
| 380 | use a list | ||
| 381 | |||
| 382 | =cut | ||
| 383 | |||
| 384 | sub accept_only_tracl { | ||
| 385 | my ( $self, $ref_list ) = @_; | ||
| 386 | my @list = @$ref_list if defined($ref_list); | ||
| 387 | |||
| 388 | if ( $ref_list ne $empty_string ) { | ||
| 389 | |||
| 390 | # perl starts lists at 0 | ||
| 391 | my $length_list = scalar(@list); | ||
| 392 | my $end = $length_list; | ||
| 393 | my $start = 0; | ||
| 394 | |||
| 395 | # init | ||
| 396 | $suwind->{_Step} = | ||
| 397 | $suwind->{_Step} . ' max=0 accept=' . $list[$start]; | ||
| 398 | |||
| 399 | # rest | ||
| 400 | for ( my $i = $start + 1 ; $i < $end ; $i++ ) { | ||
| 401 | $suwind->{_Step} = $suwind->{_Step} . ',' . $list[$i]; | ||
| 402 | } | ||
| 403 | |||
| 404 | } | ||
| 405 | else { | ||
| 406 | print("suwind, accept_only_tracl, missing ref_list,\n"); | ||
| 407 | } | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 411 | =head2 sub count | ||
| 412 | |||
| 413 | |||
| 414 | =cut | ||
| 415 | |||
| 416 | sub count { | ||
| 417 | |||
| 418 | my ( $self, $count ) = @_; | ||
| 419 | if ( $count ne $empty_string ) { | ||
| 420 | |||
| 421 | $suwind->{_count} = $count; | ||
| 422 | $suwind->{_note} = $suwind->{_note} . ' count=' . $suwind->{_count}; | ||
| 423 | $suwind->{_Step} = $suwind->{_Step} . ' count=' . $suwind->{_count}; | ||
| 424 | |||
| 425 | } | ||
| 426 | else { | ||
| 427 | print("suwind, count, missing count,\n"); | ||
| 428 | } | ||
| 429 | } | ||
| 430 | |||
| 431 | =head2 sub dt | ||
| 432 | |||
| 433 | |||
| 434 | =cut | ||
| 435 | |||
| 436 | sub dt { | ||
| 437 | |||
| 438 | my ( $self, $dt ) = @_; | ||
| 439 | if ( $dt ne $empty_string ) { | ||
| 440 | |||
| 441 | $suwind->{_dt} = $dt; | ||
| 442 | $suwind->{_note} = $suwind->{_note} . ' dt=' . $suwind->{_dt}; | ||
| 443 | $suwind->{_Step} = $suwind->{_Step} . ' dt=' . $suwind->{_dt}; | ||
| 444 | |||
| 445 | } | ||
| 446 | else { | ||
| 447 | print("suwind, dt, missing dt,\n"); | ||
| 448 | } | ||
| 449 | } | ||
| 450 | |||
| 451 | =head2 sub f1 | ||
| 452 | |||
| 453 | |||
| 454 | =cut | ||
| 455 | |||
| 456 | sub f1 { | ||
| 457 | |||
| 458 | my ( $self, $f1 ) = @_; | ||
| 459 | if ( $f1 ne $empty_string ) { | ||
| 460 | |||
| 461 | $suwind->{_f1} = $f1; | ||
| 462 | $suwind->{_note} = $suwind->{_note} . ' f1=' . $suwind->{_f1}; | ||
| 463 | $suwind->{_Step} = $suwind->{_Step} . ' f1=' . $suwind->{_f1}; | ||
| 464 | |||
| 465 | } | ||
| 466 | else { | ||
| 467 | print("suwind, f1, missing f1,\n"); | ||
| 468 | } | ||
| 469 | } | ||
| 470 | |||
| 471 | sub file { | ||
| 472 | my ( $self, $f1 ) = @_; | ||
| 473 | |||
| 474 | if ( $f1 ne $empty_string ) { | ||
| 475 | |||
| 476 | $suwind->{_f1} = $f1; | ||
| 477 | $suwind->{_note} = $suwind->{_note} . ' f1=' . $suwind->{_f1}; | ||
| 478 | $suwind->{_Step} = $suwind->{_Step} . ' f1=' . $suwind->{_f1}; | ||
| 479 | |||
| 480 | # deprecated -legacy | ||
| 481 | # $suwind->{_file} = ' <'.$$f1 if defined($f1); | ||
| 482 | |||
| 483 | } | ||
| 484 | else { | ||
| 485 | print("suwind, f1, missing f1,\n"); | ||
| 486 | } | ||
| 487 | |||
| 488 | } | ||
| 489 | |||
| 490 | my $newline; | ||
| 491 | |||
| 492 | sub initiate { | ||
| 493 | my ($self) = @_; | ||
| 494 | $newline = ' | ||
| 495 | '; | ||
| 496 | } | ||
| 497 | |||
| 498 | =head2 sub itmax | ||
| 499 | |||
| 500 | |||
| 501 | =cut | ||
| 502 | |||
| 503 | sub itmax { | ||
| 504 | |||
| 505 | my ( $self, $itmax ) = @_; | ||
| 506 | if ( $itmax ne $empty_string ) { | ||
| 507 | |||
| 508 | $suwind->{_itmax} = $itmax; | ||
| 509 | $suwind->{_note} = $suwind->{_note} . ' itmax=' . $suwind->{_itmax}; | ||
| 510 | $suwind->{_Step} = $suwind->{_Step} . ' itmax=' . $suwind->{_itmax}; | ||
| 511 | |||
| 512 | } | ||
| 513 | else { | ||
| 514 | print("suwind, itmax, missing itmax,\n"); | ||
| 515 | } | ||
| 516 | } | ||
| 517 | |||
| 518 | =head2 sub itmin | ||
| 519 | |||
| 520 | |||
| 521 | =cut | ||
| 522 | |||
| 523 | sub itmin { | ||
| 524 | |||
| 525 | my ( $self, $itmin ) = @_; | ||
| 526 | if ( $itmin >= 0 && $itmin ne $empty_string ) { | ||
| 527 | |||
| 528 | $suwind->{_itmin} = $itmin; | ||
| 529 | $suwind->{_note} = $suwind->{_note} . ' itmin=' . $suwind->{_itmin}; | ||
| 530 | $suwind->{_Step} = $suwind->{_Step} . ' itmin=' . $suwind->{_itmin}; | ||
| 531 | |||
| 532 | } | ||
| 533 | else { | ||
| 534 | print("suwind, itmin, missing itmin,\n"); | ||
| 535 | } | ||
| 536 | } | ||
| 537 | |||
| 538 | =head2 sub j | ||
| 539 | |||
| 540 | |||
| 541 | =cut | ||
| 542 | |||
| 543 | sub j { | ||
| 544 | |||
| 545 | my ( $self, $j ) = @_; | ||
| 546 | if ( $j ne $empty_string ) { | ||
| 547 | |||
| 548 | $suwind->{_j} = $j; | ||
| 549 | $suwind->{_note} = $suwind->{_note} . ' j=' . $suwind->{_j}; | ||
| 550 | $suwind->{_Step} = $suwind->{_Step} . ' j=' . $suwind->{_j}; | ||
| 551 | |||
| 552 | } | ||
| 553 | else { | ||
| 554 | print("suwind, j, missing j,\n"); | ||
| 555 | } | ||
| 556 | } | ||
| 557 | |||
| 558 | =head2 sub key | ||
| 559 | |||
| 560 | set which header word to use as the x-coordinate for plotting | ||
| 561 | |||
| 562 | |||
| 563 | =cut | ||
| 564 | |||
| 565 | sub key { | ||
| 566 | |||
| 567 | my ( $self, $key ) = @_; | ||
| 568 | |||
| 569 | if ( $key ne $empty_string ) { | ||
| 570 | |||
| 571 | if ( $key eq 'time' ) { | ||
| 572 | |||
| 573 | $suwind->{_key} = 'dt'; | ||
| 574 | |||
| 575 | } | ||
| 576 | else { | ||
| 577 | |||
| 578 | $suwind->{_key} = $key; | ||
| 579 | } | ||
| 580 | |||
| 581 | $suwind->{_note} = $suwind->{_note} . ' key=' . $suwind->{_key}; | ||
| 582 | $suwind->{_Step} = $suwind->{_Step} . ' key=' . $suwind->{_key}; | ||
| 583 | |||
| 584 | } | ||
| 585 | else { | ||
| 586 | print("suwind, key, missing key,\n"); | ||
| 587 | } | ||
| 588 | } | ||
| 589 | |||
| 590 | =head2 sub list | ||
| 591 | |||
| 592 | input a list of trace numbers as a referenced array | ||
| 593 | |||
| 594 | Example 1: | ||
| 595 | $value[0] = 2; | ||
| 596 | suwind->list(\@value); | ||
| 597 | suwind->setheaderword('tracf'); | ||
| 598 | $suwind[1] = suwind->Step(); | ||
| 599 | |||
| 600 | =cut | ||
| 601 | |||
| 602 | sub list { | ||
| 603 | |||
| 604 | my ( $self, $ref_list ) = @_; | ||
| 605 | |||
| 606 | if ( $ref_list ne $empty_string ) { | ||
| 607 | |||
| 608 | my @list = @$ref_list if defined($ref_list); | ||
| 609 | |||
| 610 | # perl starts lists at 0 | ||
| 611 | my $length_list = scalar(@list); | ||
| 612 | my $end = $length_list; | ||
| 613 | my $start = 0; | ||
| 614 | |||
| 615 | for ( my $i = $start ; $i < $end ; $i++ ) { | ||
| 616 | $suwind->{_Step} = | ||
| 617 | $suwind->{_Step} . ' min=' | ||
| 618 | . $list[$i] . ' max=' | ||
| 619 | . $list[$i] . ' \\' | ||
| 620 | . $newline; | ||
| 621 | } | ||
| 622 | |||
| 623 | } | ||
| 624 | else { | ||
| 625 | |||
| 626 | print("suwind, lsit, missing list\n"); | ||
| 627 | |||
| 628 | } | ||
| 629 | |||
| 630 | } | ||
| 631 | |||
| 632 | =head2 sub max | ||
| 633 | |||
| 634 | |||
| 635 | =cut | ||
| 636 | |||
| 637 | sub max { | ||
| 638 | |||
| 639 | my ( $self, $max ) = @_; | ||
| 640 | if ( $max ne $empty_string ) { | ||
| 641 | |||
| 642 | $suwind->{_max} = $max; | ||
| 643 | $suwind->{_note} = $suwind->{_note} . ' max=' . $suwind->{_max}; | ||
| 644 | $suwind->{_Step} = $suwind->{_Step} . ' max=' . $suwind->{_max}; | ||
| 645 | |||
| 646 | } | ||
| 647 | else { | ||
| 648 | print("suwind, max, missing max,\n"); | ||
| 649 | } | ||
| 650 | } | ||
| 651 | |||
| 652 | =head2 sub min | ||
| 653 | |||
| 654 | |||
| 655 | =cut | ||
| 656 | |||
| 657 | sub min { | ||
| 658 | |||
| 659 | my ( $self, $min ) = @_; | ||
| 660 | if ( $min ne $empty_string ) { | ||
| 661 | |||
| 662 | $suwind->{_min} = $min; | ||
| 663 | $suwind->{_note} = $suwind->{_note} . ' min=' . $suwind->{_min}; | ||
| 664 | $suwind->{_Step} = $suwind->{_Step} . ' min=' . $suwind->{_min}; | ||
| 665 | |||
| 666 | } | ||
| 667 | else { | ||
| 668 | print("suwind, min, missing min,\n"); | ||
| 669 | } | ||
| 670 | } | ||
| 671 | |||
| 672 | =head2 sub nt | ||
| 673 | |||
| 674 | |||
| 675 | =cut | ||
| 676 | |||
| 677 | sub nt { | ||
| 678 | |||
| 679 | my ( $self, $nt ) = @_; | ||
| 680 | if ( $nt ne $empty_string ) { | ||
| 681 | |||
| 682 | $suwind->{_nt} = $nt; | ||
| 683 | $suwind->{_note} = $suwind->{_note} . ' nt=' . $suwind->{_nt}; | ||
| 684 | $suwind->{_Step} = $suwind->{_Step} . ' nt=' . $suwind->{_nt}; | ||
| 685 | |||
| 686 | } | ||
| 687 | else { | ||
| 688 | print("suwind, nt, missing nt,\n"); | ||
| 689 | } | ||
| 690 | } | ||
| 691 | |||
| 692 | =head2 sub ordered | ||
| 693 | |||
| 694 | |||
| 695 | =cut | ||
| 696 | |||
| 697 | sub ordered { | ||
| 698 | |||
| 699 | my ( $self, $ordered ) = @_; | ||
| 700 | if ( $ordered ne $empty_string ) { | ||
| 701 | |||
| 702 | $suwind->{_ordered} = $ordered; | ||
| 703 | $suwind->{_note} = | ||
| 704 | $suwind->{_note} . ' ordered=' . $suwind->{_ordered}; | ||
| 705 | $suwind->{_Step} = | ||
| 706 | $suwind->{_Step} . ' ordered=' . $suwind->{_ordered}; | ||
| 707 | |||
| 708 | } | ||
| 709 | else { | ||
| 710 | print("suwind, ordered, missing ordered,\n"); | ||
| 711 | } | ||
| 712 | } | ||
| 713 | |||
| 714 | =head2 sub reject | ||
| 715 | |||
| 716 | |||
| 717 | =cut | ||
| 718 | |||
| 719 | sub reject { | ||
| 720 | |||
| 721 | my ( $self, $reject ) = @_; | ||
| 722 | if ( $reject ne $empty_string ) { | ||
| 723 | |||
| 724 | $suwind->{_reject} = $reject; | ||
| 725 | $suwind->{_note} = $suwind->{_note} . ' reject=' . $suwind->{_reject}; | ||
| 726 | $suwind->{_Step} = $suwind->{_Step} . ' reject=' . $suwind->{_reject}; | ||
| 727 | |||
| 728 | } | ||
| 729 | else { | ||
| 730 | print("suwind, reject, missing reject,\n"); | ||
| 731 | } | ||
| 732 | } | ||
| 733 | |||
| 734 | =head2 sub setheaderword | ||
| 735 | |||
| 736 | set which header word to use as the x-coordinate for plotting | ||
| 737 | |||
| 738 | |||
| 739 | =cut | ||
| 740 | |||
| 741 | sub setheaderword { | ||
| 742 | |||
| 743 | my ( $self, $key ) = @_; | ||
| 744 | if ( $key ne $empty_string ) { | ||
| 745 | |||
| 746 | if ( $key eq 'time' ) { | ||
| 747 | |||
| 748 | $suwind->{_key} = 'dt'; | ||
| 749 | |||
| 750 | } | ||
| 751 | else { | ||
| 752 | |||
| 753 | $suwind->{_key} = $key; | ||
| 754 | |||
| 755 | # | ||
| 756 | } | ||
| 757 | |||
| 758 | # print(" 1. suwind,setheaderword,suwind->{_Step}:$suwind->{_Step}\n\n"); | ||
| 759 | $suwind->{_note} = $suwind->{_note} . ' key=' . $suwind->{_key}; | ||
| 760 | $suwind->{_Step} = $suwind->{_Step} . ' key=' . $suwind->{_key}; | ||
| 761 | |||
| 762 | # print(" 2. suwind,setheaderword,suwind->{_Step}:$suwind->{_Step}\n\n"); | ||
| 763 | |||
| 764 | } | ||
| 765 | else { | ||
| 766 | print("suwind, setheaderword, missing setheaderword\n"); | ||
| 767 | } | ||
| 768 | } | ||
| 769 | |||
| 770 | =head2 sub s | ||
| 771 | |||
| 772 | |||
| 773 | =cut | ||
| 774 | |||
| 775 | sub s { | ||
| 776 | |||
| 777 | my ( $self, $s ) = @_; | ||
| 778 | if ( $s ne $empty_string ) { | ||
| 779 | |||
| 780 | $suwind->{_s} = $s; | ||
| 781 | $suwind->{_note} = $suwind->{_note} . ' s=' . $suwind->{_s}; | ||
| 782 | $suwind->{_Step} = $suwind->{_Step} . ' s=' . $suwind->{_s}; | ||
| 783 | |||
| 784 | } | ||
| 785 | else { | ||
| 786 | print("suwind, s, missing s,\n"); | ||
| 787 | } | ||
| 788 | } | ||
| 789 | |||
| 790 | =head2 sub skip | ||
| 791 | |||
| 792 | |||
| 793 | =cut | ||
| 794 | |||
| 795 | sub skip { | ||
| 796 | |||
| 797 | my ( $self, $skip ) = @_; | ||
| 798 | if ( $skip ne $empty_string ) { | ||
| 799 | |||
| 800 | $suwind->{_skip} = $skip; | ||
| 801 | $suwind->{_note} = $suwind->{_note} . ' skip=' . $suwind->{_skip}; | ||
| 802 | $suwind->{_Step} = $suwind->{_Step} . ' skip=' . $suwind->{_skip}; | ||
| 803 | |||
| 804 | } | ||
| 805 | else { | ||
| 806 | print("suwind, skip, missing skip,\n"); | ||
| 807 | } | ||
| 808 | } | ||
| 809 | |||
| 810 | =head2 sub tmax | ||
| 811 | |||
| 812 | |||
| 813 | =cut | ||
| 814 | |||
| 815 | sub tmax { | ||
| 816 | |||
| 817 | my ( $self, $tmax ) = @_; | ||
| 818 | if ( $tmax ne $empty_string ) { | ||
| 819 | |||
| 820 | $suwind->{_tmax} = $tmax; | ||
| 821 | $suwind->{_note} = $suwind->{_note} . ' tmax=' . $suwind->{_tmax}; | ||
| 822 | $suwind->{_Step} = $suwind->{_Step} . ' tmax=' . $suwind->{_tmax}; | ||
| 823 | |||
| 824 | } | ||
| 825 | else { | ||
| 826 | print("suwind, tmax, missing tmax,\n"); | ||
| 827 | } | ||
| 828 | } | ||
| 829 | |||
| 830 | =head2 sub tmin | ||
| 831 | |||
| 832 | $tmin >=0 && | ||
| 833 | |||
| 834 | =cut | ||
| 835 | |||
| 836 | sub tmin { | ||
| 837 | |||
| 838 | my ( $self, $tmin ) = @_; | ||
| 839 | if ( $tmin ne $empty_string ) { | ||
| 840 | |||
| 841 | $suwind->{_tmin} = $tmin; | ||
| 842 | $suwind->{_note} = $suwind->{_note} . ' tmin=' . $suwind->{_tmin}; | ||
| 843 | $suwind->{_Step} = $suwind->{_Step} . ' tmin=' . $suwind->{_tmin}; | ||
| 844 | |||
| 845 | } | ||
| 846 | else { | ||
| 847 | print("suwind, tmin, missing tmin,\n"); | ||
| 848 | } | ||
| 849 | } | ||
| 850 | |||
| 851 | =head2 sub verbose | ||
| 852 | |||
| 853 | |||
| 854 | =cut | ||
| 855 | |||
| 856 | sub verbose { | ||
| 857 | |||
| 858 | my ( $self, $verbose ) = @_; | ||
| 859 | if ( $verbose ne $empty_string ) { | ||
| 860 | |||
| 861 | $suwind->{_verbose} = $verbose; | ||
| 862 | $suwind->{_note} = | ||
| 863 | $suwind->{_note} . ' verbose=' . $suwind->{_verbose}; | ||
| 864 | $suwind->{_Step} = | ||
| 865 | $suwind->{_Step} . ' verbose=' . $suwind->{_verbose}; | ||
| 866 | |||
| 867 | } | ||
| 868 | else { | ||
| 869 | print("suwind, verbose, missing verbose,\n"); | ||
| 870 | } | ||
| 871 | } | ||
| 872 | |||
| 873 | =head2 sub get_max_index | ||
| 874 | |||
| 875 | max index = number of input variables -1 | ||
| 876 | |||
| 877 | =cut | ||
| 878 | |||
| 879 | sub get_max_index { | ||
| 880 | my ($self) = @_; | ||
| 881 | my $max_index = 17; | ||
| 882 | |||
| 883 | return ($max_index); | ||
| 884 | } | ||
| 885 | |||
| 886 | 1; |