« lib/App/SeismicUnixGui/sunix/header/sugethw.pm
↑ Summary
lib/App/SeismicUnixGui/specs/data/suswapbytes_spec.pm »
| 1 | package App::SeismicUnixGui::sunix::header::sustrip; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: SUSTRIP - remove the SEGY headers from the traces | ||
| 8 | |||
| 9 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 10 | |||
| 11 | DATE: | ||
| 12 | |||
| 13 | DESCRIPTION: | ||
| 14 | |||
| 15 | Version: | ||
| 16 | |||
| 17 | =head2 USE | ||
| 18 | |||
| 19 | =head3 NOTES | ||
| 20 | |||
| 21 | =head4 Examples | ||
| 22 | |||
| 23 | =head3 SEISMIC UNIX NOTES | ||
| 24 | |||
| 25 | SUSTRIP - remove the SEGY headers from the traces | ||
| 26 | |||
| 27 | sustrip <stdin >stdout head=/dev/null outpar=/dev/tty ftn=0 | ||
| 28 | |||
| 29 | Required parameters: | ||
| 30 | none | ||
| 31 | |||
| 32 | Optional parameters: | ||
| 33 | head=/dev/null file to save headers in | ||
| 34 | |||
| 35 | outpar=/dev/tty output parameter file, contains: | ||
| 36 | number of samples (n1=) | ||
| 37 | number of traces (n2=) | ||
| 38 | sample rate in seconds (d1=) | ||
| 39 | |||
| 40 | ftn=0 Fortran flag | ||
| 41 | 0 = write unformatted for C | ||
| 42 | 1 = ... for Fortran | ||
| 43 | |||
| 44 | Notes: | ||
| 45 | Invoking head=filename will write the trace headers into filename. | ||
| 46 | You may paste the headers back onto the traces with supaste | ||
| 47 | See: sudoc supaste for more information | ||
| 48 | Related programs: supaste, suaddhead | ||
| 49 | |||
| 50 | Credits: | ||
| 51 | SEP: Einar Kjartansson c. 1985 | ||
| 52 | CWP: Jack K. Cohen April 1990 | ||
| 53 | |||
| 54 | Trace header fields accessed: ns, dt | ||
| 55 | |||
| 56 | =head2 CHANGES and their DATES | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | use Moose; | ||
| 61 | our $VERSION = '0.0.1'; | ||
| 62 | |||
| 63 | my $sustrip = { | ||
| 64 | _ftn => '', | ||
| 65 | _head => '', | ||
| 66 | _outpar => '', | ||
| 67 | _Step => '', | ||
| 68 | _note => '', | ||
| 69 | }; | ||
| 70 | |||
| 71 | =head2 sub Step | ||
| 72 | |||
| 73 | collects switches and assembles bash instructions | ||
| 74 | by adding the program name | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | sub Step { | ||
| 79 | |||
| 80 | $sustrip->{_Step} = 'sustrip' . $sustrip->{_Step}; | ||
| 81 | return ( $sustrip->{_Step} ); | ||
| 82 | |||
| 83 | } | ||
| 84 | |||
| 85 | =head2 sub note | ||
| 86 | |||
| 87 | collects switches and assembles bash instructions | ||
| 88 | by adding the program name | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | sub note { | ||
| 93 | |||
| 94 | $sustrip->{_note} = 'sustrip' . $sustrip->{_note}; | ||
| 95 | return ( $sustrip->{_note} ); | ||
| 96 | |||
| 97 | } | ||
| 98 | |||
| 99 | =head2 sub clear | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | sub clear { | ||
| 104 | |||
| 105 | $sustrip->{_ftn} = ''; | ||
| 106 | $sustrip->{_head} = ''; | ||
| 107 | $sustrip->{_outpar} = ''; | ||
| 108 | $sustrip->{_Step} = ''; | ||
| 109 | $sustrip->{_note} = ''; | ||
| 110 | } | ||
| 111 | |||
| 112 | =head2 sub ftn | ||
| 113 | |||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | sub ftn { | ||
| 118 | |||
| 119 | my ( $self, $ftn ) = @_; | ||
| 120 | if (length $ftn) { | ||
| 121 | |||
| 122 | $sustrip->{_ftn} = $ftn; | ||
| 123 | $sustrip->{_note} = $sustrip->{_note} . ' ftn=' . $sustrip->{_ftn}; | ||
| 124 | $sustrip->{_Step} = $sustrip->{_Step} . ' ftn=' . $sustrip->{_ftn}; | ||
| 125 | |||
| 126 | } | ||
| 127 | else { | ||
| 128 | print("sustrip, ftn, missing ftn,\n"); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | =head2 sub head | ||
| 133 | |||
| 134 | |||
| 135 | =cut | ||
| 136 | |||
| 137 | sub head { | ||
| 138 | |||
| 139 | my ( $self, $head ) = @_; | ||
| 140 | if ($head) { | ||
| 141 | |||
| 142 | $sustrip->{_head} = $head; | ||
| 143 | $sustrip->{_note} = $sustrip->{_note} . ' head=' . $sustrip->{_head}; | ||
| 144 | $sustrip->{_Step} = $sustrip->{_Step} . ' head=' . $sustrip->{_head}; | ||
| 145 | |||
| 146 | } | ||
| 147 | else { | ||
| 148 | print("sustrip, head, missing head,\n"); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | =head2 sub header_file_out | ||
| 153 | |||
| 154 | |||
| 155 | =cut | ||
| 156 | |||
| 157 | sub header_file_out { | ||
| 158 | |||
| 159 | my ( $self, $head ) = @_; | ||
| 160 | if ($head) { | ||
| 161 | |||
| 162 | $sustrip->{_head} = $head; | ||
| 163 | $sustrip->{_note} = $sustrip->{_note} . ' head=' . $sustrip->{_head}; | ||
| 164 | $sustrip->{_Step} = $sustrip->{_Step} . ' head=' . $sustrip->{_head}; | ||
| 165 | |||
| 166 | } | ||
| 167 | else { | ||
| 168 | print("sustrip, head, missing header_file_out,\n"); | ||
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | =head2 sub outpar | ||
| 173 | |||
| 174 | |||
| 175 | =cut | ||
| 176 | |||
| 177 | sub outpar { | ||
| 178 | |||
| 179 | my ( $self, $outpar ) = @_; | ||
| 180 | if ($outpar) { | ||
| 181 | |||
| 182 | $sustrip->{_outpar} = $outpar; | ||
| 183 | $sustrip->{_note} = | ||
| 184 | $sustrip->{_note} . ' outpar=' . $sustrip->{_outpar}; | ||
| 185 | $sustrip->{_Step} = | ||
| 186 | $sustrip->{_Step} . ' outpar=' . $sustrip->{_outpar}; | ||
| 187 | |||
| 188 | } | ||
| 189 | else { | ||
| 190 | print("sustrip, outpar, missing outpar,\n"); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 194 | =head2 sub get_max_index | ||
| 195 | |||
| 196 | max index = number of input variables -1 | ||
| 197 | |||
| 198 | =cut | ||
| 199 | |||
| 200 | sub get_max_index { | ||
| 201 | my ($self) = @_; | ||
| 202 | |||
| 203 | # index=2 | ||
| 204 | my $max_index = 2; | ||
| 205 | |||
| 206 | return ($max_index); | ||
| 207 | } | ||
| 208 | |||
| 209 | 1; |