lib/App/SeismicUnixGui/sunix/par/bhedtopar.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%
outpar
6.0
param
6.0
swap
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::par::bhedtopar;
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 BHEDTOPAR - convert a Binary tape HEaDer file to PAR file format
25  
26  
27  
28 bhedtopar < stdin outpar=parfile
29  
30  
31  
32 Required parameter:
33  
34 none
35  
36 Optional parameters:
37  
38 swap=0 =1 to swap bytes
39  
40 outpar=/dev/tty =parfile name of output param file
41  
42  
43  
44 Notes:
45  
46 This program dumps the contents of a SEGY binary tape header file, as
47  
48 would be produced by segyread and segyhdrs to a file in "parfile" format.
49  
50 A "parfile" is an ASCII file containing entries of the form param=value.
51  
52 Here "param" is the keyword for the binary tape header field and
53  
54 "value" is the value of that field. The parfile may be edited as
55  
56 any ASCII file. The edited parfile may then be made into a new binary tape
57  
58 header file via the program setbhed.
59  
60  
61  
62 See sudoc setbhed for examples
63  
64  
65  
66  
67  
68 Credits:
69  
70  
71  
72 CWP: John Stockwell 11 Nov 1994
73  
74  
75  
76 =head2 User's notes (Juan Lorenzo)
77 untested
78  
79 =cut
80  
81  
82 =head2 CHANGES and their DATES
83  
84 =cut
85  
86 use Moose;
87 our $VERSION = '0.0.1';
88  
89  
90 =head2 Import packages
91  
92 =cut
93  
94 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
95  
96 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
97 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
98  
99  
100 =head2 instantiation of packages
101  
102 =cut
103  
104 my $get = L_SU_global_constants->new();
105 my $Project = Project_config->new();
106 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
107 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
108 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
109  
110 my $PS_SEISMIC = $Project->PS_SEISMIC();
111  
112 my $var = $get->var();
113 my $on = $var->{_on};
114 my $off = $var->{_off};
115 my $true = $var->{_true};
116 my $false = $var->{_false};
117 my $empty_string = $var->{_empty_string};
118  
119 =head2 Encapsulated
120 hash of private variables
121  
122 =cut
123  
124 my $bhedtopar = {
125 _outpar => '',
126 _param => '',
127 _swap => '',
128 _Step => '',
129 _note => '',
130  
131 };
132  
133 =head2 sub Step
134  
135 collects switches and assembles bash instructions
136 by adding the program name
137  
138 =cut
139  
140 sub Step {
141  
142 $bhedtopar->{_Step} = 'bhedtopar'.$bhedtopar->{_Step};
143 return ( $bhedtopar->{_Step} );
144  
145 }
146  
147  
148 =head2 sub note
149  
150 collects switches and assembles bash instructions
151 by adding the program name
152  
153 =cut
154  
155 sub note {
156  
157 $bhedtopar->{_note} = 'bhedtopar'.$bhedtopar->{_note};
158 return ( $bhedtopar->{_note} );
159  
160 }
161  
162  
163  
164 =head2 sub clear
165  
166 =cut
167  
168 sub clear {
169  
170 $bhedtopar->{_outpar} = '';
171 $bhedtopar->{_param} = '';
172 $bhedtopar->{_swap} = '';
173 $bhedtopar->{_Step} = '';
174 $bhedtopar->{_note} = '';
175 }
176  
177  
178 =head2 sub outpar
179  
180  
181 =cut
182  
183 sub outpar {
184  
185 my ( $self,$outpar ) = @_;
186 if ( $outpar ne $empty_string ) {
187  
188 $bhedtopar->{_outpar} = $outpar;
189 $bhedtopar->{_note} = $bhedtopar->{_note}.' outpar='.$bhedtopar->{_outpar};
190 $bhedtopar->{_Step} = $bhedtopar->{_Step}.' outpar='.$bhedtopar->{_outpar};
191  
192 } else {
193 print("bhedtopar, outpar, missing outpar,\n");
194 }
195 }
196  
197  
198 =head2 sub param
199  
200  
201 =cut
202  
203 sub param {
204  
205 my ( $self,$param ) = @_;
206 if ( $param ne $empty_string ) {
207  
208 $bhedtopar->{_param} = $param;
209 $bhedtopar->{_note} = $bhedtopar->{_note}.' param='.$bhedtopar->{_param};
210 $bhedtopar->{_Step} = $bhedtopar->{_Step}.' param='.$bhedtopar->{_param};
211  
212 } else {
213 print("bhedtopar, param, missing param,\n");
214 }
215 }
216  
217  
218 =head2 sub swap
219  
220  
221 =cut
222  
223 sub swap {
224  
225 my ( $self,$swap ) = @_;
226 if ( $swap ne $empty_string ) {
227  
228 $bhedtopar->{_swap} = $swap;
229 $bhedtopar->{_note} = $bhedtopar->{_note}.' swap='.$bhedtopar->{_swap};
230 $bhedtopar->{_Step} = $bhedtopar->{_Step}.' swap='.$bhedtopar->{_swap};
231  
232 } else {
233 print("bhedtopar, swap, missing swap,\n");
234 }
235 }
236  
237  
238 =head2 sub get_max_index
239  
240 max index = number of input variables -1
241
242 =cut
243
244 sub get_max_index {
245 my ($self) = @_;
246 my $max_index = 2;
247  
248 return($max_index);
249 }
250
251
252 1;