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

filter: Statementstmt 0.0% 0 / 61 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 95 CC 7 SCAR 15.4
CC
7
Cov
0%
ftn
6.0
head
6.0
number_samples
6.0
CRAP 4.7
1 package App::SeismicUnixGui::sunix::header::suaddhead;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUADDHEAD - put headers on bare traces and set the tracl and ns fields
8 AUTHOR: Juan Lorenzo (Perl module only)
9 DATE: June 7 2013
10 REQUIRES: Seismic Unix modules (CSM)
11 DESCRIPTION suaddhead
12 Version 0.0.1
13  
14 =head2 USE
15  
16 =head3 NOTES
17  
18 =head4 Examples
19  
20 =head3 SEISMIC UNIX NOTES
21  
22 SUADDHEAD - put headers on bare traces and set the tracl and ns fields
23  
24 suaddhead <stdin >stdout ns= ftn=0
25  
26 Required parameter:
27 ns=the number of samples per trace
28  
29 Optional parameter:
30 ifdef SU_LINE_HEADER
31 head= file to read headers in
32 not supplied -- will generate headers
33 given -- will read in headers and attach
34 floating point arrays to form
35 traces ",
36 (head can be created via sustrip program)
37 endif
38 ftn=0 Fortran flag
39 0 = data written unformatted from C
40 1 = data written unformatted from Fortran
41 tsort=3 trace sorting code:
42 1 = as recorded (no sorting)
43 2 = CDP ensemble
44 3 = single fold continuous profile
45 4 = horizontally stacked ",
46 ntrpr=1 number of data traces per record
47 if tsort=2, this is the number of traces per cdp",
48  
49 Trace header fields set: ns, tracl
50 Use sushw/suchw to set other needed fields.
51  
52 Caution: An incorrect ns field will munge subsequent processing.
53 Note: n1 and nt are acceptable aliases for ns.
54  
55 Example:
56 suaddhead ns=1024 <bare_traces | sushw key=dt a=4000 >segy_traces
57  
58 This command line adds headers with ns=1024 samples. The second part
59 of the pipe sets the trace header field dt to 4 ms. See also the
60 selfdocs of related programs sustrip and supaste.
61 See: sudoc supaste
62 Related Programs: supaste, sustrip
63 =head2 CHANGES and their DATES
64  
65 =cut
66  
67 use Moose;
68 our $VERSION = '0.0.1';
69 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
70  
71 my $get = L_SU_global_constants->new();
72  
73 my $var = $get->var();
74 my $empty_string = $var->{_empty_string};
75  
76 my $suaddhead = {
77 _ftn => '',
78 _head => '',
79 _ns => '',
80 _ntrpr => '',
81 _tsort => '',
82 _Step => '',
83 _note => '',
84 };
85  
86 =head2 sub Step
87  
88 collects switches and assembles bash instructions
89 by adding the program name
90  
91 =cut
92  
93 sub Step {
94  
95 $suaddhead->{_Step} = 'suaddhead' . $suaddhead->{_Step};
96 return ( $suaddhead->{_Step} );
97  
98 }
99  
100 =head2 sub note
101  
102 collects switches and assembles bash instructions
103 by adding the program name
104  
105 =cut
106  
107 sub note {
108  
109 $suaddhead->{_note} = 'suaddhead' . $suaddhead->{_note};
110 return ( $suaddhead->{_note} );
111  
112 }
113  
114 =head2 sub clear
115  
116 =cut
117  
118 sub clear {
119  
120 $suaddhead->{_ftn} = '';
121 $suaddhead->{_head} = '';
122 $suaddhead->{_ns} = '';
123 $suaddhead->{_ntrpr} = '';
124 $suaddhead->{_tsort} = '';
125 $suaddhead->{_Step} = '';
126 $suaddhead->{_note} = '';
127 }
128  
129 =head2 sub ftn
130  
131  
132 =cut
133  
134 sub ftn {
135  
136 my ( $self, $ftn ) = @_;
137 if ( $ftn ne $empty_string ) {
138  
139 $suaddhead->{_ftn} = $ftn;
140 $suaddhead->{_note} =
141 $suaddhead->{_note} . ' ftn=' . $suaddhead->{_ftn};
142 $suaddhead->{_Step} =
143 $suaddhead->{_Step} . ' ftn=' . $suaddhead->{_ftn};
144  
145 }
146 else {
147 print("suaddhead, ftn, missing ftn,\n");
148 }
149 }
150  
151 =head2 sub head
152  
153  
154 =cut
155  
156 sub head {
157  
158 my ( $self, $head ) = @_;
159 if ( $head ne $empty_string ) {
160  
161 $suaddhead->{_head} = $head;
162 $suaddhead->{_note} =
163 $suaddhead->{_note} . ' head=' . $suaddhead->{_head};
164 $suaddhead->{_Step} =
165 $suaddhead->{_Step} . ' head=' . $suaddhead->{_head};
166  
167 }
168 else {
169 print("suaddhead, head, missing head,\n");
170 }
171 }
172  
173 =head2 sub number_samples
174  
175  
176 =cut
177  
178 sub number_samples {
179  
180 my ( $self, $ns ) = @_;
181 if ( $ns ne $empty_string ) {
182  
183 $suaddhead->{_ns} = $ns;
184 $suaddhead->{_note} =
185 $suaddhead->{_note} . ' ns=' . $suaddhead->{_ns};
186 $suaddhead->{_Step} =
187 $suaddhead->{_Step} . ' ns=' . $suaddhead->{_ns};
188  
189 }
190 else {
191 print("suaddhead, number_samples, missing ns,\n");
192 }
193 }
194  
195 =head2 sub ns
196  
197  
198 =cut
199  
200 sub ns {
201  
202 my ( $self, $ns ) = @_;
203 if ( $ns ne $empty_string ) {
204  
205 $suaddhead->{_ns} = $ns;
206 $suaddhead->{_note} =
207 $suaddhead->{_note} . ' ns=' . $suaddhead->{_ns};
208 $suaddhead->{_Step} =
209 $suaddhead->{_Step} . ' ns=' . $suaddhead->{_ns};
210  
211 }
212 else {
213 print("suaddhead, ns, missing ns,\n");
214 }
215 }
216  
217 =head2 sub ntrpr
218  
219  
220 =cut
221  
222 sub ntrpr {
223  
224 my ( $self, $ntrpr ) = @_;
225 if ( $ntrpr ne $empty_string ) {
226  
227 $suaddhead->{_ntrpr} = $ntrpr;
228 $suaddhead->{_note} =
229 $suaddhead->{_note} . ' ntrpr=' . $suaddhead->{_ntrpr};
230 $suaddhead->{_Step} =
231 $suaddhead->{_Step} . ' ntrpr=' . $suaddhead->{_ntrpr};
232  
233 }
234 else {
235 print("suaddhead, ntrpr, missing ntrpr,\n");
236 }
237 }
238  
239 =head2 sub tsort
240  
241  
242 =cut
243  
244 sub tsort {
245  
246 my ( $self, $tsort ) = @_;
247 if ( $tsort ne $empty_string ) {
248  
249 $suaddhead->{_tsort} = $tsort;
250 $suaddhead->{_note} =
251 $suaddhead->{_note} . ' tsort=' . $suaddhead->{_tsort};
252 $suaddhead->{_Step} =
253 $suaddhead->{_Step} . ' tsort=' . $suaddhead->{_tsort};
254  
255 }
256 else {
257 print("suaddhead, tsort, missing tsort,\n");
258 }
259 }
260  
261 =head2 sub get_max_index
262
263 max index = number of input variables -1
264
265 =cut
266  
267 sub get_max_index {
268 my ($self) = @_;
269 my $max_index = 4;
270  
271 return ($max_index);
272 }
273  
274 1;