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

filter: Statementstmt 0.0% 0 / 105 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 14 totaltotal 0.0% 0 / 157 CC 11 SCAR 15.8
CC
11
Cov
0%
X
6.0
Y
6.0
Z
6.0
CRAP 4.9
1 package App::SeismicUnixGui::sunix::header::sulcthw;
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 SULCTHW - Linear Coordinate Transformation of Header Words
25  
26  
27  
28 sulcthw <infile >outfile
29  
30  
31  
32 xt=0.0 Translation of X
33  
34 yt=0.0 Translation of Y
35  
36 zt=0.0 Translation of Z
37  
38 xr=0.0 Rotation around X in degrees
39  
40 yr=0.0 Rotation aroun Y in degrees
41  
42 zr=0.0 Rotation around Z in degrees
43  
44  
45  
46 Notes:
47  
48 Translation:
49  
50 x = x'+ xt;y = y'+ yt;z = z' + zt;
51  
52  
53  
54 Rotations:
55  
56 Around Z axis
57  
58 X = x*cos(zr)+y*sin(zr);
59  
60 Y = y*cos(zr)-x*sin(zr);
61  
62 Around Y axis
63  
64 Z = z*cos(yr)+x*sin(yr);
65  
66 X = x*cos(yr)-z*sin(yr);
67  
68 Around X axis
69  
70 Y = y*cos(xr)+z*sin(xr);
71  
72 Z = Z*cos(xr)-y*sin(xr);
73  
74  
75  
76 Header words triplets that are transformed
77  
78 sx,sy,selev
79  
80 gx,gy,gelev
81  
82  
83  
84 The header words restored as 32 bit integers using SEG-Y
85  
86 convention (with coordinate scalers scalco and scalel).
87  
88  
89  
90 After transformation they are converted back to integers and stored.
91  
92  
93  
94  
95  
96  
97  
98 Credits: Potash Corporation of Saskatchewan: Balasz Nemeth c. 2008
99  
100  
101  
102  
103  
104  
105  
106 =head2 User's notes (Juan Lorenzo)
107 untested
108  
109 =cut
110  
111  
112 =head2 CHANGES and their DATES
113  
114 =cut
115  
116 use Moose;
117 our $VERSION = '0.0.1';
118  
119  
120 =head2 Import packages
121  
122 =cut
123  
124 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
125  
126 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
127 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
128  
129  
130 =head2 instantiation of packages
131  
132 =cut
133  
134 my $get = L_SU_global_constants->new();
135 my $Project = Project_config->new();
136 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
137 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
138 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
139  
140 my $PS_SEISMIC = $Project->PS_SEISMIC();
141  
142 my $var = $get->var();
143 my $on = $var->{_on};
144 my $off = $var->{_off};
145 my $true = $var->{_true};
146 my $false = $var->{_false};
147 my $empty_string = $var->{_empty_string};
148  
149 =head2 Encapsulated
150 hash of private variables
151  
152 =cut
153  
154 my $sulcthw = {
155 _X => '',
156 _Y => '',
157 _Z => '',
158 _x => '',
159 _xr => '',
160 _xt => '',
161 _yr => '',
162 _yt => '',
163 _zr => '',
164 _zt => '',
165 _Step => '',
166 _note => '',
167  
168 };
169  
170 =head2 sub Step
171  
172 collects switches and assembles bash instructions
173 by adding the program name
174  
175 =cut
176  
177 sub Step {
178  
179 $sulcthw->{_Step} = 'sulcthw'.$sulcthw->{_Step};
180 return ( $sulcthw->{_Step} );
181  
182 }
183  
184  
185 =head2 sub note
186  
187 collects switches and assembles bash instructions
188 by adding the program name
189  
190 =cut
191  
192 sub note {
193  
194 $sulcthw->{_note} = 'sulcthw'.$sulcthw->{_note};
195 return ( $sulcthw->{_note} );
196  
197 }
198  
199  
200  
201 =head2 sub clear
202  
203 =cut
204  
205 sub clear {
206  
207 $sulcthw->{_X} = '';
208 $sulcthw->{_Y} = '';
209 $sulcthw->{_Z} = '';
210 $sulcthw->{_x} = '';
211 $sulcthw->{_xr} = '';
212 $sulcthw->{_xt} = '';
213 $sulcthw->{_yr} = '';
214 $sulcthw->{_yt} = '';
215 $sulcthw->{_zr} = '';
216 $sulcthw->{_zt} = '';
217 $sulcthw->{_Step} = '';
218 $sulcthw->{_note} = '';
219 }
220  
221  
222 =head2 sub X
223  
224  
225 =cut
226  
227 sub X {
228  
229 my ( $self,$X ) = @_;
230 if ( $X ne $empty_string ) {
231  
232 $sulcthw->{_X} = $X;
233 $sulcthw->{_note} = $sulcthw->{_note}.' X='.$sulcthw->{_X};
234 $sulcthw->{_Step} = $sulcthw->{_Step}.' X='.$sulcthw->{_X};
235  
236 } else {
237 print("sulcthw, X, missing X,\n");
238 }
239 }
240  
241  
242 =head2 sub Y
243  
244  
245 =cut
246  
247 sub Y {
248  
249 my ( $self,$Y ) = @_;
250 if ( $Y ne $empty_string ) {
251  
252 $sulcthw->{_Y} = $Y;
253 $sulcthw->{_note} = $sulcthw->{_note}.' Y='.$sulcthw->{_Y};
254 $sulcthw->{_Step} = $sulcthw->{_Step}.' Y='.$sulcthw->{_Y};
255  
256 } else {
257 print("sulcthw, Y, missing Y,\n");
258 }
259 }
260  
261  
262 =head2 sub Z
263  
264  
265 =cut
266  
267 sub Z {
268  
269 my ( $self,$Z ) = @_;
270 if ( $Z ne $empty_string ) {
271  
272 $sulcthw->{_Z} = $Z;
273 $sulcthw->{_note} = $sulcthw->{_note}.' Z='.$sulcthw->{_Z};
274 $sulcthw->{_Step} = $sulcthw->{_Step}.' Z='.$sulcthw->{_Z};
275  
276 } else {
277 print("sulcthw, Z, missing Z,\n");
278 }
279 }
280  
281  
282 =head2 sub x
283  
284  
285 =cut
286  
287 sub x {
288  
289 my ( $self,$x ) = @_;
290 if ( $x ne $empty_string ) {
291  
292 $sulcthw->{_x} = $x;
293 $sulcthw->{_note} = $sulcthw->{_note}.' x='.$sulcthw->{_x};
294 $sulcthw->{_Step} = $sulcthw->{_Step}.' x='.$sulcthw->{_x};
295  
296 } else {
297 print("sulcthw, x, missing x,\n");
298 }
299 }
300  
301  
302 =head2 sub xr
303  
304  
305 =cut
306  
307 sub xr {
308  
309 my ( $self,$xr ) = @_;
310 if ( $xr ne $empty_string ) {
311  
312 $sulcthw->{_xr} = $xr;
313 $sulcthw->{_note} = $sulcthw->{_note}.' xr='.$sulcthw->{_xr};
314 $sulcthw->{_Step} = $sulcthw->{_Step}.' xr='.$sulcthw->{_xr};
315  
316 } else {
317 print("sulcthw, xr, missing xr,\n");
318 }
319 }
320  
321  
322 =head2 sub xt
323  
324  
325 =cut
326  
327 sub xt {
328  
329 my ( $self,$xt ) = @_;
330 if ( $xt ne $empty_string ) {
331  
332 $sulcthw->{_xt} = $xt;
333 $sulcthw->{_note} = $sulcthw->{_note}.' xt='.$sulcthw->{_xt};
334 $sulcthw->{_Step} = $sulcthw->{_Step}.' xt='.$sulcthw->{_xt};
335  
336 } else {
337 print("sulcthw, xt, missing xt,\n");
338 }
339 }
340  
341  
342 =head2 sub yr
343  
344  
345 =cut
346  
347 sub yr {
348  
349 my ( $self,$yr ) = @_;
350 if ( $yr ne $empty_string ) {
351  
352 $sulcthw->{_yr} = $yr;
353 $sulcthw->{_note} = $sulcthw->{_note}.' yr='.$sulcthw->{_yr};
354 $sulcthw->{_Step} = $sulcthw->{_Step}.' yr='.$sulcthw->{_yr};
355  
356 } else {
357 print("sulcthw, yr, missing yr,\n");
358 }
359 }
360  
361  
362 =head2 sub yt
363  
364  
365 =cut
366  
367 sub yt {
368  
369 my ( $self,$yt ) = @_;
370 if ( $yt ne $empty_string ) {
371  
372 $sulcthw->{_yt} = $yt;
373 $sulcthw->{_note} = $sulcthw->{_note}.' yt='.$sulcthw->{_yt};
374 $sulcthw->{_Step} = $sulcthw->{_Step}.' yt='.$sulcthw->{_yt};
375  
376 } else {
377 print("sulcthw, yt, missing yt,\n");
378 }
379 }
380  
381  
382 =head2 sub zr
383  
384  
385 =cut
386  
387 sub zr {
388  
389 my ( $self,$zr ) = @_;
390 if ( $zr ne $empty_string ) {
391  
392 $sulcthw->{_zr} = $zr;
393 $sulcthw->{_note} = $sulcthw->{_note}.' zr='.$sulcthw->{_zr};
394 $sulcthw->{_Step} = $sulcthw->{_Step}.' zr='.$sulcthw->{_zr};
395  
396 } else {
397 print("sulcthw, zr, missing zr,\n");
398 }
399 }
400  
401  
402 =head2 sub zt
403  
404  
405 =cut
406  
407 sub zt {
408  
409 my ( $self,$zt ) = @_;
410 if ( $zt ne $empty_string ) {
411  
412 $sulcthw->{_zt} = $zt;
413 $sulcthw->{_note} = $sulcthw->{_note}.' zt='.$sulcthw->{_zt};
414 $sulcthw->{_Step} = $sulcthw->{_Step}.' zt='.$sulcthw->{_zt};
415  
416 } else {
417 print("sulcthw, zt, missing zt,\n");
418 }
419 }
420  
421  
422 =head2 sub get_max_index
423  
424 max index = number of input variables -1
425
426 =cut
427
428 sub get_max_index {
429 my ($self) = @_;
430 my $max_index = 9;
431  
432 return($max_index);
433 }
434
435
436 1;