lib/App/SeismicUnixGui/sunix/plot/suxpicker.pm untested

filter: Statementstmt 0.0% 0 / 91 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 135 CC 9 SCAR 15.4
CC
9
Cov
0%
d1
6.0
d2
6.0
f1
6.0
CRAP 4.7
1 package App::SeismicUnixGui::sunix::plot::suxpicker;
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 SUXPICKER - X-windows WIGgle plot PICKER of a segy data set
25  
26  
27  
28 suxpicker <stdin [optional parameters] | ...
29  
30  
31  
32 Optional parameters:
33  
34  
35  
36 key=(keyword) if set, the values of x2 are set from header field
37  
38 specified by keyword
39  
40 specified by keyword
41  
42 n2=tr.ntr or number of traces in the data set (ntr is an alias for n2)
43  
44  
45  
46 d1=tr.d1 or tr.dt/10^6 sampling interval in the fast dimension
47  
48 =.004 for seismic (if not set)
49  
50 =1.0 for nonseismic (if not set)
51  
52  
53  
54 d2=tr.d2 sampling interval in the slow dimension
55  
56 =1.0 (if not set)
57  
58  
59  
60 f1=tr.f1 or tr.delrt/10^3 or 0.0 first sample in the fast dimension
61  
62  
63  
64 f2=tr.f2 or tr.tracr or tr.tracl first sample in the slow dimension
65  
66 =1.0 for seismic (if not set)
67  
68 =d2 for nonseismic (if not set)
69  
70  
71  
72 verbose=0 =1 to print some useful information
73  
74  
75  
76  
77  
78 tmpdir= if non-empty, use the value as a directory path
79  
80 prefix for storing temporary files; else if the
81  
82 the CWP_TMPDIR environment variable is set use
83  
84 its value for the path; else use tmpfile()
85  
86  
87  
88 Note that for seismic time domain data, the "fast dimension" is
89  
90 time and the "slow dimension" is usually trace number or range.
91  
92 Also note that "foreign" data tapes may have something unexpected
93  
94 in the d2,f2 fields, use segyclean to clear these if you can afford
95  
96 the processing time or use d2= f2= to override the header values if
97  
98 not.
99  
100  
101  
102 If key=keyword is set, then the values of x2 are taken from the header
103  
104 field represented by the keyword (for example key=offset, will show
105  
106 traces in true offset). This permit unequally spaced traces to be plotted.
107  
108 Type sukeyword -o to see the complete list of SU keywords.
109  
110  
111  
112 See the xpicker selfdoc for the remaining parameters.
113  
114  
115  
116  
117  
118 Credits:
119  
120  
121  
122 CWP: Dave Hale and Zhiming Li (xpicker, etc.)
123  
124 Jack Cohen and John Stockwell (suxpicker, etc.)
125  
126  
127  
128 Notes:
129  
130 When the number of traces isn't known, we need to count
131  
132 the traces for xpicker. You can make this value "known"
133  
134 either by getparring n2 or by having the ntr field set
135  
136 in the trace header. A getparred value takes precedence
137  
138 over the value in the trace header.
139  
140  
141  
142 When we do have to count the traces, we use the "tmpfile"
143  
144 routine because on many machines it is implemented
145  
146 as a memory area instead of a disk file.
147  
148  
149  
150 If your system does make a disk file, consider altering
151  
152 the code to remove the file on interrupt. This could be
153  
154 done either by trapping the interrupt with "signal"
155  
156 or by using the "tmpnam" routine followed by an immediate
157  
158 "remove" (aka "unlink" in old unix).
159  
160  
161  
162 When we must compute ntr, we don't allocate a 2-d array,
163  
164 but just content ourselves with copying trace by trace from
165  
166 the data "file" to the pipe into the plotting program.
167  
168 Although we could use tr.data, we allocate a trace buffer
169  
170 for code clarity.
171  
172  
173  
174 =head2 User's notes (Juan Lorenzo)
175 untested
176  
177 =cut
178  
179  
180 =head2 CHANGES and their DATES
181  
182 =cut
183  
184 use Moose;
185 our $VERSION = '0.0.1';
186  
187  
188 =head2 Import packages
189  
190 =cut
191  
192 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
193  
194 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
195 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
196  
197  
198 =head2 instantiation of packages
199  
200 =cut
201  
202 my $get = L_SU_global_constants->new();
203 my $Project = Project_config->new();
204 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
205 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
206 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
207  
208 my $PS_SEISMIC = $Project->PS_SEISMIC();
209  
210 my $var = $get->var();
211 my $on = $var->{_on};
212 my $off = $var->{_off};
213 my $true = $var->{_true};
214 my $false = $var->{_false};
215 my $empty_string = $var->{_empty_string};
216  
217 =head2 Encapsulated
218 hash of private variables
219  
220 =cut
221  
222 my $suxpicker = {
223 _d1 => '',
224 _d2 => '',
225 _f1 => '',
226 _f2 => '',
227 _key => '',
228 _n2 => '',
229 _tmpdir => '',
230 _verbose => '',
231 _Step => '',
232 _note => '',
233  
234 };
235  
236 =head2 sub Step
237  
238 collects switches and assembles bash instructions
239 by adding the program name
240  
241 =cut
242  
243 sub Step {
244  
245 $suxpicker->{_Step} = 'suxpicker'.$suxpicker->{_Step};
246 return ( $suxpicker->{_Step} );
247  
248 }
249  
250  
251 =head2 sub note
252  
253 collects switches and assembles bash instructions
254 by adding the program name
255  
256 =cut
257  
258 sub note {
259  
260 $suxpicker->{_note} = 'suxpicker'.$suxpicker->{_note};
261 return ( $suxpicker->{_note} );
262  
263 }
264  
265  
266  
267 =head2 sub clear
268  
269 =cut
270  
271 sub clear {
272  
273 $suxpicker->{_d1} = '';
274 $suxpicker->{_d2} = '';
275 $suxpicker->{_f1} = '';
276 $suxpicker->{_f2} = '';
277 $suxpicker->{_key} = '';
278 $suxpicker->{_n2} = '';
279 $suxpicker->{_tmpdir} = '';
280 $suxpicker->{_verbose} = '';
281 $suxpicker->{_Step} = '';
282 $suxpicker->{_note} = '';
283 }
284  
285  
286 =head2 sub d1
287  
288  
289 =cut
290  
291 sub d1 {
292  
293 my ( $self,$d1 ) = @_;
294 if ( $d1 ne $empty_string ) {
295  
296 $suxpicker->{_d1} = $d1;
297 $suxpicker->{_note} = $suxpicker->{_note}.' d1='.$suxpicker->{_d1};
298 $suxpicker->{_Step} = $suxpicker->{_Step}.' d1='.$suxpicker->{_d1};
299  
300 } else {
301 print("suxpicker, d1, missing d1,\n");
302 }
303 }
304  
305  
306 =head2 sub d2
307  
308  
309 =cut
310  
311 sub d2 {
312  
313 my ( $self,$d2 ) = @_;
314 if ( $d2 ne $empty_string ) {
315  
316 $suxpicker->{_d2} = $d2;
317 $suxpicker->{_note} = $suxpicker->{_note}.' d2='.$suxpicker->{_d2};
318 $suxpicker->{_Step} = $suxpicker->{_Step}.' d2='.$suxpicker->{_d2};
319  
320 } else {
321 print("suxpicker, d2, missing d2,\n");
322 }
323 }
324  
325  
326 =head2 sub f1
327  
328  
329 =cut
330  
331 sub f1 {
332  
333 my ( $self,$f1 ) = @_;
334 if ( $f1 ne $empty_string ) {
335  
336 $suxpicker->{_f1} = $f1;
337 $suxpicker->{_note} = $suxpicker->{_note}.' f1='.$suxpicker->{_f1};
338 $suxpicker->{_Step} = $suxpicker->{_Step}.' f1='.$suxpicker->{_f1};
339  
340 } else {
341 print("suxpicker, f1, missing f1,\n");
342 }
343 }
344  
345  
346 =head2 sub f2
347  
348  
349 =cut
350  
351 sub f2 {
352  
353 my ( $self,$f2 ) = @_;
354 if ( $f2 ne $empty_string ) {
355  
356 $suxpicker->{_f2} = $f2;
357 $suxpicker->{_note} = $suxpicker->{_note}.' f2='.$suxpicker->{_f2};
358 $suxpicker->{_Step} = $suxpicker->{_Step}.' f2='.$suxpicker->{_f2};
359  
360 } else {
361 print("suxpicker, f2, missing f2,\n");
362 }
363 }
364  
365  
366 =head2 sub key
367  
368  
369 =cut
370  
371 sub key {
372  
373 my ( $self,$key ) = @_;
374 if ( $key ne $empty_string ) {
375  
376 $suxpicker->{_key} = $key;
377 $suxpicker->{_note} = $suxpicker->{_note}.' key='.$suxpicker->{_key};
378 $suxpicker->{_Step} = $suxpicker->{_Step}.' key='.$suxpicker->{_key};
379  
380 } else {
381 print("suxpicker, key, missing key,\n");
382 }
383 }
384  
385  
386 =head2 sub n2
387  
388  
389 =cut
390  
391 sub n2 {
392  
393 my ( $self,$n2 ) = @_;
394 if ( $n2 ne $empty_string ) {
395  
396 $suxpicker->{_n2} = $n2;
397 $suxpicker->{_note} = $suxpicker->{_note}.' n2='.$suxpicker->{_n2};
398 $suxpicker->{_Step} = $suxpicker->{_Step}.' n2='.$suxpicker->{_n2};
399  
400 } else {
401 print("suxpicker, n2, missing n2,\n");
402 }
403 }
404  
405  
406 =head2 sub tmpdir
407  
408  
409 =cut
410  
411 sub tmpdir {
412  
413 my ( $self,$tmpdir ) = @_;
414 if ( $tmpdir ne $empty_string ) {
415  
416 $suxpicker->{_tmpdir} = $tmpdir;
417 $suxpicker->{_note} = $suxpicker->{_note}.' tmpdir='.$suxpicker->{_tmpdir};
418 $suxpicker->{_Step} = $suxpicker->{_Step}.' tmpdir='.$suxpicker->{_tmpdir};
419  
420 } else {
421 print("suxpicker, tmpdir, missing tmpdir,\n");
422 }
423 }
424  
425  
426 =head2 sub verbose
427  
428  
429 =cut
430  
431 sub verbose {
432  
433 my ( $self,$verbose ) = @_;
434 if ( $verbose ne $empty_string ) {
435  
436 $suxpicker->{_verbose} = $verbose;
437 $suxpicker->{_note} = $suxpicker->{_note}.' verbose='.$suxpicker->{_verbose};
438 $suxpicker->{_Step} = $suxpicker->{_Step}.' verbose='.$suxpicker->{_verbose};
439  
440 } else {
441 print("suxpicker, verbose, missing verbose,\n");
442 }
443 }
444  
445  
446 =head2 sub get_max_index
447  
448 max index = number of input variables -1
449
450 =cut
451
452 sub get_max_index {
453 my ($self) = @_;
454 my $max_index = 7;
455  
456 return($max_index);
457 }
458
459
460 1;