« lib/App/SeismicUnixGui/sunix/data/wptcomp.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/header/suascii.pm »
| 1 | package App::SeismicUnixGui::sunix::header::suahw; | ||
| 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 | SUAHW - Assign Header Word using another header word | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | suahw <stdin >stdout [optional parameters] | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required parameters: | ||
| 33 | |||
| 34 | key1=ep output key | ||
| 35 | |||
| 36 | key2=fldr input key | ||
| 37 | |||
| 38 | a= array of key1 output values | ||
| 39 | |||
| 40 | b= array of key2 input values | ||
| 41 | |||
| 42 | mode=extrapolate how to assign a key1-value, when the key2-value | ||
| 43 | |||
| 44 | is not found in b: | ||
| 45 | |||
| 46 | =interpolate interpolate | ||
| 47 | |||
| 48 | =extrapolate interpolate and extrapolate | ||
| 49 | |||
| 50 | =zero zero key1-values | ||
| 51 | |||
| 52 | =preserve preserve key1-values | ||
| 53 | |||
| 54 | =transfer transfer key2-values to key1 | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | Optional parameters: | ||
| 59 | |||
| 60 | key3=tracf input key | ||
| 61 | |||
| 62 | c= array of key3 input values | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | The key1-value is assigned based on the key2-value and the arrays a,b. | ||
| 67 | |||
| 68 | If the header value of key2= equals the n'th element in b=, then the | ||
| 69 | |||
| 70 | header value key1= is set to the n'th element in a=. | ||
| 71 | |||
| 72 | The arrays a= and b= must have the same size, and the elements of b= | ||
| 73 | |||
| 74 | must be in ascending order. | ||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | The mode-switch decides what to do when a trace header has a key2-value | ||
| 79 | |||
| 80 | that is not an element of the b-array: | ||
| 81 | |||
| 82 | zero - the key1-value will be set to zero | ||
| 83 | |||
| 84 | preserve - the key1-value will not be modified | ||
| 85 | |||
| 86 | transfer - the key2-value will be assigned to key1 | ||
| 87 | |||
| 88 | interpolate - if the key2-value is greater than the n'th element | ||
| 89 | |||
| 90 | and less than the (n+1)'th element of b=, then the key1-value | ||
| 91 | |||
| 92 | will be interpolated accordingly from the n'th and (n+1)'th | ||
| 93 | |||
| 94 | element of a=. Otherwise, key1 will not be changed. | ||
| 95 | |||
| 96 | extrapolate - same as interpolate, plus, if the key2-value is | ||
| 97 | |||
| 98 | smaller/greater than the first/last element of b=, then the | ||
| 99 | |||
| 100 | key1-value will be set to the first/last element of a= | ||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | The array c= can be used to prevent the modification of trace headers | ||
| 105 | |||
| 106 | with certain key3-values. The number of elements in c= is independent | ||
| 107 | |||
| 108 | of the other arrays. | ||
| 109 | |||
| 110 | The key1-value will not be modified, if the mode-switch is set to | ||
| 111 | |||
| 112 | zero, preserve, transfer - and the key3-value is an element of c= | ||
| 113 | |||
| 114 | interpolate, extrapolate - and the key3-value is outside of c= | ||
| 115 | |||
| 116 | (smaller than the first or greater than | ||
| 117 | |||
| 118 | the last element of c=) | ||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | Examples: | ||
| 123 | |||
| 124 | Assign shot numbers 1-3 to field file ID 1009,1011,1015 and 0 to the | ||
| 125 | |||
| 126 | remaining FFID (fldr): | ||
| 127 | |||
| 128 | suahw <data a=1,2,3 b=1009,1011,1015 mode=zero | ||
| 129 | |||
| 130 | |||
| 131 | |||
| 132 | Use channel numbers (tracf) to assign stations numbers (tracr) for a | ||
| 133 | |||
| 134 | split spread with a gap: | ||
| 135 | |||
| 136 | suahw <data key1=tracr a=151,128,124,101 key2=tracf b=1,24,25,48 | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | Assign shot-statics: | ||
| 141 | |||
| 142 | suahw <data key1=sstat key2=ep a=-32,13,-4 b=1,2,3 | ||
| 143 | |||
| 144 | |||
| 145 | |||
| 146 | Set trid to 0 for channel 1-24, but only for the record 1016: | ||
| 147 | |||
| 148 | suahw <data key1=trid key2=tracf key3=fldr a=0,0 b=1,24 c=1016 | ||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | Credits: | ||
| 153 | |||
| 154 | Florian Bleibinhaus, U Salzburg, Austria | ||
| 155 | |||
| 156 | cloned from suchw of Einar Kajartansson, SEP | ||
| 157 | |||
| 158 | |||
| 159 | |||
| 160 | =head2 User's notes (Juan Lorenzo) | ||
| 161 | untested | ||
| 162 | |||
| 163 | =cut | ||
| 164 | |||
| 165 | |||
| 166 | =head2 CHANGES and their DATES | ||
| 167 | |||
| 168 | =cut | ||
| 169 | |||
| 170 | use Moose; | ||
| 171 | our $VERSION = '0.0.1'; | ||
| 172 | |||
| 173 | |||
| 174 | =head2 Import packages | ||
| 175 | |||
| 176 | =cut | ||
| 177 | |||
| 178 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 179 | |||
| 180 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 181 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 182 | |||
| 183 | |||
| 184 | =head2 instantiation of packages | ||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | my $get = L_SU_global_constants->new(); | ||
| 189 | my $Project = Project_config->new(); | ||
| 190 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 191 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 192 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 193 | |||
| 194 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 195 | |||
| 196 | my $var = $get->var(); | ||
| 197 | my $on = $var->{_on}; | ||
| 198 | my $off = $var->{_off}; | ||
| 199 | my $true = $var->{_true}; | ||
| 200 | my $false = $var->{_false}; | ||
| 201 | my $empty_string = $var->{_empty_string}; | ||
| 202 | |||
| 203 | =head2 Encapsulated | ||
| 204 | hash of private variables | ||
| 205 | |||
| 206 | =cut | ||
| 207 | |||
| 208 | my $suahw = { | ||
| 209 | _a => '', | ||
| 210 | _b => '', | ||
| 211 | _c => '', | ||
| 212 | _key1 => '', | ||
| 213 | _key2 => '', | ||
| 214 | _key3 => '', | ||
| 215 | _mode => '', | ||
| 216 | _Step => '', | ||
| 217 | _note => '', | ||
| 218 | |||
| 219 | }; | ||
| 220 | |||
| 221 | =head2 sub Step | ||
| 222 | |||
| 223 | collects switches and assembles bash instructions | ||
| 224 | by adding the program name | ||
| 225 | |||
| 226 | =cut | ||
| 227 | |||
| 228 | sub Step { | ||
| 229 | |||
| 230 | $suahw->{_Step} = 'suahw'.$suahw->{_Step}; | ||
| 231 | return ( $suahw->{_Step} ); | ||
| 232 | |||
| 233 | } | ||
| 234 | |||
| 235 | |||
| 236 | =head2 sub note | ||
| 237 | |||
| 238 | collects switches and assembles bash instructions | ||
| 239 | by adding the program name | ||
| 240 | |||
| 241 | =cut | ||
| 242 | |||
| 243 | sub note { | ||
| 244 | |||
| 245 | $suahw->{_note} = 'suahw'.$suahw->{_note}; | ||
| 246 | return ( $suahw->{_note} ); | ||
| 247 | |||
| 248 | } | ||
| 249 | |||
| 250 | |||
| 251 | |||
| 252 | =head2 sub clear | ||
| 253 | |||
| 254 | =cut | ||
| 255 | |||
| 256 | sub clear { | ||
| 257 | |||
| 258 | $suahw->{_a} = ''; | ||
| 259 | $suahw->{_b} = ''; | ||
| 260 | $suahw->{_c} = ''; | ||
| 261 | $suahw->{_key1} = ''; | ||
| 262 | $suahw->{_key2} = ''; | ||
| 263 | $suahw->{_key3} = ''; | ||
| 264 | $suahw->{_mode} = ''; | ||
| 265 | $suahw->{_Step} = ''; | ||
| 266 | $suahw->{_note} = ''; | ||
| 267 | } | ||
| 268 | |||
| 269 | |||
| 270 | =head2 sub a | ||
| 271 | |||
| 272 | |||
| 273 | =cut | ||
| 274 | |||
| 275 | sub a { | ||
| 276 | |||
| 277 | my ( $self,$a ) = @_; | ||
| 278 | if ( $a ne $empty_string ) { | ||
| 279 | |||
| 280 | $suahw->{_a} = $a; | ||
| 281 | $suahw->{_note} = $suahw->{_note}.' a='.$suahw->{_a}; | ||
| 282 | $suahw->{_Step} = $suahw->{_Step}.' a='.$suahw->{_a}; | ||
| 283 | |||
| 284 | } else { | ||
| 285 | print("suahw, a, missing a,\n"); | ||
| 286 | } | ||
| 287 | } | ||
| 288 | |||
| 289 | |||
| 290 | =head2 sub b | ||
| 291 | |||
| 292 | |||
| 293 | =cut | ||
| 294 | |||
| 295 | sub b { | ||
| 296 | |||
| 297 | my ( $self,$b ) = @_; | ||
| 298 | if ( $b ne $empty_string ) { | ||
| 299 | |||
| 300 | $suahw->{_b} = $b; | ||
| 301 | $suahw->{_note} = $suahw->{_note}.' b='.$suahw->{_b}; | ||
| 302 | $suahw->{_Step} = $suahw->{_Step}.' b='.$suahw->{_b}; | ||
| 303 | |||
| 304 | } else { | ||
| 305 | print("suahw, b, missing b,\n"); | ||
| 306 | } | ||
| 307 | } | ||
| 308 | |||
| 309 | |||
| 310 | =head2 sub c | ||
| 311 | |||
| 312 | |||
| 313 | =cut | ||
| 314 | |||
| 315 | sub c { | ||
| 316 | |||
| 317 | my ( $self,$c ) = @_; | ||
| 318 | if ( $c ne $empty_string ) { | ||
| 319 | |||
| 320 | $suahw->{_c} = $c; | ||
| 321 | $suahw->{_note} = $suahw->{_note}.' c='.$suahw->{_c}; | ||
| 322 | $suahw->{_Step} = $suahw->{_Step}.' c='.$suahw->{_c}; | ||
| 323 | |||
| 324 | } else { | ||
| 325 | print("suahw, c, missing c,\n"); | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 329 | |||
| 330 | =head2 sub key1 | ||
| 331 | |||
| 332 | |||
| 333 | =cut | ||
| 334 | |||
| 335 | sub key1 { | ||
| 336 | |||
| 337 | my ( $self,$key1 ) = @_; | ||
| 338 | if ( $key1 ne $empty_string ) { | ||
| 339 | |||
| 340 | $suahw->{_key1} = $key1; | ||
| 341 | $suahw->{_note} = $suahw->{_note}.' key1='.$suahw->{_key1}; | ||
| 342 | $suahw->{_Step} = $suahw->{_Step}.' key1='.$suahw->{_key1}; | ||
| 343 | |||
| 344 | } else { | ||
| 345 | print("suahw, key1, missing key1,\n"); | ||
| 346 | } | ||
| 347 | } | ||
| 348 | |||
| 349 | |||
| 350 | =head2 sub key2 | ||
| 351 | |||
| 352 | |||
| 353 | =cut | ||
| 354 | |||
| 355 | sub key2 { | ||
| 356 | |||
| 357 | my ( $self,$key2 ) = @_; | ||
| 358 | if ( $key2 ne $empty_string ) { | ||
| 359 | |||
| 360 | $suahw->{_key2} = $key2; | ||
| 361 | $suahw->{_note} = $suahw->{_note}.' key2='.$suahw->{_key2}; | ||
| 362 | $suahw->{_Step} = $suahw->{_Step}.' key2='.$suahw->{_key2}; | ||
| 363 | |||
| 364 | } else { | ||
| 365 | print("suahw, key2, missing key2,\n"); | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | |||
| 370 | =head2 sub key3 | ||
| 371 | |||
| 372 | |||
| 373 | =cut | ||
| 374 | |||
| 375 | sub key3 { | ||
| 376 | |||
| 377 | my ( $self,$key3 ) = @_; | ||
| 378 | if ( $key3 ne $empty_string ) { | ||
| 379 | |||
| 380 | $suahw->{_key3} = $key3; | ||
| 381 | $suahw->{_note} = $suahw->{_note}.' key3='.$suahw->{_key3}; | ||
| 382 | $suahw->{_Step} = $suahw->{_Step}.' key3='.$suahw->{_key3}; | ||
| 383 | |||
| 384 | } else { | ||
| 385 | print("suahw, key3, missing key3,\n"); | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | |||
| 390 | =head2 sub mode | ||
| 391 | |||
| 392 | |||
| 393 | =cut | ||
| 394 | |||
| 395 | sub mode { | ||
| 396 | |||
| 397 | my ( $self,$mode ) = @_; | ||
| 398 | if ( $mode ne $empty_string ) { | ||
| 399 | |||
| 400 | $suahw->{_mode} = $mode; | ||
| 401 | $suahw->{_note} = $suahw->{_note}.' mode='.$suahw->{_mode}; | ||
| 402 | $suahw->{_Step} = $suahw->{_Step}.' mode='.$suahw->{_mode}; | ||
| 403 | |||
| 404 | } else { | ||
| 405 | print("suahw, mode, missing mode,\n"); | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | |||
| 410 | =head2 sub get_max_index | ||
| 411 | |||
| 412 | max index = number of input variables -1 | ||
| 413 | |||
| 414 | =cut | ||
| 415 | |||
| 416 | sub get_max_index { | ||
| 417 | my ($self) = @_; | ||
| 418 | my $max_index = 6; | ||
| 419 | |||
| 420 | return($max_index); | ||
| 421 | } | ||
| 422 | |||
| 423 | |||
| 424 | 1; |