« lib/App/SeismicUnixGui/sunix/header/suahw.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/migration/sumigfd.pm »
| 1 | package App::SeismicUnixGui::sunix::header::suascii; | ||
| 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 | SUASCII - print non zero header values and data in various formats | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | suascii <stdin >ascii_file | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Optional parameter: | ||
| 33 | |||
| 34 | bare=0 print headers and data | ||
| 35 | |||
| 36 | =1 print only data | ||
| 37 | |||
| 38 | =2 print headers only | ||
| 39 | |||
| 40 | =3 print data in print data in .csv format, e.g. for Excel | ||
| 41 | |||
| 42 | =4 print data as tab delimited .txt file, e.g. for GnuPlot | ||
| 43 | |||
| 44 | =5 print data as .xyz file, e.g. for plotting with GMT | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | ntr=50 maximum number of output traces (bare=3 or bare=4 only) | ||
| 49 | |||
| 50 | index=0 don't include time/depth index in ascii file (bare=4) | ||
| 51 | |||
| 52 | =1 include time/depth index in ascii file | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | key= if set, name of keyword containing x-value | ||
| 57 | |||
| 58 | in .xyz output (bare=5 only) | ||
| 59 | |||
| 60 | sep= if set, string separating traces in .xyz output | ||
| 61 | |||
| 62 | (bare=5; default is no separation) | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | verbose=0 =1 for detailed information | ||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | Notes: | ||
| 71 | |||
| 72 | The programs suwind and suresamp provide trace selection and | ||
| 73 | |||
| 74 | subsampling, respectively. | ||
| 75 | |||
| 76 | With bare=0 and bare=1 traces are separated by a blank line. | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | With bare=3 a maximum of ntr traces are output in .csv format | ||
| 81 | |||
| 82 | ("comma-separated value"), e.g. for import into spreadsheet | ||
| 83 | |||
| 84 | applications like Excel. | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | With bare=4 a maximum of ntr traces are output in as tab delimited | ||
| 89 | |||
| 90 | columns. Use bare=4 for plotting in GnuPlot. | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | With bare=5 traces are written as "x y z" triples as required | ||
| 95 | |||
| 96 | by certain plotting programs such as the Generic Mapping Tools | ||
| 97 | |||
| 98 | (GMT). If sep= is set, traces are separated by a line containing | ||
| 99 | |||
| 100 | the string provided, e.g. sep=">" for GMT multisegment files. | ||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | "option=" is an acceptable alias for "bare=". | ||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | Related programs: sugethw, sudumptrace | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | Credits: | ||
| 115 | |||
| 116 | CWP: Jack K. Cohen c. 1989 | ||
| 117 | |||
| 118 | CENPET: Werner M. Heigl 2006 - bug fixes & extensions | ||
| 119 | |||
| 120 | RISSC: Nils Maercklin 2006 | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | Trace header field accessed: ns, dt, delrt, d1, f1, trid | ||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | =head2 CHANGES and their DATES | ||
| 129 | |||
| 130 | =cut | ||
| 131 | |||
| 132 | use Moose; | ||
| 133 | our $VERSION = '0.0.1'; | ||
| 134 | |||
| 135 | |||
| 136 | =head2 Import packages | ||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 141 | |||
| 142 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 143 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 144 | |||
| 145 | |||
| 146 | =head2 instantiation of packages | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | my $get = L_SU_global_constants->new(); | ||
| 151 | my $Project = Project_config->new(); | ||
| 152 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 153 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 154 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 155 | |||
| 156 | my $var = $get->var(); | ||
| 157 | my $on = $var->{_on}; | ||
| 158 | my $off = $var->{_off}; | ||
| 159 | my $true = $var->{_true}; | ||
| 160 | my $false = $var->{_false}; | ||
| 161 | my $empty_string = $var->{_empty_string}; | ||
| 162 | |||
| 163 | =head2 Encapsulated | ||
| 164 | hash of private variables | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | my $suascii = { | ||
| 169 | _bare => '', | ||
| 170 | _index => '', | ||
| 171 | _key => '', | ||
| 172 | _ntr => '', | ||
| 173 | _option => '', | ||
| 174 | _sep => '', | ||
| 175 | _verbose => '', | ||
| 176 | _Step => '', | ||
| 177 | _note => '', | ||
| 178 | |||
| 179 | }; | ||
| 180 | |||
| 181 | =head2 sub Step | ||
| 182 | |||
| 183 | collects switches and assembles bash instructions | ||
| 184 | by adding the program name | ||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | sub Step { | ||
| 189 | |||
| 190 | $suascii->{_Step} = 'suascii'.$suascii->{_Step}; | ||
| 191 | return ( $suascii->{_Step} ); | ||
| 192 | |||
| 193 | } | ||
| 194 | |||
| 195 | |||
| 196 | =head2 sub note | ||
| 197 | |||
| 198 | collects switches and assembles bash instructions | ||
| 199 | by adding the program name | ||
| 200 | |||
| 201 | =cut | ||
| 202 | |||
| 203 | sub note { | ||
| 204 | |||
| 205 | $suascii->{_note} = 'suascii'.$suascii->{_note}; | ||
| 206 | return ( $suascii->{_note} ); | ||
| 207 | |||
| 208 | } | ||
| 209 | |||
| 210 | |||
| 211 | |||
| 212 | =head2 sub clear | ||
| 213 | |||
| 214 | =cut | ||
| 215 | |||
| 216 | sub clear { | ||
| 217 | |||
| 218 | $suascii->{_bare} = ''; | ||
| 219 | $suascii->{_index} = ''; | ||
| 220 | $suascii->{_key} = ''; | ||
| 221 | $suascii->{_ntr} = ''; | ||
| 222 | $suascii->{_option} = ''; | ||
| 223 | $suascii->{_sep} = ''; | ||
| 224 | $suascii->{_verbose} = ''; | ||
| 225 | $suascii->{_Step} = ''; | ||
| 226 | $suascii->{_note} = ''; | ||
| 227 | } | ||
| 228 | |||
| 229 | |||
| 230 | =head2 sub bare | ||
| 231 | |||
| 232 | |||
| 233 | =cut | ||
| 234 | |||
| 235 | sub bare { | ||
| 236 | |||
| 237 | my ( $self,$bare ) = @_; | ||
| 238 | if ( $bare ne $empty_string ) { | ||
| 239 | |||
| 240 | $suascii->{_bare} = $bare; | ||
| 241 | $suascii->{_note} = $suascii->{_note}.' bare='.$suascii->{_bare}; | ||
| 242 | $suascii->{_Step} = $suascii->{_Step}.' bare='.$suascii->{_bare}; | ||
| 243 | |||
| 244 | } else { | ||
| 245 | print("suascii, bare, missing bare,\n"); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | |||
| 250 | =head2 sub index | ||
| 251 | |||
| 252 | |||
| 253 | =cut | ||
| 254 | |||
| 255 | sub index { | ||
| 256 | |||
| 257 | my ( $self,$index ) = @_; | ||
| 258 | if ( $index ne $empty_string ) { | ||
| 259 | |||
| 260 | $suascii->{_index} = $index; | ||
| 261 | $suascii->{_note} = $suascii->{_note}.' index='.$suascii->{_index}; | ||
| 262 | $suascii->{_Step} = $suascii->{_Step}.' index='.$suascii->{_index}; | ||
| 263 | |||
| 264 | } else { | ||
| 265 | print("suascii, index, missing index,\n"); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | |||
| 270 | =head2 sub key | ||
| 271 | |||
| 272 | |||
| 273 | =cut | ||
| 274 | |||
| 275 | sub key { | ||
| 276 | |||
| 277 | my ( $self,$key ) = @_; | ||
| 278 | if ( $key ne $empty_string ) { | ||
| 279 | |||
| 280 | $suascii->{_key} = $key; | ||
| 281 | $suascii->{_note} = $suascii->{_note}.' key='.$suascii->{_key}; | ||
| 282 | $suascii->{_Step} = $suascii->{_Step}.' key='.$suascii->{_key}; | ||
| 283 | |||
| 284 | } else { | ||
| 285 | print("suascii, key, missing key,\n"); | ||
| 286 | } | ||
| 287 | } | ||
| 288 | |||
| 289 | |||
| 290 | =head2 sub ntr | ||
| 291 | |||
| 292 | |||
| 293 | =cut | ||
| 294 | |||
| 295 | sub ntr { | ||
| 296 | |||
| 297 | my ( $self,$ntr ) = @_; | ||
| 298 | if ( $ntr ne $empty_string ) { | ||
| 299 | |||
| 300 | $suascii->{_ntr} = $ntr; | ||
| 301 | $suascii->{_note} = $suascii->{_note}.' ntr='.$suascii->{_ntr}; | ||
| 302 | $suascii->{_Step} = $suascii->{_Step}.' ntr='.$suascii->{_ntr}; | ||
| 303 | |||
| 304 | } else { | ||
| 305 | print("suascii, ntr, missing ntr,\n"); | ||
| 306 | } | ||
| 307 | } | ||
| 308 | |||
| 309 | |||
| 310 | =head2 sub option | ||
| 311 | |||
| 312 | |||
| 313 | =cut | ||
| 314 | |||
| 315 | sub option { | ||
| 316 | |||
| 317 | my ( $self,$option ) = @_; | ||
| 318 | if ( $option ne $empty_string ) { | ||
| 319 | |||
| 320 | $suascii->{_option} = $option; | ||
| 321 | $suascii->{_note} = $suascii->{_note}.' option='.$suascii->{_option}; | ||
| 322 | $suascii->{_Step} = $suascii->{_Step}.' option='.$suascii->{_option}; | ||
| 323 | |||
| 324 | } else { | ||
| 325 | print("suascii, option, missing option,\n"); | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 329 | |||
| 330 | =head2 sub sep | ||
| 331 | |||
| 332 | |||
| 333 | =cut | ||
| 334 | |||
| 335 | sub sep { | ||
| 336 | |||
| 337 | my ( $self,$sep ) = @_; | ||
| 338 | if ( $sep ne $empty_string ) { | ||
| 339 | |||
| 340 | $suascii->{_sep} = $sep; | ||
| 341 | $suascii->{_note} = $suascii->{_note}.' sep='.$suascii->{_sep}; | ||
| 342 | $suascii->{_Step} = $suascii->{_Step}.' sep='.$suascii->{_sep}; | ||
| 343 | |||
| 344 | } else { | ||
| 345 | print("suascii, sep, missing sep,\n"); | ||
| 346 | } | ||
| 347 | } | ||
| 348 | |||
| 349 | |||
| 350 | =head2 sub verbose | ||
| 351 | |||
| 352 | |||
| 353 | =cut | ||
| 354 | |||
| 355 | sub verbose { | ||
| 356 | |||
| 357 | my ( $self,$verbose ) = @_; | ||
| 358 | if ( $verbose ne $empty_string ) { | ||
| 359 | |||
| 360 | $suascii->{_verbose} = $verbose; | ||
| 361 | $suascii->{_note} = $suascii->{_note}.' verbose='.$suascii->{_verbose}; | ||
| 362 | $suascii->{_Step} = $suascii->{_Step}.' verbose='.$suascii->{_verbose}; | ||
| 363 | |||
| 364 | } else { | ||
| 365 | print("suascii, verbose, missing verbose,\n"); | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | |||
| 370 | =head2 sub get_max_index | ||
| 371 | |||
| 372 | max index = number of input variables -1 | ||
| 373 | |||
| 374 | =cut | ||
| 375 | |||
| 376 | sub get_max_index { | ||
| 377 | my ($self) = @_; | ||
| 378 | my $max_index = 6; | ||
| 379 | |||
| 380 | return($max_index); | ||
| 381 | } | ||
| 382 | |||
| 383 | |||
| 384 | 1; |