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