« lib/App/SeismicUnixGui/sunix/header/segyhdrs.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/header/suaddstatics.pm »
| 1 | package App::SeismicUnixGui::sunix::header::setbhed; | ||
| 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 | SETBHED - SET the fields in a SEGY Binary tape HEaDer file, as would be | ||
| 25 | |||
| 26 | produced by segyread and segyhdrs | ||
| 27 | |||
| 28 | setbhed par= [optional parameters] | ||
| 29 | |||
| 30 | |||
| 31 | Required parameter: | ||
| 32 | |||
| 33 | none | ||
| 34 | |||
| 35 | Optional parameters: | ||
| 36 | |||
| 37 | bfile=binary output binary tape header file | ||
| 38 | |||
| 39 | par= =parfile | ||
| 40 | |||
| 41 | Set field by field, if desired: | ||
| 42 | |||
| 43 | jobid= job id field | ||
| 44 | |||
| 45 | lino= line number (only one line per reel) | ||
| 46 | |||
| 47 | reno= reel number | ||
| 48 | |||
| 49 | format= data format | ||
| 50 | |||
| 51 | ... etc.... | ||
| 52 | |||
| 53 | To set any binary header field, use sukeyword to find out | ||
| 54 | |||
| 55 | the appropriate keyword, then use the getpar form: | ||
| 56 | |||
| 57 | keyword=value to set keyword to value | ||
| 58 | |||
| 59 | Notes: | ||
| 60 | |||
| 61 | As with all other programs in the CWP/SU package that use getpars, | ||
| 62 | |||
| 63 | (GET PARameters from the command line) a file filled with such | ||
| 64 | |||
| 65 | statments may be included via option par=parfile. In particular, a | ||
| 66 | |||
| 67 | parfile created by "bhedtopar" may be used as input for the program | ||
| 68 | |||
| 69 | "setbhed". | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | The binary header file that results from running segyread may have the | ||
| 74 | |||
| 75 | wrong byte order. You will need to use "swapbhed" to change the byte," | ||
| 76 | |||
| 77 | order before applying this program. | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | Example: | ||
| 82 | |||
| 83 | segyread tape=yourdata.segy bfile=yourdata.b > yourdata.su | ||
| 84 | |||
| 85 | If | ||
| 86 | |||
| 87 | bhedtopar < yourdata.b | more | ||
| 88 | |||
| 89 | shows impossible values, then apply | ||
| 90 | |||
| 91 | swapbhed < yourdata.b > swapped.b | ||
| 92 | |||
| 93 | then apply | ||
| 94 | |||
| 95 | bhedtopar < swapped.b | more | ||
| 96 | |||
| 97 | bhedtopar < swapped.b outpar=parfile | ||
| 98 | |||
| 99 | hand edit parfile, and then apply | ||
| 100 | |||
| 101 | setbhed par=parfile bfile=swapped.b > new.b | ||
| 102 | |||
| 103 | then apply | ||
| 104 | |||
| 105 | segywrite tape=fixeddata.segy bfile=new.b < yourdata.su | ||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | Caveat: This program breaks if a "short" isn't 2 bytes since | ||
| 110 | |||
| 111 | the SEG-Y standard demands a 2 byte integer for ns. | ||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | Credits: | ||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | CWP: John Stockwell 11 Nov 1994 | ||
| 120 | |||
| 121 | =head2 User's notes | ||
| 122 | |||
| 123 | V0.0.1 -untested | ||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | =head2 CHANGES and their DATES | ||
| 128 | |||
| 129 | September 3, 2021 | ||
| 130 | |||
| 131 | =cut | ||
| 132 | |||
| 133 | use Moose; | ||
| 134 | our $VERSION = '0.0.1'; | ||
| 135 | |||
| 136 | |||
| 137 | =head2 Import packages | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 142 | |||
| 143 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 144 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 145 | |||
| 146 | |||
| 147 | =head2 instantiation of packages | ||
| 148 | |||
| 149 | =cut | ||
| 150 | |||
| 151 | my $get = L_SU_global_constants->new(); | ||
| 152 | my $Project = Project_config->new(); | ||
| 153 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 154 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 155 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 156 | |||
| 157 | my $var = $get->var(); | ||
| 158 | my $on = $var->{_on}; | ||
| 159 | my $off = $var->{_off}; | ||
| 160 | my $true = $var->{_true}; | ||
| 161 | my $false = $var->{_false}; | ||
| 162 | my $empty_string = $var->{_empty_string}; | ||
| 163 | |||
| 164 | =head2 Encapsulated | ||
| 165 | hash of private variables | ||
| 166 | |||
| 167 | =cut | ||
| 168 | |||
| 169 | my $setbhed = { | ||
| 170 | _bfile => '', | ||
| 171 | _format => '', | ||
| 172 | _jobid => '', | ||
| 173 | _keyword => '', | ||
| 174 | _lino => '', | ||
| 175 | _outpar => '', | ||
| 176 | _par => '', | ||
| 177 | _reno => '', | ||
| 178 | _tape => '', | ||
| 179 | _Step => '', | ||
| 180 | _note => '', | ||
| 181 | |||
| 182 | }; | ||
| 183 | |||
| 184 | =head2 sub Step | ||
| 185 | |||
| 186 | collects switches and assembles bash instructions | ||
| 187 | by adding the program name | ||
| 188 | |||
| 189 | =cut | ||
| 190 | |||
| 191 | sub Step { | ||
| 192 | |||
| 193 | $setbhed->{_Step} = 'setbhed'.$setbhed->{_Step}; | ||
| 194 | return ( $setbhed->{_Step} ); | ||
| 195 | |||
| 196 | } | ||
| 197 | |||
| 198 | |||
| 199 | =head2 sub note | ||
| 200 | |||
| 201 | collects switches and assembles bash instructions | ||
| 202 | by adding the program name | ||
| 203 | |||
| 204 | =cut | ||
| 205 | |||
| 206 | sub note { | ||
| 207 | |||
| 208 | $setbhed->{_note} = 'setbhed'.$setbhed->{_note}; | ||
| 209 | return ( $setbhed->{_note} ); | ||
| 210 | |||
| 211 | } | ||
| 212 | |||
| 213 | |||
| 214 | |||
| 215 | =head2 sub clear | ||
| 216 | |||
| 217 | =cut | ||
| 218 | |||
| 219 | sub clear { | ||
| 220 | |||
| 221 | $setbhed->{_bfile} = ''; | ||
| 222 | $setbhed->{_format} = ''; | ||
| 223 | $setbhed->{_jobid} = ''; | ||
| 224 | $setbhed->{_keyword} = ''; | ||
| 225 | $setbhed->{_lino} = ''; | ||
| 226 | $setbhed->{_outpar} = ''; | ||
| 227 | $setbhed->{_par} = ''; | ||
| 228 | $setbhed->{_reno} = ''; | ||
| 229 | $setbhed->{_tape} = ''; | ||
| 230 | $setbhed->{_Step} = ''; | ||
| 231 | $setbhed->{_note} = ''; | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | =head2 sub bfile | ||
| 236 | |||
| 237 | |||
| 238 | =cut | ||
| 239 | |||
| 240 | sub bfile { | ||
| 241 | |||
| 242 | my ( $self,$bfile ) = @_; | ||
| 243 | if ( $bfile ne $empty_string ) { | ||
| 244 | |||
| 245 | $setbhed->{_bfile} = $bfile; | ||
| 246 | $setbhed->{_note} = $setbhed->{_note}.' bfile='.$setbhed->{_bfile}; | ||
| 247 | $setbhed->{_Step} = $setbhed->{_Step}.' bfile='.$setbhed->{_bfile}; | ||
| 248 | |||
| 249 | } else { | ||
| 250 | print("setbhed, bfile, missing bfile,\n"); | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | |||
| 255 | =head2 sub format | ||
| 256 | |||
| 257 | |||
| 258 | =cut | ||
| 259 | |||
| 260 | sub format { | ||
| 261 | |||
| 262 | my ( $self,$format ) = @_; | ||
| 263 | if ( $format ne $empty_string ) { | ||
| 264 | |||
| 265 | $setbhed->{_format} = $format; | ||
| 266 | $setbhed->{_note} = $setbhed->{_note}.' format='.$setbhed->{_format}; | ||
| 267 | $setbhed->{_Step} = $setbhed->{_Step}.' format='.$setbhed->{_format}; | ||
| 268 | |||
| 269 | } else { | ||
| 270 | print("setbhed, format, missing format,\n"); | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | |||
| 275 | =head2 sub jobid | ||
| 276 | |||
| 277 | |||
| 278 | =cut | ||
| 279 | |||
| 280 | sub jobid { | ||
| 281 | |||
| 282 | my ( $self,$jobid ) = @_; | ||
| 283 | if ( $jobid ne $empty_string ) { | ||
| 284 | |||
| 285 | $setbhed->{_jobid} = $jobid; | ||
| 286 | $setbhed->{_note} = $setbhed->{_note}.' jobid='.$setbhed->{_jobid}; | ||
| 287 | $setbhed->{_Step} = $setbhed->{_Step}.' jobid='.$setbhed->{_jobid}; | ||
| 288 | |||
| 289 | } else { | ||
| 290 | print("setbhed, jobid, missing jobid,\n"); | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | |||
| 295 | =head2 sub keyword | ||
| 296 | |||
| 297 | |||
| 298 | =cut | ||
| 299 | |||
| 300 | sub keyword { | ||
| 301 | |||
| 302 | my ( $self,$keyword ) = @_; | ||
| 303 | if ( $keyword ne $empty_string ) { | ||
| 304 | |||
| 305 | $setbhed->{_keyword} = $keyword; | ||
| 306 | $setbhed->{_note} = $setbhed->{_note}.' keyword='.$setbhed->{_keyword}; | ||
| 307 | $setbhed->{_Step} = $setbhed->{_Step}.' keyword='.$setbhed->{_keyword}; | ||
| 308 | |||
| 309 | } else { | ||
| 310 | print("setbhed, keyword, missing keyword,\n"); | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 314 | |||
| 315 | =head2 sub lino | ||
| 316 | |||
| 317 | |||
| 318 | =cut | ||
| 319 | |||
| 320 | sub lino { | ||
| 321 | |||
| 322 | my ( $self,$lino ) = @_; | ||
| 323 | if ( $lino ne $empty_string ) { | ||
| 324 | |||
| 325 | $setbhed->{_lino} = $lino; | ||
| 326 | $setbhed->{_note} = $setbhed->{_note}.' lino='.$setbhed->{_lino}; | ||
| 327 | $setbhed->{_Step} = $setbhed->{_Step}.' lino='.$setbhed->{_lino}; | ||
| 328 | |||
| 329 | } else { | ||
| 330 | print("setbhed, lino, missing lino,\n"); | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 334 | |||
| 335 | =head2 sub outpar | ||
| 336 | |||
| 337 | |||
| 338 | =cut | ||
| 339 | |||
| 340 | sub outpar { | ||
| 341 | |||
| 342 | my ( $self,$outpar ) = @_; | ||
| 343 | if ( $outpar ne $empty_string ) { | ||
| 344 | |||
| 345 | $setbhed->{_outpar} = $outpar; | ||
| 346 | $setbhed->{_note} = $setbhed->{_note}.' outpar='.$setbhed->{_outpar}; | ||
| 347 | $setbhed->{_Step} = $setbhed->{_Step}.' outpar='.$setbhed->{_outpar}; | ||
| 348 | |||
| 349 | } else { | ||
| 350 | print("setbhed, outpar, missing outpar,\n"); | ||
| 351 | } | ||
| 352 | } | ||
| 353 | |||
| 354 | |||
| 355 | =head2 sub par | ||
| 356 | |||
| 357 | |||
| 358 | =cut | ||
| 359 | |||
| 360 | sub par { | ||
| 361 | |||
| 362 | my ( $self,$par ) = @_; | ||
| 363 | if ( $par ne $empty_string ) { | ||
| 364 | |||
| 365 | $setbhed->{_par} = $par; | ||
| 366 | $setbhed->{_note} = $setbhed->{_note}.' par='.$setbhed->{_par}; | ||
| 367 | $setbhed->{_Step} = $setbhed->{_Step}.' par='.$setbhed->{_par}; | ||
| 368 | |||
| 369 | } else { | ||
| 370 | print("setbhed, par, missing par,\n"); | ||
| 371 | } | ||
| 372 | } | ||
| 373 | |||
| 374 | |||
| 375 | =head2 sub reno | ||
| 376 | |||
| 377 | |||
| 378 | =cut | ||
| 379 | |||
| 380 | sub reno { | ||
| 381 | |||
| 382 | my ( $self,$reno ) = @_; | ||
| 383 | if ( $reno ne $empty_string ) { | ||
| 384 | |||
| 385 | $setbhed->{_reno} = $reno; | ||
| 386 | $setbhed->{_note} = $setbhed->{_note}.' reno='.$setbhed->{_reno}; | ||
| 387 | $setbhed->{_Step} = $setbhed->{_Step}.' reno='.$setbhed->{_reno}; | ||
| 388 | |||
| 389 | } else { | ||
| 390 | print("setbhed, reno, missing reno,\n"); | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | |||
| 395 | =head2 sub tape | ||
| 396 | |||
| 397 | |||
| 398 | =cut | ||
| 399 | |||
| 400 | sub tape { | ||
| 401 | |||
| 402 | my ( $self,$tape ) = @_; | ||
| 403 | if ( $tape ne $empty_string ) { | ||
| 404 | |||
| 405 | $setbhed->{_tape} = $tape; | ||
| 406 | $setbhed->{_note} = $setbhed->{_note}.' tape='.$setbhed->{_tape}; | ||
| 407 | $setbhed->{_Step} = $setbhed->{_Step}.' tape='.$setbhed->{_tape}; | ||
| 408 | |||
| 409 | } else { | ||
| 410 | print("setbhed, tape, missing tape,\n"); | ||
| 411 | } | ||
| 412 | } | ||
| 413 | |||
| 414 | |||
| 415 | =head2 sub get_max_index | ||
| 416 | |||
| 417 | max index = number of input variables -1 | ||
| 418 | |||
| 419 | =cut | ||
| 420 | |||
| 421 | sub get_max_index { | ||
| 422 | my ($self) = @_; | ||
| 423 | my $max_index = 6; | ||
| 424 | |||
| 425 | return($max_index); | ||
| 426 | } | ||
| 427 | |||
| 428 | |||
| 429 | 1; |