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

filter: Statementstmt 0.0% 0 / 63 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 91 CC 5 SCAR 13.9
CC
5
Cov
0%
ftn
6.0
head
6.0
ns
6.0
CRAP 4.0
1 package App::SeismicUnixGui::sunix::header::supaste;
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 SUPASTE - paste existing SU headers on existing binary data
25  
26  
27  
28 supaste <bare_data >segys ns= head=headers ftn=0
29  
30  
31  
32 Required parameter:
33  
34 ns=the number of samples per trace
35  
36  
37  
38 Optional parameters:
39  
40 head=headers file with segy headers
41  
42 ftn=0 Fortran flag
43  
44 0 = unformatted data from C
45  
46 1 = ... from Fortran
47  
48 verbose=0 1 equals echo number of traces pasted
49  
50 Caution:
51  
52 An incorrect ns field will munge subsequent processing.
53  
54  
55  
56 Notes:
57  
58 This program is used when the option head=headers is used in
59  
60 sustrip. See: sudoc sustrip for more details.
61  
62  
63  
64 Related programs: sustrip, suaddhead
65  
66  
67  
68 Credits:
69  
70 CWP: Jack K. Cohen, November 1990
71  
72  
73  
74 =head2 User's notes (Juan Lorenzo)
75 untested
76  
77 =cut
78  
79  
80 =head2 CHANGES and their DATES
81  
82 =cut
83  
84 use Moose;
85 our $VERSION = '0.0.1';
86  
87  
88 =head2 Import packages
89  
90 =cut
91  
92 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
93  
94 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
95 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
96  
97  
98 =head2 instantiation of packages
99  
100 =cut
101  
102 my $get = L_SU_global_constants->new();
103 my $Project = Project_config->new();
104 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
105 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
106 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
107  
108 my $PS_SEISMIC = $Project->PS_SEISMIC();
109  
110 my $var = $get->var();
111 my $on = $var->{_on};
112 my $off = $var->{_off};
113 my $true = $var->{_true};
114 my $false = $var->{_false};
115 my $empty_string = $var->{_empty_string};
116  
117 =head2 Encapsulated
118 hash of private variables
119  
120 =cut
121  
122 my $supaste = {
123 _ftn => '',
124 _head => '',
125 _ns => '',
126 _verbose => '',
127 _Step => '',
128 _note => '',
129  
130 };
131  
132 =head2 sub Step
133  
134 collects switches and assembles bash instructions
135 by adding the program name
136  
137 =cut
138  
139 sub Step {
140  
141 $supaste->{_Step} = 'supaste'.$supaste->{_Step};
142 return ( $supaste->{_Step} );
143  
144 }
145  
146  
147 =head2 sub note
148  
149 collects switches and assembles bash instructions
150 by adding the program name
151  
152 =cut
153  
154 sub note {
155  
156 $supaste->{_note} = 'supaste'.$supaste->{_note};
157 return ( $supaste->{_note} );
158  
159 }
160  
161  
162  
163 =head2 sub clear
164  
165 =cut
166  
167 sub clear {
168  
169 $supaste->{_ftn} = '';
170 $supaste->{_head} = '';
171 $supaste->{_ns} = '';
172 $supaste->{_verbose} = '';
173 $supaste->{_Step} = '';
174 $supaste->{_note} = '';
175 }
176  
177  
178  
179  
180 =head2 sub ftn
181  
182  
183 =cut
184  
185 sub ftn {
186  
187 my ( $self,$ftn ) = @_;
188 if ( $ftn ne $empty_string ) {
189  
190 $supaste->{_ftn} = $ftn;
191 $supaste->{_note} = $supaste->{_note}.' ftn='.$supaste->{_ftn};
192 $supaste->{_Step} = $supaste->{_Step}.' ftn='.$supaste->{_ftn};
193  
194 } else {
195 print("supaste, ftn, missing ftn,\n");
196 }
197 }
198  
199  
200 =head2 sub head
201  
202  
203 =cut
204  
205 sub head {
206  
207 my ( $self,$head ) = @_;
208 if ( $head ne $empty_string ) {
209  
210 $supaste->{_head} = $head;
211 $supaste->{_note} = $supaste->{_note}.' head='.$supaste->{_head};
212 $supaste->{_Step} = $supaste->{_Step}.' head='.$supaste->{_head};
213  
214 } else {
215 print("supaste, head, missing head,\n");
216 }
217 }
218  
219  
220 =head2 sub ns
221  
222  
223 =cut
224  
225 sub ns {
226  
227 my ( $self,$ns ) = @_;
228 if ( $ns ne $empty_string ) {
229  
230 $supaste->{_ns} = $ns;
231 $supaste->{_note} = $supaste->{_note}.' ns='.$supaste->{_ns};
232 $supaste->{_Step} = $supaste->{_Step}.' ns='.$supaste->{_ns};
233  
234 } else {
235 print("supaste, ns, missing ns,\n");
236 }
237 }
238  
239  
240 =head2 sub verbose
241  
242  
243 =cut
244  
245 sub verbose {
246  
247 my ( $self,$verbose ) = @_;
248 if ( $verbose ne $empty_string ) {
249  
250 $supaste->{_verbose} = $verbose;
251 $supaste->{_note} = $supaste->{_note}.' verbose='.$supaste->{_verbose};
252 $supaste->{_Step} = $supaste->{_Step}.' verbose='.$supaste->{_verbose};
253  
254 } else {
255 print("supaste, verbose, missing verbose,\n");
256 }
257 }
258  
259  
260 =head2 sub get_max_index
261  
262 max index = number of input variables -1
263
264 =cut
265
266 sub get_max_index {
267 my ($self) = @_;
268 my $max_index = 3;
269  
270 return($max_index);
271 }
272
273
274 1;