lib/App/SeismicUnixGui/sunix/header/sugethw.pm untested

filter: Statementstmt 0.0% 0 / 55 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 85 CC 6 SCAR 15.0
CC
6
Cov
0%
header_word
6.0
infile
6.0
key
6.0
CRAP 4.5
1 package App::SeismicUnixGui::sunix::header::sugethw;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUGETHW - sugethw writes the values of the selected key words
8 AUTHOR: Juan Lorenzo (Perl module only)
9 DATE:
10 DESCRIPTION:
11 Version:
12  
13 =head2 USE
14  
15 =head3 NOTES
16  
17 =head4 Examples
18  
19 =head3 SEISMIC UNIX NOTES
20  
21 SUGETHW - sugethw writes the values of the selected key words
22  
23 sugethw key=key1,... [output=] <infile [>outfile]
24  
25 Required parameters:
26 key=key1,... At least one key word.
27  
28 Optional parameters:
29 output=ascii output written as ascii for display
30 =binary for output as binary floats
31 =geom ascii output for geometry setting
32 verbose=0 quiet
33 =1 chatty
34  
35 Output is written in the order of the keys on the command
36 line for each trace in the data set.
37  
38 Example:
39 sugethw <stdin key=sx,gx
40 writes sx, gx values as ascii trace by trace to the terminal.
41  
42 Comment:
43 Users wishing to edit one or more header field (as in geometry setting)
44 may do this via the following sequence:
45 sugethw < sudata output=geom key=key1,key2,... > hdrfile
46 Now edit the ASCII file hdrfile with any editor, setting the fields
47 appropriately. Convert hdrfile to a binary format via:
48 a2b < hdrfile n1=nfields > binary_file
49 Then set the header fields via:
50 sushw < sudata infile=binary_file key=key1,key2,... > sudata.edited
51  
52  
53 Credits:
54  
55 SEP: Shuki Ronen
56 CWP: Jack K. Cohen
57 CWP: John Stockwell, added geom stuff, and getparstringarray
58  
59 =head2 CHANGES and their DATES
60  
61 =cut
62  
63 use Moose;
64 our $VERSION = '0.0.1';
65  
66 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
67  
68 my $sugethw = {
69 _key => '',
70 _verbose => '',
71 _Step => '',
72 _note => '',
73 };
74  
75 my $get = L_SU_global_constants->new();
76  
77 my $var = $get->var();
78 my $empty_string = $var->{_empty_string};
79  
80 =head2 sub Step
81  
82 collects switches and assembles bash instructions
83 by adding the program name
84  
85 =cut
86  
87 sub Step {
88  
89 $sugethw->{_Step} = 'sugethw' . $sugethw->{_Step};
90 return ( $sugethw->{_Step} );
91  
92 }
93  
94 =head2 sub note
95  
96 collects switches and assembles bash instructions
97 by adding the program name
98  
99 =cut
100  
101 sub note {
102  
103 $sugethw->{_note} = 'sugethw' . $sugethw->{_note};
104 return ( $sugethw->{_note} );
105  
106 }
107  
108 =head2 sub clear
109  
110 =cut
111  
112 sub clear {
113  
114 $sugethw->{_infile} = '';
115 $sugethw->{_key} = '';
116 $sugethw->{_n1} = '';
117 $sugethw->{_output} = '';
118 $sugethw->{_verbose} = '';
119 $sugethw->{_Step} = '';
120 $sugethw->{_note} = '';
121 }
122  
123 =head2 sub header_word
124  
125  
126 =cut
127  
128 sub header_word {
129  
130 my ( $self, $key ) = @_;
131 if ( $key ne $empty_string ) {
132  
133 $sugethw->{_key} = $key;
134 $sugethw->{_note} = $sugethw->{_note} . ' key=' . $sugethw->{_key};
135 $sugethw->{_Step} = $sugethw->{_Step} . ' key=' . $sugethw->{_key};
136  
137 }
138 else {
139 print("sugethw, header_word, missing header_word,\n");
140 }
141 }
142  
143 =head2 sub infile
144  
145  
146 =cut
147  
148 sub infile {
149  
150 my ( $self, $infile ) = @_;
151 if ( $infile ne $empty_string ) {
152  
153 $sugethw->{_infile} = $infile;
154 $sugethw->{_note} =
155 $sugethw->{_note} . ' infile=' . $sugethw->{_infile};
156 $sugethw->{_Step} =
157 $sugethw->{_Step} . ' infile=' . $sugethw->{_infile};
158  
159 }
160 else {
161 print("sugethw, infile, missing infile,\n");
162 }
163 }
164  
165 =head2 sub key
166  
167  
168 =cut
169  
170 sub key {
171  
172 my ( $self, $key ) = @_;
173 if ( $key ne $empty_string ) {
174  
175 $sugethw->{_key} = $key;
176 $sugethw->{_note} = $sugethw->{_note} . ' key=' . $sugethw->{_key};
177 $sugethw->{_Step} = $sugethw->{_Step} . ' key=' . $sugethw->{_key};
178  
179 }
180 else {
181 print("sugethw, key, missing key,\n");
182 }
183 }
184  
185 =head2 sub output
186  
187  
188 =cut
189  
190 sub output {
191  
192 my ( $self, $output ) = @_;
193 if ( $output ne $empty_string ) {
194  
195 $sugethw->{_output} = $output;
196 $sugethw->{_note} =
197 $sugethw->{_note} . ' output=' . $sugethw->{_output};
198 $sugethw->{_Step} =
199 $sugethw->{_Step} . ' output=' . $sugethw->{_output};
200  
201 }
202 else {
203 print("sugethw, output, missing output,\n");
204 }
205 }
206  
207 =head2 sub verbose
208  
209  
210 =cut
211  
212 sub verbose {
213  
214 my ( $self, $verbose ) = @_;
215 if ( $verbose ne $empty_string ) {
216  
217 $sugethw->{_verbose} = $verbose;
218 $sugethw->{_note} =
219 $sugethw->{_note} . ' verbose=' . $sugethw->{_verbose};
220 $sugethw->{_Step} =
221 $sugethw->{_Step} . ' verbose=' . $sugethw->{_verbose};
222  
223 }
224 else {
225 print("sugethw, verbose, missing verbose,\n");
226 }
227 }
228  
229 =head2 sub get_max_index
230
231 max index = number of input variables -1
232
233 =cut
234  
235 sub get_max_index {
236 my ($self) = @_;
237 my $max_index = 2;
238  
239 return ($max_index);
240 }
241  
242 1;