lib/App/SeismicUnixGui/sunix/shapeNcut/supad.pm untested

filter: Statementstmt 0.0% 0 / 84 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 124 CC 8 SCAR 15.1
CC
8
Cov
0%
d
6.0
key1
6.0
key2
6.0
CRAP 4.5
1 package App::SeismicUnixGui::sunix::shapeNcut::supad;
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 SUPAD - Pad zero traces
25  
26  
27  
28 supad <stdin >stdout min= max= [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 min= trace key start
35  
36 max= trace key end
37  
38  
39  
40 Optional parameters:
41  
42 key1=ep panel key
43  
44 key2=tracf trace key
45  
46 key3=trid flag key
47  
48 val3=2 value assigned to padded traces
49  
50 d=1 trace key spacing
51  
52  
53  
54 Notes:
55  
56 In contrast to most SU codes, supad recognizes panels, or ensembles.
57  
58 If the input consists of several panels, each panel will be padded
59  
60 individually.
61  
62 key1 and key2 are the primary and secondary sort key of the data set.
63  
64 The sort order of key1 does not matter at all.
65  
66 The sort order of key2 must be monotonous - if key2 is descending,
67  
68 supply a negative value for the spacing d.
69  
70 Traces with a key2-value outside the min/max range will be lost.
71  
72 Traces with a key2-value that is not a multiple of the spacing from
73  
74 the min-value (the max-value, if the spacing is negative) will
75  
76 not be lost. Instead, they will shift the series of key2-values.
77  
78 By default the dead trace flag will be raised for the padded traces.
79  
80 This should make it easy to remove the zero traces later on, if need be.
81  
82  
83  
84 Examples:
85  
86 suplane | supad min=1 max=40 key1=offset key2=tracr | ...
87  
88 ... appends eight empty traces.
89  
90  
91  
92 suplane | supad min=1 max=32 key1=offset key2=tracr d=0.5 | ...
93  
94 ... inserts a zero trace after each trace (even though the
95  
96 header tracr is integer and cannot properly store the floats)
97  
98  
99  
100 suplane | supad min=1 max=32 | ...
101  
102 ... produces an error because the panel and trace key are all 0.
103  
104  
105  
106  
107  
108 Credits:
109  
110 Florian Bleibinhaus, U Salzburg, Austria
111  
112  
113  
114 =head2 User's notes (Juan Lorenzo)
115 untested
116  
117 =cut
118  
119  
120 =head2 CHANGES and their DATES
121  
122 =cut
123  
124 use Moose;
125 our $VERSION = '0.0.1';
126  
127  
128 =head2 Import packages
129  
130 =cut
131  
132 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
133  
134 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
135 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
136  
137  
138 =head2 instantiation of packages
139  
140 =cut
141  
142 my $get = L_SU_global_constants->new();
143 my $Project = Project_config->new();
144 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
145 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
146 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
147  
148 my $PS_SEISMIC = $Project->PS_SEISMIC();
149  
150 my $var = $get->var();
151 my $on = $var->{_on};
152 my $off = $var->{_off};
153 my $true = $var->{_true};
154 my $false = $var->{_false};
155 my $empty_string = $var->{_empty_string};
156  
157 =head2 Encapsulated
158 hash of private variables
159  
160 =cut
161  
162 my $supad = {
163 _d => '',
164 _key1 => '',
165 _key2 => '',
166 _key3 => '',
167 _max => '',
168 _min => '',
169 _val3 => '',
170 _Step => '',
171 _note => '',
172  
173 };
174  
175 =head2 sub Step
176  
177 collects switches and assembles bash instructions
178 by adding the program name
179  
180 =cut
181  
182 sub Step {
183  
184 $supad->{_Step} = 'supad'.$supad->{_Step};
185 return ( $supad->{_Step} );
186  
187 }
188  
189  
190 =head2 sub note
191  
192 collects switches and assembles bash instructions
193 by adding the program name
194  
195 =cut
196  
197 sub note {
198  
199 $supad->{_note} = 'supad'.$supad->{_note};
200 return ( $supad->{_note} );
201  
202 }
203  
204  
205  
206 =head2 sub clear
207  
208 =cut
209  
210 sub clear {
211  
212 $supad->{_d} = '';
213 $supad->{_key1} = '';
214 $supad->{_key2} = '';
215 $supad->{_key3} = '';
216 $supad->{_max} = '';
217 $supad->{_min} = '';
218 $supad->{_val3} = '';
219 $supad->{_Step} = '';
220 $supad->{_note} = '';
221 }
222  
223  
224 =head2 sub d
225  
226  
227 =cut
228  
229 sub d {
230  
231 my ( $self,$d ) = @_;
232 if ( $d ne $empty_string ) {
233  
234 $supad->{_d} = $d;
235 $supad->{_note} = $supad->{_note}.' d='.$supad->{_d};
236 $supad->{_Step} = $supad->{_Step}.' d='.$supad->{_d};
237  
238 } else {
239 print("supad, d, missing d,\n");
240 }
241 }
242  
243  
244 =head2 sub key1
245  
246  
247 =cut
248  
249 sub key1 {
250  
251 my ( $self,$key1 ) = @_;
252 if ( $key1 ne $empty_string ) {
253  
254 $supad->{_key1} = $key1;
255 $supad->{_note} = $supad->{_note}.' key1='.$supad->{_key1};
256 $supad->{_Step} = $supad->{_Step}.' key1='.$supad->{_key1};
257  
258 } else {
259 print("supad, key1, missing key1,\n");
260 }
261 }
262  
263  
264 =head2 sub key2
265  
266  
267 =cut
268  
269 sub key2 {
270  
271 my ( $self,$key2 ) = @_;
272 if ( $key2 ne $empty_string ) {
273  
274 $supad->{_key2} = $key2;
275 $supad->{_note} = $supad->{_note}.' key2='.$supad->{_key2};
276 $supad->{_Step} = $supad->{_Step}.' key2='.$supad->{_key2};
277  
278 } else {
279 print("supad, key2, missing key2,\n");
280 }
281 }
282  
283  
284 =head2 sub key3
285  
286  
287 =cut
288  
289 sub key3 {
290  
291 my ( $self,$key3 ) = @_;
292 if ( $key3 ne $empty_string ) {
293  
294 $supad->{_key3} = $key3;
295 $supad->{_note} = $supad->{_note}.' key3='.$supad->{_key3};
296 $supad->{_Step} = $supad->{_Step}.' key3='.$supad->{_key3};
297  
298 } else {
299 print("supad, key3, missing key3,\n");
300 }
301 }
302  
303  
304 =head2 sub max
305  
306  
307 =cut
308  
309 sub max {
310  
311 my ( $self,$max ) = @_;
312 if ( $max ne $empty_string ) {
313  
314 $supad->{_max} = $max;
315 $supad->{_note} = $supad->{_note}.' max='.$supad->{_max};
316 $supad->{_Step} = $supad->{_Step}.' max='.$supad->{_max};
317  
318 } else {
319 print("supad, max, missing max,\n");
320 }
321 }
322  
323  
324 =head2 sub min
325  
326  
327 =cut
328  
329 sub min {
330  
331 my ( $self,$min ) = @_;
332 if ( $min ne $empty_string ) {
333  
334 $supad->{_min} = $min;
335 $supad->{_note} = $supad->{_note}.' min='.$supad->{_min};
336 $supad->{_Step} = $supad->{_Step}.' min='.$supad->{_min};
337  
338 } else {
339 print("supad, min, missing min,\n");
340 }
341 }
342  
343  
344 =head2 sub val3
345  
346  
347 =cut
348  
349 sub val3 {
350  
351 my ( $self,$val3 ) = @_;
352 if ( $val3 ne $empty_string ) {
353  
354 $supad->{_val3} = $val3;
355 $supad->{_note} = $supad->{_note}.' val3='.$supad->{_val3};
356 $supad->{_Step} = $supad->{_Step}.' val3='.$supad->{_val3};
357  
358 } else {
359 print("supad, val3, missing val3,\n");
360 }
361 }
362  
363  
364 =head2 sub get_max_index
365  
366 max index = number of input variables -1
367
368 =cut
369
370 sub get_max_index {
371 my ($self) = @_;
372 my $max_index = 6;
373  
374 return($max_index);
375 }
376
377
378 1;