lib/App/SeismicUnixGui/sunix/par/float2ibm.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 80 CC 4 SCAR 13.1
CC
4
Cov
0%
endian
6.0
n
6.0
outpar
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::par::float2ibm;
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 FLOAT2IBM - convert native binary FLOATS to IBM tape FLOATS
25  
26  
27  
28 float2ibm <stdin >stdout
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameters:
39  
40 endian= byte order of your system (autodetected)
41  
42 outpar=/dev/tty output parameter file, contains the
43  
44 number of values (n=)
45  
46 other choices for outpar are: /dev/tty,
47  
48 /dev/stderr, or a name of a disk file
49  
50  
51  
52 Notes:
53  
54 endian=1 (big endian) endian=0 (little endian) byte order
55  
56 You probably will not have to set this, as the byte order of
57  
58 your system is autodetected by the program.
59  
60 This program is usable for writing SEG Y traces with the headers
61  
62 stripped off.
63  
64  
65  
66 Credits:
67  
68 CWP: John Stockwell, based on code by Jack K. Cohen
69  
70  
71  
72 =head2 User's notes (Juan Lorenzo)
73 untested
74  
75 =cut
76  
77  
78 =head2 CHANGES and their DATES
79  
80 =cut
81  
82 use Moose;
83 our $VERSION = '0.0.1';
84  
85  
86 =head2 Import packages
87  
88 =cut
89  
90 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
91  
92 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
93 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
94  
95  
96 =head2 instantiation of packages
97  
98 =cut
99  
100 my $get = L_SU_global_constants->new();
101 my $Project = Project_config->new();
102 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
103 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
104 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
105  
106 my $PS_SEISMIC = $Project->PS_SEISMIC();
107  
108 my $var = $get->var();
109 my $on = $var->{_on};
110 my $off = $var->{_off};
111 my $true = $var->{_true};
112 my $false = $var->{_false};
113 my $empty_string = $var->{_empty_string};
114  
115 =head2 Encapsulated
116 hash of private variables
117  
118 =cut
119  
120 my $float2ibm = {
121 _endian => '',
122 _n => '',
123 _outpar => '',
124 _Step => '',
125 _note => '',
126  
127 };
128  
129 =head2 sub Step
130  
131 collects switches and assembles bash instructions
132 by adding the program name
133  
134 =cut
135  
136 sub Step {
137  
138 $float2ibm->{_Step} = 'float2ibm'.$float2ibm->{_Step};
139 return ( $float2ibm->{_Step} );
140  
141 }
142  
143  
144 =head2 sub note
145  
146 collects switches and assembles bash instructions
147 by adding the program name
148  
149 =cut
150  
151 sub note {
152  
153 $float2ibm->{_note} = 'float2ibm'.$float2ibm->{_note};
154 return ( $float2ibm->{_note} );
155  
156 }
157  
158  
159  
160 =head2 sub clear
161  
162 =cut
163  
164 sub clear {
165  
166 $float2ibm->{_endian} = '';
167 $float2ibm->{_n} = '';
168 $float2ibm->{_outpar} = '';
169 $float2ibm->{_Step} = '';
170 $float2ibm->{_note} = '';
171 }
172  
173  
174 =head2 sub endian
175  
176  
177 =cut
178  
179 sub endian {
180  
181 my ( $self,$endian ) = @_;
182 if ( $endian ne $empty_string ) {
183  
184 $float2ibm->{_endian} = $endian;
185 $float2ibm->{_note} = $float2ibm->{_note}.' endian='.$float2ibm->{_endian};
186 $float2ibm->{_Step} = $float2ibm->{_Step}.' endian='.$float2ibm->{_endian};
187  
188 } else {
189 print("float2ibm, endian, missing endian,\n");
190 }
191 }
192  
193  
194 =head2 sub n
195  
196  
197 =cut
198  
199 sub n {
200  
201 my ( $self,$n ) = @_;
202 if ( $n ne $empty_string ) {
203  
204 $float2ibm->{_n} = $n;
205 $float2ibm->{_note} = $float2ibm->{_note}.' n='.$float2ibm->{_n};
206 $float2ibm->{_Step} = $float2ibm->{_Step}.' n='.$float2ibm->{_n};
207  
208 } else {
209 print("float2ibm, n, missing n,\n");
210 }
211 }
212  
213  
214 =head2 sub outpar
215  
216  
217 =cut
218  
219 sub outpar {
220  
221 my ( $self,$outpar ) = @_;
222 if ( $outpar ne $empty_string ) {
223  
224 $float2ibm->{_outpar} = $outpar;
225 $float2ibm->{_note} = $float2ibm->{_note}.' outpar='.$float2ibm->{_outpar};
226 $float2ibm->{_Step} = $float2ibm->{_Step}.' outpar='.$float2ibm->{_outpar};
227  
228 } else {
229 print("float2ibm, outpar, missing outpar,\n");
230 }
231 }
232  
233  
234 =head2 sub get_max_index
235  
236 max index = number of input variables -1
237
238 =cut
239
240 sub get_max_index {
241 my ($self) = @_;
242 my $max_index = 2;
243  
244 return($max_index);
245 }
246
247
248 1;