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

filter: Statementstmt 0.0% 0 / 98 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 146 CC 10 SCAR 15.6
CC
10
Cov
0%
bfile
6.0
dt
6.0
format
6.0
CRAP 4.8
1 package App::SeismicUnixGui::sunix::header::segyhdrs;
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 SEGYHDRS - make SEG-Y ascii and binary headers for segywrite
25  
26  
27  
28 segyhdrs [ < sudata ] [optional parameters] [ > copy of sudata ]
29  
30  
31  
32 Required parameters:
33  
34 ns= if no input trace header
35  
36 dt= if no input trace header
37  
38 Optional parameters:
39  
40 ns=tr.ns from header number of samples on input traces
41  
42 dt=tr.dt from header sample rate (microseconds) from traces
43  
44 bfile=binary name of file containing binary block
45  
46 hfile=header name of file containing ascii block
47  
48 Some binary header fields are set:
49  
50 jobid=1 job id field
51  
52 lino=1 line number (only one line per reel)
53  
54 reno=1 reel number
55  
56 format=1 data format
57  
58  
59  
60 All other fields are set to 0, by default.
61  
62 To set any binary header field, use sukeyword to find out
63  
64 the appropriate keyword, then use the getpar form:
65  
66 keyword=value to set keyword to value
67  
68  
69  
70 The header file is created as ascii and is translated to ebcdic
71  
72 by segywrite before being written to tape. Its contents are
73  
74 formal but can be edited after creation as long as the forty
75  
76 line format is maintained.
77  
78  
79  
80 Caveat: This program has not been tested under XDR for machines
81  
82 not having a 2 byte unsigned short integral data type.
83  
84  
85  
86  
87  
88 Credits:
89  
90  
91  
92 CWP: Jack K. Cohen, John Stockwell
93  
94 MOBIL: Stew Levin
95  
96  
97  
98 =head2 User's notes (Juan Lorenzo)
99 untested
100  
101 =cut
102  
103  
104 =head2 CHANGES and their DATES
105  
106 =cut
107  
108 use Moose;
109 our $VERSION = '0.0.1';
110  
111  
112 =head2 Import packages
113  
114 =cut
115  
116 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
117  
118 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
119 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
120  
121  
122 =head2 instantiation of packages
123  
124 =cut
125  
126 my $get = L_SU_global_constants->new();
127 my $Project = Project_config->new();
128 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
129 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
130 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
131  
132 my $PS_SEISMIC = $Project->PS_SEISMIC();
133  
134 my $var = $get->var();
135 my $on = $var->{_on};
136 my $off = $var->{_off};
137 my $true = $var->{_true};
138 my $false = $var->{_false};
139 my $empty_string = $var->{_empty_string};
140  
141 =head2 Encapsulated
142 hash of private variables
143  
144 =cut
145  
146 my $segyhdrs = {
147 _bfile => '',
148 _dt => '',
149 _format => '',
150 _hfile => '',
151 _jobid => '',
152 _keyword => '',
153 _lino => '',
154 _ns => '',
155 _reno => '',
156 _Step => '',
157 _note => '',
158  
159 };
160  
161 =head2 sub Step
162  
163 collects switches and assembles bash instructions
164 by adding the program name
165  
166 =cut
167  
168 sub Step {
169  
170 $segyhdrs->{_Step} = 'segyhdrs'.$segyhdrs->{_Step};
171 return ( $segyhdrs->{_Step} );
172  
173 }
174  
175  
176 =head2 sub note
177  
178 collects switches and assembles bash instructions
179 by adding the program name
180  
181 =cut
182  
183 sub note {
184  
185 $segyhdrs->{_note} = 'segyhdrs'.$segyhdrs->{_note};
186 return ( $segyhdrs->{_note} );
187  
188 }
189  
190  
191  
192 =head2 sub clear
193  
194 =cut
195  
196 sub clear {
197  
198 $segyhdrs->{_bfile} = '';
199 $segyhdrs->{_dt} = '';
200 $segyhdrs->{_format} = '';
201 $segyhdrs->{_hfile} = '';
202 $segyhdrs->{_jobid} = '';
203 $segyhdrs->{_keyword} = '';
204 $segyhdrs->{_lino} = '';
205 $segyhdrs->{_ns} = '';
206 $segyhdrs->{_reno} = '';
207 $segyhdrs->{_Step} = '';
208 $segyhdrs->{_note} = '';
209 }
210  
211  
212 =head2 sub bfile
213  
214  
215 =cut
216  
217 sub bfile {
218  
219 my ( $self,$bfile ) = @_;
220 if ( $bfile ne $empty_string ) {
221  
222 $segyhdrs->{_bfile} = $bfile;
223 $segyhdrs->{_note} = $segyhdrs->{_note}.' bfile='.$segyhdrs->{_bfile};
224 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' bfile='.$segyhdrs->{_bfile};
225  
226 } else {
227 print("segyhdrs, bfile, missing bfile,\n");
228 }
229 }
230  
231  
232 =head2 sub dt
233  
234  
235 =cut
236  
237 sub dt {
238  
239 my ( $self,$dt ) = @_;
240 if ( $dt ne $empty_string ) {
241  
242 $segyhdrs->{_dt} = $dt;
243 $segyhdrs->{_note} = $segyhdrs->{_note}.' dt='.$segyhdrs->{_dt};
244 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' dt='.$segyhdrs->{_dt};
245  
246 } else {
247 print("segyhdrs, dt, missing dt,\n");
248 }
249 }
250  
251  
252 =head2 sub format
253  
254  
255 =cut
256  
257 sub format {
258  
259 my ( $self,$format ) = @_;
260 if ( $format ne $empty_string ) {
261  
262 $segyhdrs->{_format} = $format;
263 $segyhdrs->{_note} = $segyhdrs->{_note}.' format='.$segyhdrs->{_format};
264 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' format='.$segyhdrs->{_format};
265  
266 } else {
267 print("segyhdrs, format, missing format,\n");
268 }
269 }
270  
271  
272 =head2 sub hfile
273  
274  
275 =cut
276  
277 sub hfile {
278  
279 my ( $self,$hfile ) = @_;
280 if ( $hfile ne $empty_string ) {
281  
282 $segyhdrs->{_hfile} = $hfile;
283 $segyhdrs->{_note} = $segyhdrs->{_note}.' hfile='.$segyhdrs->{_hfile};
284 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' hfile='.$segyhdrs->{_hfile};
285  
286 } else {
287 print("segyhdrs, hfile, missing hfile,\n");
288 }
289 }
290  
291  
292 =head2 sub jobid
293  
294  
295 =cut
296  
297 sub jobid {
298  
299 my ( $self,$jobid ) = @_;
300 if ( $jobid ne $empty_string ) {
301  
302 $segyhdrs->{_jobid} = $jobid;
303 $segyhdrs->{_note} = $segyhdrs->{_note}.' jobid='.$segyhdrs->{_jobid};
304 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' jobid='.$segyhdrs->{_jobid};
305  
306 } else {
307 print("segyhdrs, jobid, missing jobid,\n");
308 }
309 }
310  
311  
312 =head2 sub keyword
313  
314  
315 =cut
316  
317 sub keyword {
318  
319 my ( $self,$keyword ) = @_;
320 if ( $keyword ne $empty_string ) {
321  
322 $segyhdrs->{_keyword} = $keyword;
323 $segyhdrs->{_note} = $segyhdrs->{_note}.' keyword='.$segyhdrs->{_keyword};
324 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' keyword='.$segyhdrs->{_keyword};
325  
326 } else {
327 print("segyhdrs, keyword, missing keyword,\n");
328 }
329 }
330  
331  
332 =head2 sub lino
333  
334  
335 =cut
336  
337 sub lino {
338  
339 my ( $self,$lino ) = @_;
340 if ( $lino ne $empty_string ) {
341  
342 $segyhdrs->{_lino} = $lino;
343 $segyhdrs->{_note} = $segyhdrs->{_note}.' lino='.$segyhdrs->{_lino};
344 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' lino='.$segyhdrs->{_lino};
345  
346 } else {
347 print("segyhdrs, lino, missing lino,\n");
348 }
349 }
350  
351  
352 =head2 sub ns
353  
354  
355 =cut
356  
357 sub ns {
358  
359 my ( $self,$ns ) = @_;
360 if ( $ns ne $empty_string ) {
361  
362 $segyhdrs->{_ns} = $ns;
363 $segyhdrs->{_note} = $segyhdrs->{_note}.' ns='.$segyhdrs->{_ns};
364 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' ns='.$segyhdrs->{_ns};
365  
366 } else {
367 print("segyhdrs, ns, missing ns,\n");
368 }
369 }
370  
371  
372 =head2 sub reno
373  
374  
375 =cut
376  
377 sub reno {
378  
379 my ( $self,$reno ) = @_;
380 if ( $reno ne $empty_string ) {
381  
382 $segyhdrs->{_reno} = $reno;
383 $segyhdrs->{_note} = $segyhdrs->{_note}.' reno='.$segyhdrs->{_reno};
384 $segyhdrs->{_Step} = $segyhdrs->{_Step}.' reno='.$segyhdrs->{_reno};
385  
386 } else {
387 print("segyhdrs, reno, missing reno,\n");
388 }
389 }
390  
391  
392 =head2 sub get_max_index
393  
394 max index = number of input variables -1
395
396 =cut
397
398 sub get_max_index {
399 my ($self) = @_;
400 my $max_index = 8;
401  
402 return($max_index);
403 }
404
405
406 1;