lib/App/SeismicUnixGui/sunix/statsMath/suhrot.pm untested

filter: Statementstmt 0.0% 0 / 97 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 / 145 CC 10 SCAR 15.6
CC
10
Cov
0%
a
6.0
afile
6.0
angle
6.0
CRAP 4.8
1 package App::SeismicUnixGui::sunix::statsMath::suhrot;
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 SUHROT - Horizontal ROTation of three-component data
25  
26  
27  
28 suhrot <stdin >stdout [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameters:
39  
40 angle=rad unit of angles, choose "rad", "deg", or "gon
41  
42 inv=0 1 = inverse rotation (counter-clockwise)
43  
44 verbose=0 1 = echo angle for each 3-C station
45  
46  
47  
48 a=... array of user-supplied rotation angles
49  
50 x=0.0,... array of corresponding header value(s)
51  
52 key=tracf header word defining 3-C station ("x")
53  
54  
55  
56 ... or input angles from files:
57  
58 n=0 number of x and a values in input files
59  
60 xfile=... file containing the x values as specified by the
61  
62 "key" parameter
63  
64 afile=... file containing the a values
65  
66  
67  
68 Notes:
69  
70 Three adjacent traces are considered as one three-component
71  
72 dataset.
73  
74 By default, the data will be rotated from the Z-North-East (Z,N,E)
75  
76 coordinate system into Z-Radial-Transverse (Z,R,T).
77  
78  
79  
80 If one of the parameters "a=" or "afile=" is set, the data
81  
82 are rotated by these user-supplied angles. Specified x values
83  
84 must be monotonically increasing or decreasing, and afile and
85  
86 xfile are files of binary (C-style) floats.
87  
88  
89  
90  
91  
92
93  
94 Author: Nils Maercklin,
95  
96 Geophysics, Kiel University, Germany, 1999.
97  
98  
99  
100  
101  
102 Trace header fields accessed: ns, sx, sy, gx, gy, key=keyword
103  
104 Trace header fields modified: trid
105
106  
107 =head2 User's notes (Juan Lorenzo)
108
109 Clockwise rotation for a left-handed system (ZNE): inv=0 and negative angles or inv=1 and positive angles
110  
111 Two simple demos exist for suhrot -- 9.15.21
112  
113 =cut
114  
115  
116 =head2 CHANGES and their DATES
117  
118 =cut
119  
120 use Moose;
121 our $VERSION = '0.0.1';
122  
123  
124 =head2 Import packages
125  
126 =cut
127  
128 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
129  
130 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
131 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
132  
133  
134 =head2 instantiation of packages
135  
136 =cut
137  
138 my $get = L_SU_global_constants->new();
139 my $Project = Project_config->new();
140 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
141 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
142 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
143  
144 my $var = $get->var();
145 my $on = $var->{_on};
146 my $off = $var->{_off};
147 my $true = $var->{_true};
148 my $false = $var->{_false};
149 my $empty_string = $var->{_empty_string};
150  
151 =head2 Encapsulated
152 hash of private variables
153  
154 =cut
155  
156 my $suhrot = {
157 _a => '',
158 _afile => '',
159 _angle => '',
160 _inv => '',
161 _key => '',
162 _n => '',
163 _verbose => '',
164 _x => '',
165 _xfile => '',
166 _Step => '',
167 _note => '',
168  
169 };
170  
171 =head2 sub Step
172  
173 collects switches and assembles bash instructions
174 by adding the program name
175  
176 =cut
177  
178 sub Step {
179  
180 $suhrot->{_Step} = 'suhrot'.$suhrot->{_Step};
181 return ( $suhrot->{_Step} );
182  
183 }
184  
185  
186 =head2 sub note
187  
188 collects switches and assembles bash instructions
189 by adding the program name
190  
191 =cut
192  
193 sub note {
194  
195 $suhrot->{_note} = 'suhrot'.$suhrot->{_note};
196 return ( $suhrot->{_note} );
197  
198 }
199  
200  
201  
202 =head2 sub clear
203  
204 =cut
205  
206 sub clear {
207  
208 $suhrot->{_a} = '';
209 $suhrot->{_afile} = '';
210 $suhrot->{_angle} = '';
211 $suhrot->{_inv} = '';
212 $suhrot->{_key} = '';
213 $suhrot->{_n} = '';
214 $suhrot->{_verbose} = '';
215 $suhrot->{_x} = '';
216 $suhrot->{_xfile} = '';
217 $suhrot->{_Step} = '';
218 $suhrot->{_note} = '';
219 }
220  
221 =head2 sub a
222  
223  
224 =cut
225  
226 sub a {
227  
228 my ( $self,$a ) = @_;
229 if ( $a ne $empty_string ) {
230  
231 $suhrot->{_a} = $a;
232 $suhrot->{_note} = $suhrot->{_note}.' a='.$suhrot->{_a};
233 $suhrot->{_Step} = $suhrot->{_Step}.' a='.$suhrot->{_a};
234  
235 } else {
236 print("suhrot, a, missing a,\n");
237 }
238 }
239  
240  
241 =head2 sub afile
242  
243  
244 =cut
245  
246 sub afile {
247  
248 my ( $self,$afile ) = @_;
249 if ( $afile ne $empty_string ) {
250  
251 $suhrot->{_afile} = $afile;
252 $suhrot->{_note} = $suhrot->{_note}.' afile='.$suhrot->{_afile};
253 $suhrot->{_Step} = $suhrot->{_Step}.' afile='.$suhrot->{_afile};
254  
255 } else {
256 print("suhrot, afile, missing afile,\n");
257 }
258 }
259  
260  
261 =head2 sub angle
262  
263  
264 =cut
265  
266 sub angle {
267  
268 my ( $self,$angle ) = @_;
269 if ( $angle ne $empty_string ) {
270  
271 $suhrot->{_angle} = $angle;
272 $suhrot->{_note} = $suhrot->{_note}.' angle='.$suhrot->{_angle};
273 $suhrot->{_Step} = $suhrot->{_Step}.' angle='.$suhrot->{_angle};
274  
275 } else {
276 print("suhrot, angle, missing angle,\n");
277 }
278 }
279  
280  
281 =head2 sub inv
282  
283  
284 =cut
285  
286 sub inv {
287  
288 my ( $self,$inv ) = @_;
289 if ( $inv ne $empty_string ) {
290  
291 $suhrot->{_inv} = $inv;
292 $suhrot->{_note} = $suhrot->{_note}.' inv='.$suhrot->{_inv};
293 $suhrot->{_Step} = $suhrot->{_Step}.' inv='.$suhrot->{_inv};
294  
295 } else {
296 print("suhrot, inv, missing inv,\n");
297 }
298 }
299  
300  
301 =head2 sub key
302  
303  
304 =cut
305  
306 sub key {
307  
308 my ( $self,$key ) = @_;
309 if ( $key ne $empty_string ) {
310  
311 $suhrot->{_key} = $key;
312 $suhrot->{_note} = $suhrot->{_note}.' key='.$suhrot->{_key};
313 $suhrot->{_Step} = $suhrot->{_Step}.' key='.$suhrot->{_key};
314  
315 } else {
316 print("suhrot, key, missing key,\n");
317 }
318 }
319  
320  
321 =head2 sub n
322  
323  
324 =cut
325  
326 sub n {
327  
328 my ( $self,$n ) = @_;
329 if ( $n ne $empty_string ) {
330  
331 $suhrot->{_n} = $n;
332 $suhrot->{_note} = $suhrot->{_note}.' n='.$suhrot->{_n};
333 $suhrot->{_Step} = $suhrot->{_Step}.' n='.$suhrot->{_n};
334  
335 } else {
336 print("suhrot, n, missing n,\n");
337 }
338 }
339  
340  
341 =head2 sub verbose
342  
343  
344 =cut
345  
346 sub verbose {
347  
348 my ( $self,$verbose ) = @_;
349 if ( $verbose ne $empty_string ) {
350  
351 $suhrot->{_verbose} = $verbose;
352 $suhrot->{_note} = $suhrot->{_note}.' verbose='.$suhrot->{_verbose};
353 $suhrot->{_Step} = $suhrot->{_Step}.' verbose='.$suhrot->{_verbose};
354  
355 } else {
356 print("suhrot, verbose, missing verbose,\n");
357 }
358 }
359  
360  
361 =head2 sub x
362  
363  
364 =cut
365  
366 sub x {
367  
368 my ( $self,$x ) = @_;
369 if ( $x ne $empty_string ) {
370  
371 $suhrot->{_x} = $x;
372 $suhrot->{_note} = $suhrot->{_note}.' x='.$suhrot->{_x};
373 $suhrot->{_Step} = $suhrot->{_Step}.' x='.$suhrot->{_x};
374  
375 } else {
376 print("suhrot, x, missing x,\n");
377 }
378 }
379  
380  
381 =head2 sub xfile
382  
383  
384 =cut
385  
386 sub xfile {
387  
388 my ( $self,$xfile ) = @_;
389 if ( $xfile ne $empty_string ) {
390  
391 $suhrot->{_xfile} = $xfile;
392 $suhrot->{_note} = $suhrot->{_note}.' xfile='.$suhrot->{_xfile};
393 $suhrot->{_Step} = $suhrot->{_Step}.' xfile='.$suhrot->{_xfile};
394  
395 } else {
396 print("suhrot, xfile, missing xfile,\n");
397 }
398 }
399  
400  
401 =head2 sub get_max_index
402  
403 max index = number of input variables -1
404
405 =cut
406
407 sub get_max_index {
408 my ($self) = @_;
409 my $max_index = 8;
410  
411 return($max_index);
412 }
413
414
415 1;