lib/App/SeismicUnixGui/sunix/filter/sueipofi.pm untested

filter: Statementstmt 0.0% 0 / 98 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 / 146 CC 10 SCAR 15.6
CC
10
Cov
0%
dt
6.0
file
6.0
interp
6.0
CRAP 4.8
1 package App::SeismicUnixGui::sunix::filter::sueipofi;
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 SUEIPOFI - EIgenimage (SVD) based POlarization FIlter for
25  
26 three-component data
27  
28  
29  
30 sueipofi <stdin >stdout [optional parameters]
31  
32  
33  
34 Required parameters:
35  
36 none
37  
38  
39  
40 Optional parameters:
41  
42 dt=(from header) time sampling intervall in seconds
43  
44 wl=0.1 SVD time window length in seconds
45  
46 pwr=1.0 exponent of filter weights
47  
48 interp=cubic interpolation between initially calculated
49  
50 weights, choose "cubic" or "linear
51  
52 verbose=0 1 = echo additional information
53  
54  
55  
56 file=polar base name for additional output file(s) of
57  
58 filter weights (see flags below)
59  
60 rl1=0 1 = rectilinearity along first principal axis
61  
62 rl2=0 1 = rectilinearity along second principal axis
63  
64 pln=0 1 = planarity
65  
66  
67  
68  
69  
70 Notes:
71  
72 Three adjacent traces are considered as one three-component
73  
74 dataset.
75  
76  
77  
78 The filter is the sum of the first two eigenimages of the singular
79  
80 value decomposition (SVD) of the signal matrix (time window).
81  
82 Weighting functions depending on linearity and planarity of the
83  
84 signal are applied, additionally. To avoid edge effects, these are
85  
86 interpolated linearily or via cubic splines between initially
87  
88 calculated values of non-overlapping time windows.
89  
90 The algorithm is based on the assumption that the particle motion
91  
92 trajectory is essentially 2D (elliptical polarization).
93  
94  
95  
96 Caveat:
97  
98 Cubic spline interpolation may result in filter weights exceeding
99  
100 the set of values of initial weights. Weights outside the valid
101  
102 interval [0.0, 1.0] are clipped.
103  
104  
105  
106  
107  
108
109  
110 Author: Nils Maercklin,
111  
112 GeoForschungsZentrum (GFZ) Potsdam, Germany, 2001.
113  
114 E-mail: nils@gfz-potsdam.de
115  
116  
117  
118  
119  
120 References:
121  
122 Franco, R. de, and Musacchio, G., 2000: Polarization Filter with
123  
124 Singular Value Decomposition, submitted to Geophysics and
125  
126 published electronically in Geophysics online (www.geo-online.org).
127  
128 Jurkevics, A., 1988: Polarization analysis of three-comomponent
129  
130 array data, Bulletin of the Seismological Society of America,
131  
132 vol. 78, no. 5.
133  
134 Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P.
135  
136 1996: Numerical Recipes in C - The Art of Scientific Computing,
137  
138 Cambridge University Press, Cambridge.
139  
140  
141  
142 Trace header fields accessed: ns, dt
143  
144 Trace header fields modified: none
145  
146  
147  
148 =head2 User's notes (Juan Lorenzo)
149 untested
150  
151 =cut
152  
153  
154 =head2 CHANGES and their DATES
155  
156 =cut
157  
158 use Moose;
159 our $VERSION = '0.0.1';
160  
161  
162 =head2 Import packages
163  
164 =cut
165  
166 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
167  
168 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
169 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
170  
171  
172 =head2 instantiation of packages
173  
174 =cut
175  
176 my $get = L_SU_global_constants->new();
177 my $Project = Project_config->new();
178 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
179 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
180 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
181  
182 my $PS_SEISMIC = $Project->PS_SEISMIC();
183  
184 my $var = $get->var();
185 my $on = $var->{_on};
186 my $off = $var->{_off};
187 my $true = $var->{_true};
188 my $false = $var->{_false};
189 my $empty_string = $var->{_empty_string};
190  
191 =head2 Encapsulated
192 hash of private variables
193  
194 =cut
195  
196 my $sueipofi = {
197 _dt => '',
198 _file => '',
199 _interp => '',
200 _pln => '',
201 _pwr => '',
202 _rl1 => '',
203 _rl2 => '',
204 _verbose => '',
205 _wl => '',
206 _Step => '',
207 _note => '',
208  
209 };
210  
211 =head2 sub Step
212  
213 collects switches and assembles bash instructions
214 by adding the program name
215  
216 =cut
217  
218 sub Step {
219  
220 $sueipofi->{_Step} = 'sueipofi'.$sueipofi->{_Step};
221 return ( $sueipofi->{_Step} );
222  
223 }
224  
225  
226 =head2 sub note
227  
228 collects switches and assembles bash instructions
229 by adding the program name
230  
231 =cut
232  
233 sub note {
234  
235 $sueipofi->{_note} = 'sueipofi'.$sueipofi->{_note};
236 return ( $sueipofi->{_note} );
237  
238 }
239  
240  
241  
242 =head2 sub clear
243  
244 =cut
245  
246 sub clear {
247  
248 $sueipofi->{_dt} = '';
249 $sueipofi->{_file} = '';
250 $sueipofi->{_interp} = '';
251 $sueipofi->{_pln} = '';
252 $sueipofi->{_pwr} = '';
253 $sueipofi->{_rl1} = '';
254 $sueipofi->{_rl2} = '';
255 $sueipofi->{_verbose} = '';
256 $sueipofi->{_wl} = '';
257 $sueipofi->{_Step} = '';
258 $sueipofi->{_note} = '';
259 }
260  
261  
262 =head2 sub dt
263  
264  
265 =cut
266  
267 sub dt {
268  
269 my ( $self,$dt ) = @_;
270 if ( $dt ne $empty_string ) {
271  
272 $sueipofi->{_dt} = $dt;
273 $sueipofi->{_note} = $sueipofi->{_note}.' dt='.$sueipofi->{_dt};
274 $sueipofi->{_Step} = $sueipofi->{_Step}.' dt='.$sueipofi->{_dt};
275  
276 } else {
277 print("sueipofi, dt, missing dt,\n");
278 }
279 }
280  
281  
282 =head2 sub file
283  
284  
285 =cut
286  
287 sub file {
288  
289 my ( $self,$file ) = @_;
290 if ( $file ne $empty_string ) {
291  
292 $sueipofi->{_file} = $file;
293 $sueipofi->{_note} = $sueipofi->{_note}.' file='.$sueipofi->{_file};
294 $sueipofi->{_Step} = $sueipofi->{_Step}.' file='.$sueipofi->{_file};
295  
296 } else {
297 print("sueipofi, file, missing file,\n");
298 }
299 }
300  
301  
302 =head2 sub interp
303  
304  
305 =cut
306  
307 sub interp {
308  
309 my ( $self,$interp ) = @_;
310 if ( $interp ne $empty_string ) {
311  
312 $sueipofi->{_interp} = $interp;
313 $sueipofi->{_note} = $sueipofi->{_note}.' interp='.$sueipofi->{_interp};
314 $sueipofi->{_Step} = $sueipofi->{_Step}.' interp='.$sueipofi->{_interp};
315  
316 } else {
317 print("sueipofi, interp, missing interp,\n");
318 }
319 }
320  
321  
322 =head2 sub pln
323  
324  
325 =cut
326  
327 sub pln {
328  
329 my ( $self,$pln ) = @_;
330 if ( $pln ne $empty_string ) {
331  
332 $sueipofi->{_pln} = $pln;
333 $sueipofi->{_note} = $sueipofi->{_note}.' pln='.$sueipofi->{_pln};
334 $sueipofi->{_Step} = $sueipofi->{_Step}.' pln='.$sueipofi->{_pln};
335  
336 } else {
337 print("sueipofi, pln, missing pln,\n");
338 }
339 }
340  
341  
342 =head2 sub pwr
343  
344  
345 =cut
346  
347 sub pwr {
348  
349 my ( $self,$pwr ) = @_;
350 if ( $pwr ne $empty_string ) {
351  
352 $sueipofi->{_pwr} = $pwr;
353 $sueipofi->{_note} = $sueipofi->{_note}.' pwr='.$sueipofi->{_pwr};
354 $sueipofi->{_Step} = $sueipofi->{_Step}.' pwr='.$sueipofi->{_pwr};
355  
356 } else {
357 print("sueipofi, pwr, missing pwr,\n");
358 }
359 }
360  
361  
362 =head2 sub rl1
363  
364  
365 =cut
366  
367 sub rl1 {
368  
369 my ( $self,$rl1 ) = @_;
370 if ( $rl1 ne $empty_string ) {
371  
372 $sueipofi->{_rl1} = $rl1;
373 $sueipofi->{_note} = $sueipofi->{_note}.' rl1='.$sueipofi->{_rl1};
374 $sueipofi->{_Step} = $sueipofi->{_Step}.' rl1='.$sueipofi->{_rl1};
375  
376 } else {
377 print("sueipofi, rl1, missing rl1,\n");
378 }
379 }
380  
381  
382 =head2 sub rl2
383  
384  
385 =cut
386  
387 sub rl2 {
388  
389 my ( $self,$rl2 ) = @_;
390 if ( $rl2 ne $empty_string ) {
391  
392 $sueipofi->{_rl2} = $rl2;
393 $sueipofi->{_note} = $sueipofi->{_note}.' rl2='.$sueipofi->{_rl2};
394 $sueipofi->{_Step} = $sueipofi->{_Step}.' rl2='.$sueipofi->{_rl2};
395  
396 } else {
397 print("sueipofi, rl2, missing rl2,\n");
398 }
399 }
400  
401  
402 =head2 sub verbose
403  
404  
405 =cut
406  
407 sub verbose {
408  
409 my ( $self,$verbose ) = @_;
410 if ( $verbose ne $empty_string ) {
411  
412 $sueipofi->{_verbose} = $verbose;
413 $sueipofi->{_note} = $sueipofi->{_note}.' verbose='.$sueipofi->{_verbose};
414 $sueipofi->{_Step} = $sueipofi->{_Step}.' verbose='.$sueipofi->{_verbose};
415  
416 } else {
417 print("sueipofi, verbose, missing verbose,\n");
418 }
419 }
420  
421  
422 =head2 sub wl
423  
424  
425 =cut
426  
427 sub wl {
428  
429 my ( $self,$wl ) = @_;
430 if ( $wl ne $empty_string ) {
431  
432 $sueipofi->{_wl} = $wl;
433 $sueipofi->{_note} = $sueipofi->{_note}.' wl='.$sueipofi->{_wl};
434 $sueipofi->{_Step} = $sueipofi->{_Step}.' wl='.$sueipofi->{_wl};
435  
436 } else {
437 print("sueipofi, wl, missing wl,\n");
438 }
439 }
440  
441  
442 =head2 sub get_max_index
443  
444 max index = number of input variables -1
445
446 =cut
447
448 sub get_max_index {
449 my ($self) = @_;
450 my $max_index = 8;
451  
452 return($max_index);
453 }
454
455
456 1;