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

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 69 CC 3 SCAR 12.0
CC
3
Cov
0%
key
6.0
verbose
6.0
Step
2.0
CRAP 3.3
1 package App::SeismicUnixGui::sunix::header::sucountkey;
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 SUCOUNTKEY - COUNT the number of unique values for a given KEYword.
25  
26  
27  
28 sucountkey < input.su key=[sx,gx,cdp,...]
29  
30 Required parameter:
31  
32 key= array of SU header keywords being counted
33  
34 Optional parameters:
35  
36 verbose=1 chatty, =0 just print keyword number
37  
38 Example:
39  
40 suplane | sucountkey key=tracl,tracr,offset
41  
42  
43  
44  
45  
46  
47  
48 Credits: Baoniu Han, bhan@mines.edu, Nov, 2000
49  
50  
51  
52 =head2 User's notes (Juan Lorenzo)
53 untested
54  
55 =cut
56  
57  
58 =head2 CHANGES and their DATES
59  
60 =cut
61  
62 use Moose;
63 our $VERSION = '0.0.1';
64  
65  
66 =head2 Import packages
67  
68 =cut
69  
70 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
71  
72 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
73 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
74  
75  
76 =head2 instantiation of packages
77  
78 =cut
79  
80 my $get = L_SU_global_constants->new();
81 my $Project = Project_config->new();
82 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
83 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
84 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
85  
86 my $PS_SEISMIC = $Project->PS_SEISMIC();
87  
88 my $var = $get->var();
89 my $on = $var->{_on};
90 my $off = $var->{_off};
91 my $true = $var->{_true};
92 my $false = $var->{_false};
93 my $empty_string = $var->{_empty_string};
94  
95 =head2 Encapsulated
96 hash of private variables
97  
98 =cut
99  
100 my $sucountkey = {
101 _key => '',
102 _verbose => '',
103 _Step => '',
104 _note => '',
105  
106 };
107  
108 =head2 sub Step
109  
110 collects switches and assembles bash instructions
111 by adding the program name
112  
113 =cut
114  
115 sub Step {
116  
117 $sucountkey->{_Step} = 'sucountkey'.$sucountkey->{_Step};
118 return ( $sucountkey->{_Step} );
119  
120 }
121  
122  
123 =head2 sub note
124  
125 collects switches and assembles bash instructions
126 by adding the program name
127  
128 =cut
129  
130 sub note {
131  
132 $sucountkey->{_note} = 'sucountkey'.$sucountkey->{_note};
133 return ( $sucountkey->{_note} );
134  
135 }
136  
137  
138  
139 =head2 sub clear
140  
141 =cut
142  
143 sub clear {
144  
145 $sucountkey->{_key} = '';
146 $sucountkey->{_verbose} = '';
147 $sucountkey->{_Step} = '';
148 $sucountkey->{_note} = '';
149 }
150  
151  
152 =head2 sub key
153  
154  
155 =cut
156  
157 sub key {
158  
159 my ( $self,$key ) = @_;
160 if ( $key ne $empty_string ) {
161  
162 $sucountkey->{_key} = $key;
163 $sucountkey->{_note} = $sucountkey->{_note}.' key='.$sucountkey->{_key};
164 $sucountkey->{_Step} = $sucountkey->{_Step}.' key='.$sucountkey->{_key};
165  
166 } else {
167 print("sucountkey, key, missing key,\n");
168 }
169 }
170  
171  
172 =head2 sub verbose
173  
174  
175 =cut
176  
177 sub verbose {
178  
179 my ( $self,$verbose ) = @_;
180 if ( $verbose ne $empty_string ) {
181  
182 $sucountkey->{_verbose} = $verbose;
183 $sucountkey->{_note} = $sucountkey->{_note}.' verbose='.$sucountkey->{_verbose};
184 $sucountkey->{_Step} = $sucountkey->{_Step}.' verbose='.$sucountkey->{_verbose};
185  
186 } else {
187 print("sucountkey, verbose, missing verbose,\n");
188 }
189 }
190  
191  
192 =head2 sub get_max_index
193  
194 max index = number of input variables -1
195
196 =cut
197
198 sub get_max_index {
199 my ($self) = @_;
200 my $max_index = 1;
201  
202 return($max_index);
203 }
204
205
206 1;