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

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