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

filter: Statementstmt 0.0% 0 / 112 Branchbran 0.0% 0 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 19 Podpod 0.0% 0 / 15 totaltotal 0.0% 0 / 168 CC 12 SCAR 16.0
CC
12
Cov
0%
a
6.0
counit
6.0
f
6.0
CRAP 4.9
1 package App::SeismicUnixGui::sunix::header::suutm;
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 SUUTM - UTM projection of longitude and latitude in SU trace headers
25  
26  
27  
28 suutm <stdin >stdout [optional parameters]
29  
30  
31  
32 Optional parameters:
33  
34 counit=(from header) input coordinate units code:
35  
36 =1: length (meters or feet; no UTM projection)
37  
38 =2: seconds of arc
39  
40 =3: decimal degrees
41  
42 =4: degrees, minutes, seconds
43  
44 idx=23 reference ellipsoid index (default is WGS 1984)
45  
46 a=(from idx) user-specified semimajor axis of ellipsoid
47  
48 f=(from idx) user-specified flattening of ellipsoid
49  
50 zkey= if set, header key to store UTM zone number
51  
52 verbose=0 =1: echo ellipsoid parameters
53  
54  
55  
56 lon0= central meridian for TM projection in degrees
57  
58 (default uses the 60 standard UTM longitude zones)
59  
60 xoff=500000 false Easting (default: UTM)
61  
62 ysoff=10000000 false Northing, southern hemisphere (default: UTM)
63  
64 ynoff=0 false Northing, northern hemisphere (default: UTM)
65  
66  
67  
68 Notes:
69  
70 Universal Transverse Mercator (UTM) coordinates are defined between
71  
72 latitudes 80S (-80) and 84N (84). Longitude values must be between
73  
74 -180 degrees (west) and 179.999... degrees (east).
75  
76  
77  
78 Latitudes are read from sy and gy (N positive), and longitudes
79  
80 are read from sx and gx (E positive).
81  
82 The UTM zone is determined from the receiver coordinates gy and gx.
83  
84  
85  
86 Use suazimuth to calculate shot-receiver azimuths and offsets.
87  
88  
89  
90 Reference ellipsoids:
91  
92 An ellipsoid may be specified by its semimajor axis a and its
93  
94 flattening f, or one of the following ellipsoids may be selected
95  
96 by its index idx (semimajor axes in meters):
97  
98 0 Sphere with radius of 6371000 m
99  
100 1 Airy 1830
101  
102 2 Australian National 1965
103  
104 3 Bessel 1841 (Ethiopia, Indonesia, Japan, Korea)
105  
106 4 Bessel 1841 (Namibia)
107  
108 5 Clarke 1866
109  
110 6 Clarke 1880
111  
112 7 Everest (Brunei, E. Malaysia)
113  
114 8 Everest (India 1830)
115  
116 9 Everest (India 1956)
117  
118 10 Everest (Pakistan)
119  
120 11 Everest (W. Malaysia, Singapore 1948)
121  
122 12 Everest (W. Malaysia 1969)
123  
124 13 Geodetic Reference System 1980 (GRS 1980)
125  
126 14 Helmert 1906
127  
128 15 Hough 1960
129  
130 16 Indonesian 1974
131  
132 17 International 1924 / Hayford 1909
133  
134 18 Krassovsky 1940
135  
136 19 Modified Airy
137  
138 20 Modified Fischer 1960
139  
140 21 South American 1969
141  
142 22 World Geodetic System 1972 (WGS 1972)
143  
144 23 World Geodetic System 1984 (WGS 1984) / NAD 1983
145  
146  
147  
148  
149  
150 UTM grid:
151  
152 The Universal Transverse Mercator (UTM) system is a world wide
153  
154 coordinate system defined between 80S and 84N. It divides the
155  
156 Earth into 60 six-degree zones. Zone number 1 has its central
157  
158 meridian at 177W (-177 degrees), and numbers increase eastward.
159  
160  
161  
162 Within each zone, an Easting of 500,000 m is assigned to its
163  
164 central meridian to avoid negative coordinates. On the northern
165  
166 hemisphere, Northings start at 0 m at the equator and increase
167  
168 northward. On the southern hemisphere a false Northing of
169  
170 10,000,000 m is applied, i.e. Northings start at 10,000,000 m at
171  
172 the equator and decrease southward.
173  
174  
175  
176 Coordinate encoding (sx,sy,gx,gy):
177  
178 counit=1 units of length (coordinates are not converted)
179  
180 counit=2 seconds of arc
181  
182 counit=3 decimal degrees
183  
184 counit=4 degrees, minutes and seconds encoded as integer DDDMMSS
185  
186 with scalco=1 or DDDMMSS.ss with scalco=-100 (see segy.h)
187  
188 Units of length are also assumed, if counit <= 0 or counit >= 5.
189  
190  
191  
192  
193  
194 Author:
195  
196 Nils Maercklin, RISSC, University of Naples, Italy, March 2007
197  
198  
199  
200 References:
201  
202 NIMA (2000). Department of Defense World Geodetic System 1984 -
203  
204 its definition and relationships with local geodetic systems.
205  
206 Technical Report TR8350.2. National Imagery and Mapping Agency,
207  
208 Geodesy and Geophysics Department, St. Louis, MO. 3rd edition.
209  
210 J. P. Snyder (1987). Map Projections - A Working Manual.
211  
212 U.S. Geological Survey Professional Paper 1395, 383 pages.
213  
214 U.S. Government Printing Office.
215  
216  
217  
218  
219  
220 Trace header fields accessed: sx, sy, gx, gy, scalco, counit
221  
222 Trace header fields modified: sx, sy, gx, gy, scalco, counit
223  
224  
225  
226 =head2 User's notes (Juan Lorenzo)
227 untested
228  
229 =cut
230  
231  
232 =head2 CHANGES and their DATES
233  
234 =cut
235  
236 use Moose;
237 our $VERSION = '0.0.1';
238  
239  
240 =head2 Import packages
241  
242 =cut
243  
244 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
245  
246 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
247 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
248  
249  
250 =head2 instantiation of packages
251  
252 =cut
253  
254 my $get = L_SU_global_constants->new();
255 my $Project = Project_config->new();
256 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
257 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
258 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
259  
260 my $PS_SEISMIC = $Project->PS_SEISMIC();
261  
262 my $var = $get->var();
263 my $on = $var->{_on};
264 my $off = $var->{_off};
265 my $true = $var->{_true};
266 my $false = $var->{_false};
267 my $empty_string = $var->{_empty_string};
268  
269 =head2 Encapsulated
270 hash of private variables
271  
272 =cut
273  
274 my $suutm = {
275 _a => '',
276 _counit => '',
277 _f => '',
278 _idx => '',
279 _lon0 => '',
280 _scalco => '',
281 _verbose => '',
282 _xoff => '',
283 _ynoff => '',
284 _ysoff => '',
285 _zkey => '',
286 _Step => '',
287 _note => '',
288  
289 };
290  
291 =head2 sub Step
292  
293 collects switches and assembles bash instructions
294 by adding the program name
295  
296 =cut
297  
298 sub Step {
299  
300 $suutm->{_Step} = 'suutm'.$suutm->{_Step};
301 return ( $suutm->{_Step} );
302  
303 }
304  
305  
306 =head2 sub note
307  
308 collects switches and assembles bash instructions
309 by adding the program name
310  
311 =cut
312  
313 sub note {
314  
315 $suutm->{_note} = 'suutm'.$suutm->{_note};
316 return ( $suutm->{_note} );
317  
318 }
319  
320  
321  
322 =head2 sub clear
323  
324 =cut
325  
326 sub clear {
327  
328 $suutm->{_a} = '';
329 $suutm->{_counit} = '';
330 $suutm->{_f} = '';
331 $suutm->{_idx} = '';
332 $suutm->{_lon0} = '';
333 $suutm->{_scalco} = '';
334 $suutm->{_verbose} = '';
335 $suutm->{_xoff} = '';
336 $suutm->{_ynoff} = '';
337 $suutm->{_ysoff} = '';
338 $suutm->{_zkey} = '';
339 $suutm->{_Step} = '';
340 $suutm->{_note} = '';
341 }
342  
343  
344 =head2 sub a
345  
346  
347 =cut
348  
349 sub a {
350  
351 my ( $self,$a ) = @_;
352 if ( $a ne $empty_string ) {
353  
354 $suutm->{_a} = $a;
355 $suutm->{_note} = $suutm->{_note}.' a='.$suutm->{_a};
356 $suutm->{_Step} = $suutm->{_Step}.' a='.$suutm->{_a};
357  
358 } else {
359 print("suutm, a, missing a,\n");
360 }
361 }
362  
363  
364 =head2 sub counit
365  
366  
367 =cut
368  
369 sub counit {
370  
371 my ( $self,$counit ) = @_;
372 if ( $counit ne $empty_string ) {
373  
374 $suutm->{_counit} = $counit;
375 $suutm->{_note} = $suutm->{_note}.' counit='.$suutm->{_counit};
376 $suutm->{_Step} = $suutm->{_Step}.' counit='.$suutm->{_counit};
377  
378 } else {
379 print("suutm, counit, missing counit,\n");
380 }
381 }
382  
383  
384 =head2 sub f
385  
386  
387 =cut
388  
389 sub f {
390  
391 my ( $self,$f ) = @_;
392 if ( $f ne $empty_string ) {
393  
394 $suutm->{_f} = $f;
395 $suutm->{_note} = $suutm->{_note}.' f='.$suutm->{_f};
396 $suutm->{_Step} = $suutm->{_Step}.' f='.$suutm->{_f};
397  
398 } else {
399 print("suutm, f, missing f,\n");
400 }
401 }
402  
403  
404 =head2 sub idx
405  
406  
407 =cut
408  
409 sub idx {
410  
411 my ( $self,$idx ) = @_;
412 if ( $idx ne $empty_string ) {
413  
414 $suutm->{_idx} = $idx;
415 $suutm->{_note} = $suutm->{_note}.' idx='.$suutm->{_idx};
416 $suutm->{_Step} = $suutm->{_Step}.' idx='.$suutm->{_idx};
417  
418 } else {
419 print("suutm, idx, missing idx,\n");
420 }
421 }
422  
423  
424 =head2 sub lon0
425  
426  
427 =cut
428  
429 sub lon0 {
430  
431 my ( $self,$lon0 ) = @_;
432 if ( $lon0 ne $empty_string ) {
433  
434 $suutm->{_lon0} = $lon0;
435 $suutm->{_note} = $suutm->{_note}.' lon0='.$suutm->{_lon0};
436 $suutm->{_Step} = $suutm->{_Step}.' lon0='.$suutm->{_lon0};
437  
438 } else {
439 print("suutm, lon0, missing lon0,\n");
440 }
441 }
442  
443  
444 =head2 sub scalco
445  
446  
447 =cut
448  
449 sub scalco {
450  
451 my ( $self,$scalco ) = @_;
452 if ( $scalco ne $empty_string ) {
453  
454 $suutm->{_scalco} = $scalco;
455 $suutm->{_note} = $suutm->{_note}.' scalco='.$suutm->{_scalco};
456 $suutm->{_Step} = $suutm->{_Step}.' scalco='.$suutm->{_scalco};
457  
458 } else {
459 print("suutm, scalco, missing scalco,\n");
460 }
461 }
462  
463  
464 =head2 sub verbose
465  
466  
467 =cut
468  
469 sub verbose {
470  
471 my ( $self,$verbose ) = @_;
472 if ( $verbose ne $empty_string ) {
473  
474 $suutm->{_verbose} = $verbose;
475 $suutm->{_note} = $suutm->{_note}.' verbose='.$suutm->{_verbose};
476 $suutm->{_Step} = $suutm->{_Step}.' verbose='.$suutm->{_verbose};
477  
478 } else {
479 print("suutm, verbose, missing verbose,\n");
480 }
481 }
482  
483  
484 =head2 sub xoff
485  
486  
487 =cut
488  
489 sub xoff {
490  
491 my ( $self,$xoff ) = @_;
492 if ( $xoff ne $empty_string ) {
493  
494 $suutm->{_xoff} = $xoff;
495 $suutm->{_note} = $suutm->{_note}.' xoff='.$suutm->{_xoff};
496 $suutm->{_Step} = $suutm->{_Step}.' xoff='.$suutm->{_xoff};
497  
498 } else {
499 print("suutm, xoff, missing xoff,\n");
500 }
501 }
502  
503  
504 =head2 sub ynoff
505  
506  
507 =cut
508  
509 sub ynoff {
510  
511 my ( $self,$ynoff ) = @_;
512 if ( $ynoff ne $empty_string ) {
513  
514 $suutm->{_ynoff} = $ynoff;
515 $suutm->{_note} = $suutm->{_note}.' ynoff='.$suutm->{_ynoff};
516 $suutm->{_Step} = $suutm->{_Step}.' ynoff='.$suutm->{_ynoff};
517  
518 } else {
519 print("suutm, ynoff, missing ynoff,\n");
520 }
521 }
522  
523  
524 =head2 sub ysoff
525  
526  
527 =cut
528  
529 sub ysoff {
530  
531 my ( $self,$ysoff ) = @_;
532 if ( $ysoff ne $empty_string ) {
533  
534 $suutm->{_ysoff} = $ysoff;
535 $suutm->{_note} = $suutm->{_note}.' ysoff='.$suutm->{_ysoff};
536 $suutm->{_Step} = $suutm->{_Step}.' ysoff='.$suutm->{_ysoff};
537  
538 } else {
539 print("suutm, ysoff, missing ysoff,\n");
540 }
541 }
542  
543  
544 =head2 sub zkey
545  
546  
547 =cut
548  
549 sub zkey {
550  
551 my ( $self,$zkey ) = @_;
552 if ( $zkey ne $empty_string ) {
553  
554 $suutm->{_zkey} = $zkey;
555 $suutm->{_note} = $suutm->{_note}.' zkey='.$suutm->{_zkey};
556 $suutm->{_Step} = $suutm->{_Step}.' zkey='.$suutm->{_zkey};
557  
558 } else {
559 print("suutm, zkey, missing zkey,\n");
560 }
561 }
562  
563  
564 =head2 sub get_max_index
565  
566 max index = number of input variables -1
567
568 =cut
569
570 sub get_max_index {
571 my ($self) = @_;
572 my $max_index = 10;
573  
574 return($max_index);
575 }
576
577
578 1;