« lib/App/SeismicUnixGui/sunix/transform/dctcomp.pm
↑ Summary
lib/App/SeismicUnixGui/misc/su_select_waveform.pm »
| 1 | package App::SeismicUnixGui::sunix::par::b2a; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: B2A - convert binary floats to ascii | ||
| 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 | B2A - convert binary floats to ascii | ||
| 26 | |||
| 27 | b2a <stdin >stdout | ||
| 28 | |||
| 29 | Required parameters: | ||
| 30 | none | ||
| 31 | |||
| 32 | Optional parameters: | ||
| 33 | n1=2 floats per line in output file | ||
| 34 | format=0 scientific notation | ||
| 35 | =1 long decimal float form | ||
| 36 | |||
| 37 | outpar=/dev/tty output parameter file, contains the | ||
| 38 | number of lines (n=) | ||
| 39 | other choices for outpar are: /dev/tty, | ||
| 40 | /dev/stderr, or a name of a disk file | ||
| 41 | |||
| 42 | Note: | ||
| 43 | Parameter: ", | ||
| 44 | format=0 uses printf("%15.10e ", x[i1]) | ||
| 45 | format=1 uses printf("%15.15f ", x[i1]) | ||
| 46 | |||
| 47 | Credits: | ||
| 48 | CWP: Jack K. Cohen | ||
| 49 | |||
| 50 | =head2 CHANGES and their DATES | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | use Moose; | ||
| 55 | our $VERSION = '0.0.1'; | ||
| 56 | |||
| 57 | my $b2a = { | ||
| 58 | _format => '', | ||
| 59 | _n1 => '', | ||
| 60 | _outpar => '', | ||
| 61 | _Step => '', | ||
| 62 | _note => '', | ||
| 63 | }; | ||
| 64 | |||
| 65 | =head2 sub Step | ||
| 66 | |||
| 67 | collects switches and assembles bash instructions | ||
| 68 | by adding the program name | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | sub Step { | ||
| 73 | |||
| 74 | $b2a->{_Step} = 'b2a' . $b2a->{_Step}; | ||
| 75 | return ( $b2a->{_Step} ); | ||
| 76 | |||
| 77 | } | ||
| 78 | |||
| 79 | =head2 sub note | ||
| 80 | |||
| 81 | collects switches and assembles bash instructions | ||
| 82 | by adding the program name | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | sub note { | ||
| 87 | |||
| 88 | $b2a->{_note} = 'b2a' . $b2a->{_note}; | ||
| 89 | return ( $b2a->{_note} ); | ||
| 90 | |||
| 91 | } | ||
| 92 | |||
| 93 | =head2 sub clear | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | sub clear { | ||
| 98 | |||
| 99 | $b2a->{_format} = ''; | ||
| 100 | $b2a->{_n1} = ''; | ||
| 101 | $b2a->{_outpar} = ''; | ||
| 102 | $b2a->{_Step} = ''; | ||
| 103 | $b2a->{_note} = ''; | ||
| 104 | } | ||
| 105 | |||
| 106 | =head2 sub format | ||
| 107 | |||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub format { | ||
| 112 | |||
| 113 | my ( $self, $format ) = @_; | ||
| 114 | if (length $format) { | ||
| 115 | |||
| 116 | $b2a->{_format} = $format; | ||
| 117 | $b2a->{_note} = $b2a->{_note} . ' format=' . $b2a->{_format}; | ||
| 118 | $b2a->{_Step} = $b2a->{_Step} . ' format=' . $b2a->{_format}; | ||
| 119 | |||
| 120 | } | ||
| 121 | else { | ||
| 122 | print("b2a, format, missing format,\n"); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | =head2 sub n1 | ||
| 127 | |||
| 128 | |||
| 129 | =cut | ||
| 130 | |||
| 131 | sub n1 { | ||
| 132 | |||
| 133 | my ( $self, $n1 ) = @_; | ||
| 134 | if ($n1) { | ||
| 135 | |||
| 136 | $b2a->{_n1} = $n1; | ||
| 137 | $b2a->{_note} = $b2a->{_note} . ' n1=' . $b2a->{_n1}; | ||
| 138 | $b2a->{_Step} = $b2a->{_Step} . ' n1=' . $b2a->{_n1}; | ||
| 139 | |||
| 140 | } | ||
| 141 | else { | ||
| 142 | print("b2a, n1, missing n1,\n"); | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | =head2 sub outpar | ||
| 147 | |||
| 148 | |||
| 149 | =cut | ||
| 150 | |||
| 151 | sub outpar { | ||
| 152 | |||
| 153 | my ( $self, $outpar ) = @_; | ||
| 154 | if ($outpar) { | ||
| 155 | |||
| 156 | $b2a->{_outpar} = $outpar; | ||
| 157 | $b2a->{_note} = $b2a->{_note} . ' outpar=' . $b2a->{_outpar}; | ||
| 158 | $b2a->{_Step} = $b2a->{_Step} . ' outpar=' . $b2a->{_outpar}; | ||
| 159 | |||
| 160 | } | ||
| 161 | else { | ||
| 162 | print("b2a, outpar, missing outpar,\n"); | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 166 | =head2 sub get_max_index | ||
| 167 | |||
| 168 | max index = number of input variables -1 | ||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | sub get_max_index { | ||
| 173 | my ($self) = @_; | ||
| 174 | |||
| 175 | # only file_name : index=2 | ||
| 176 | my $max_index = 2; | ||
| 177 | |||
| 178 | return ($max_index); | ||
| 179 | } | ||
| 180 | |||
| 181 | 1; |