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

filter: Statementstmt 0.0% 0 / 63 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 91 CC 5 SCAR 13.9
CC
5
Cov
0%
a
6.0
b
6.0
key1
6.0
CRAP 4.0
1 package App::SeismicUnixGui::sunix::header::susehw;
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 SUSEHW - Set the value the Header Word denoting trace number within
25  
26 an Ensemble defined by the value of another header word
27  
28  
29  
30 susehw <stdin >stdout [options]
31  
32  
33  
34 Required Parameters:
35  
36 none
37  
38  
39  
40 Optional Parameters:
41  
42 key1=cdp Key header word defining the ensemble
43  
44 key2=cdpt Key header word defining the count within the ensemble
45  
46 a=1 starting value of the count in the ensemble
47  
48 b=1 increment or decrement within the ensemble
49  
50  
51  
52 Notes:
53  
54 This code was written because suresstat requires cdpt to be set.
55  
56 The computation is
57  
58 val(key2) = a + b*i
59  
60  
61  
62 The input data must first be sorted into constant key1 gathers.
63  
64 Example: setting the cdpt field ",
65  
66 susetehw < cdpgathers.su a=1 b=1 key1=cdp key2=cdpt > new.su
67  
68  
69  
70  
71  
72 Credits:
73  
74 CWP: John Stockwell (Feb 2008) in answer to a question by Warren Franz
75  
76 based on various codes, including susplit, susshw, suchw
77  
78  
79  
80 =head2 User's notes (Juan Lorenzo)
81 untested
82  
83 =cut
84  
85  
86 =head2 CHANGES and their DATES
87  
88 =cut
89  
90 use Moose;
91 our $VERSION = '0.0.1';
92  
93  
94 =head2 Import packages
95  
96 =cut
97  
98 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
99  
100 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
101 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
102  
103  
104 =head2 instantiation of packages
105  
106 =cut
107  
108 my $get = L_SU_global_constants->new();
109 my $Project = Project_config->new();
110 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
111 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
112 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
113  
114 my $PS_SEISMIC = $Project->PS_SEISMIC();
115  
116 my $var = $get->var();
117 my $on = $var->{_on};
118 my $off = $var->{_off};
119 my $true = $var->{_true};
120 my $false = $var->{_false};
121 my $empty_string = $var->{_empty_string};
122  
123 =head2 Encapsulated
124 hash of private variables
125  
126 =cut
127  
128 my $susehw = {
129 _a => '',
130 _b => '',
131 _key1 => '',
132 _key2 => '',
133 _Step => '',
134 _note => '',
135  
136 };
137  
138 =head2 sub Step
139  
140 collects switches and assembles bash instructions
141 by adding the program name
142  
143 =cut
144  
145 sub Step {
146  
147 $susehw->{_Step} = 'susehw'.$susehw->{_Step};
148 return ( $susehw->{_Step} );
149  
150 }
151  
152  
153 =head2 sub note
154  
155 collects switches and assembles bash instructions
156 by adding the program name
157  
158 =cut
159  
160 sub note {
161  
162 $susehw->{_note} = 'susehw'.$susehw->{_note};
163 return ( $susehw->{_note} );
164  
165 }
166  
167  
168  
169 =head2 sub clear
170  
171 =cut
172  
173 sub clear {
174  
175 $susehw->{_a} = '';
176 $susehw->{_b} = '';
177 $susehw->{_key1} = '';
178 $susehw->{_key2} = '';
179 $susehw->{_Step} = '';
180 $susehw->{_note} = '';
181 }
182  
183  
184 =head2 sub a
185  
186  
187 =cut
188  
189 sub a {
190  
191 my ( $self,$a ) = @_;
192 if ( $a ne $empty_string ) {
193  
194 $susehw->{_a} = $a;
195 $susehw->{_note} = $susehw->{_note}.' a='.$susehw->{_a};
196 $susehw->{_Step} = $susehw->{_Step}.' a='.$susehw->{_a};
197  
198 } else {
199 print("susehw, a, missing a,\n");
200 }
201 }
202  
203  
204 =head2 sub b
205  
206  
207 =cut
208  
209 sub b {
210  
211 my ( $self,$b ) = @_;
212 if ( $b ne $empty_string ) {
213  
214 $susehw->{_b} = $b;
215 $susehw->{_note} = $susehw->{_note}.' b='.$susehw->{_b};
216 $susehw->{_Step} = $susehw->{_Step}.' b='.$susehw->{_b};
217  
218 } else {
219 print("susehw, b, missing b,\n");
220 }
221 }
222  
223  
224 =head2 sub key1
225  
226  
227 =cut
228  
229 sub key1 {
230  
231 my ( $self,$key1 ) = @_;
232 if ( $key1 ne $empty_string ) {
233  
234 $susehw->{_key1} = $key1;
235 $susehw->{_note} = $susehw->{_note}.' key1='.$susehw->{_key1};
236 $susehw->{_Step} = $susehw->{_Step}.' key1='.$susehw->{_key1};
237  
238 } else {
239 print("susehw, key1, missing key1,\n");
240 }
241 }
242  
243  
244 =head2 sub key2
245  
246  
247 =cut
248  
249 sub key2 {
250  
251 my ( $self,$key2 ) = @_;
252 if ( $key2 ne $empty_string ) {
253  
254 $susehw->{_key2} = $key2;
255 $susehw->{_note} = $susehw->{_note}.' key2='.$susehw->{_key2};
256 $susehw->{_Step} = $susehw->{_Step}.' key2='.$susehw->{_key2};
257  
258 } else {
259 print("susehw, key2, missing key2,\n");
260 }
261 }
262  
263  
264 =head2 sub get_max_index
265  
266 max index = number of input variables -1
267
268 =cut
269
270 sub get_max_index {
271 my ($self) = @_;
272 my $max_index = 3;
273  
274 return($max_index);
275 }
276
277
278 1;