« lib/App/SeismicUnixGui/sunix/model/sujitter.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/plot/psbbox.pm »
| 1 | package App::SeismicUnixGui::sunix::par::ftnunstrip; | ||
| 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 | FTNUNSTRIP - convert C binary floats to Fortran style floats | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | ftnunstrip <stdin >stdout | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required parameters: | ||
| 33 | |||
| 34 | none | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | Optional parameters: | ||
| 39 | |||
| 40 | n1=1 floats per line in output file | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | outpar=/dev/tty output parameter file, contains the | ||
| 45 | |||
| 46 | number of lines (n=) | ||
| 47 | |||
| 48 | other choices for outpar are: /dev/tty, | ||
| 49 | |||
| 50 | /dev/stderr, or a name of a disk file | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | Notes: This program assumes that the record length is constant | ||
| 55 | |||
| 56 | throughout the input and output files. | ||
| 57 | |||
| 58 | In fortran code reading these floats, the following implied | ||
| 59 | |||
| 60 | do loop syntax would be used: | ||
| 61 | |||
| 62 | DO i=1,n2 | ||
| 63 | |||
| 64 | READ (10) (someARRAY(j), j=1,n1) | ||
| 65 | |||
| 66 | END DO | ||
| 67 | |||
| 68 | Here n1 is the number of samples per record, n2 is the number | ||
| 69 | |||
| 70 | of records, 10 is some default file (fort.10, for example), and | ||
| 71 | |||
| 72 | someArray(j) is an array dimensioned to size n1 | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | Credits: | ||
| 79 | |||
| 80 | CWP: John Stockwell, Feb 1998, | ||
| 81 | |||
| 82 | based on ftnstrip by: Jack K. Cohen | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | =head2 User's notes (Juan Lorenzo) | ||
| 87 | untested | ||
| 88 | |||
| 89 | =cut | ||
| 90 | |||
| 91 | |||
| 92 | =head2 CHANGES and their DATES | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | use Moose; | ||
| 97 | our $VERSION = '0.0.1'; | ||
| 98 | |||
| 99 | |||
| 100 | =head2 Import packages | ||
| 101 | |||
| 102 | =cut | ||
| 103 | |||
| 104 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 105 | |||
| 106 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 107 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 108 | |||
| 109 | |||
| 110 | =head2 instantiation of packages | ||
| 111 | |||
| 112 | =cut | ||
| 113 | |||
| 114 | my $get = L_SU_global_constants->new(); | ||
| 115 | my $Project = Project_config->new(); | ||
| 116 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 117 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 118 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 119 | |||
| 120 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 121 | |||
| 122 | my $var = $get->var(); | ||
| 123 | my $on = $var->{_on}; | ||
| 124 | my $off = $var->{_off}; | ||
| 125 | my $true = $var->{_true}; | ||
| 126 | my $false = $var->{_false}; | ||
| 127 | my $empty_string = $var->{_empty_string}; | ||
| 128 | |||
| 129 | =head2 Encapsulated | ||
| 130 | hash of private variables | ||
| 131 | |||
| 132 | =cut | ||
| 133 | |||
| 134 | my $ftnunstrip = { | ||
| 135 | _i => '', | ||
| 136 | _j => '', | ||
| 137 | _n => '', | ||
| 138 | _n1 => '', | ||
| 139 | _outpar => '', | ||
| 140 | _Step => '', | ||
| 141 | _note => '', | ||
| 142 | |||
| 143 | }; | ||
| 144 | |||
| 145 | =head2 sub Step | ||
| 146 | |||
| 147 | collects switches and assembles bash instructions | ||
| 148 | by adding the program name | ||
| 149 | |||
| 150 | =cut | ||
| 151 | |||
| 152 | sub Step { | ||
| 153 | |||
| 154 | $ftnunstrip->{_Step} = 'ftnunstrip'.$ftnunstrip->{_Step}; | ||
| 155 | return ( $ftnunstrip->{_Step} ); | ||
| 156 | |||
| 157 | } | ||
| 158 | |||
| 159 | |||
| 160 | =head2 sub note | ||
| 161 | |||
| 162 | collects switches and assembles bash instructions | ||
| 163 | by adding the program name | ||
| 164 | |||
| 165 | =cut | ||
| 166 | |||
| 167 | sub note { | ||
| 168 | |||
| 169 | $ftnunstrip->{_note} = 'ftnunstrip'.$ftnunstrip->{_note}; | ||
| 170 | return ( $ftnunstrip->{_note} ); | ||
| 171 | |||
| 172 | } | ||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | =head2 sub clear | ||
| 177 | |||
| 178 | =cut | ||
| 179 | |||
| 180 | sub clear { | ||
| 181 | |||
| 182 | $ftnunstrip->{_i} = ''; | ||
| 183 | $ftnunstrip->{_j} = ''; | ||
| 184 | $ftnunstrip->{_n} = ''; | ||
| 185 | $ftnunstrip->{_n1} = ''; | ||
| 186 | $ftnunstrip->{_outpar} = ''; | ||
| 187 | $ftnunstrip->{_Step} = ''; | ||
| 188 | $ftnunstrip->{_note} = ''; | ||
| 189 | } | ||
| 190 | |||
| 191 | |||
| 192 | =head2 sub i | ||
| 193 | |||
| 194 | |||
| 195 | =cut | ||
| 196 | |||
| 197 | sub i { | ||
| 198 | |||
| 199 | my ( $self,$i ) = @_; | ||
| 200 | if ( $i ne $empty_string ) { | ||
| 201 | |||
| 202 | $ftnunstrip->{_i} = $i; | ||
| 203 | $ftnunstrip->{_note} = $ftnunstrip->{_note}.' i='.$ftnunstrip->{_i}; | ||
| 204 | $ftnunstrip->{_Step} = $ftnunstrip->{_Step}.' i='.$ftnunstrip->{_i}; | ||
| 205 | |||
| 206 | } else { | ||
| 207 | print("ftnunstrip, i, missing i,\n"); | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | |||
| 212 | =head2 sub j | ||
| 213 | |||
| 214 | |||
| 215 | =cut | ||
| 216 | |||
| 217 | sub j { | ||
| 218 | |||
| 219 | my ( $self,$j ) = @_; | ||
| 220 | if ( $j ne $empty_string ) { | ||
| 221 | |||
| 222 | $ftnunstrip->{_j} = $j; | ||
| 223 | $ftnunstrip->{_note} = $ftnunstrip->{_note}.' j='.$ftnunstrip->{_j}; | ||
| 224 | $ftnunstrip->{_Step} = $ftnunstrip->{_Step}.' j='.$ftnunstrip->{_j}; | ||
| 225 | |||
| 226 | } else { | ||
| 227 | print("ftnunstrip, j, missing j,\n"); | ||
| 228 | } | ||
| 229 | } | ||
| 230 | |||
| 231 | |||
| 232 | =head2 sub n | ||
| 233 | |||
| 234 | |||
| 235 | =cut | ||
| 236 | |||
| 237 | sub n { | ||
| 238 | |||
| 239 | my ( $self,$n ) = @_; | ||
| 240 | if ( $n ne $empty_string ) { | ||
| 241 | |||
| 242 | $ftnunstrip->{_n} = $n; | ||
| 243 | $ftnunstrip->{_note} = $ftnunstrip->{_note}.' n='.$ftnunstrip->{_n}; | ||
| 244 | $ftnunstrip->{_Step} = $ftnunstrip->{_Step}.' n='.$ftnunstrip->{_n}; | ||
| 245 | |||
| 246 | } else { | ||
| 247 | print("ftnunstrip, n, missing n,\n"); | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | |||
| 252 | =head2 sub n1 | ||
| 253 | |||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | sub n1 { | ||
| 258 | |||
| 259 | my ( $self,$n1 ) = @_; | ||
| 260 | if ( $n1 ne $empty_string ) { | ||
| 261 | |||
| 262 | $ftnunstrip->{_n1} = $n1; | ||
| 263 | $ftnunstrip->{_note} = $ftnunstrip->{_note}.' n1='.$ftnunstrip->{_n1}; | ||
| 264 | $ftnunstrip->{_Step} = $ftnunstrip->{_Step}.' n1='.$ftnunstrip->{_n1}; | ||
| 265 | |||
| 266 | } else { | ||
| 267 | print("ftnunstrip, n1, missing n1,\n"); | ||
| 268 | } | ||
| 269 | } | ||
| 270 | |||
| 271 | |||
| 272 | =head2 sub outpar | ||
| 273 | |||
| 274 | |||
| 275 | =cut | ||
| 276 | |||
| 277 | sub outpar { | ||
| 278 | |||
| 279 | my ( $self,$outpar ) = @_; | ||
| 280 | if ( $outpar ne $empty_string ) { | ||
| 281 | |||
| 282 | $ftnunstrip->{_outpar} = $outpar; | ||
| 283 | $ftnunstrip->{_note} = $ftnunstrip->{_note}.' outpar='.$ftnunstrip->{_outpar}; | ||
| 284 | $ftnunstrip->{_Step} = $ftnunstrip->{_Step}.' outpar='.$ftnunstrip->{_outpar}; | ||
| 285 | |||
| 286 | } else { | ||
| 287 | print("ftnunstrip, outpar, missing outpar,\n"); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | |||
| 292 | =head2 sub get_max_index | ||
| 293 | |||
| 294 | max index = number of input variables -1 | ||
| 295 | |||
| 296 | =cut | ||
| 297 | |||
| 298 | sub get_max_index { | ||
| 299 | my ($self) = @_; | ||
| 300 | my $max_index = 4; | ||
| 301 | |||
| 302 | return($max_index); | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | 1; |