lib/App/SeismicUnixGui/big_streams/iApply_top_mute.pm untested

filter: Statementstmt 0.0% 0 / 148 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 22 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 193 CC 8 SCAR 13.7
CC
8
Cov
0%
gather_header
6.0
offset_type
6.0
gather_num
6.0
CRAP 3.9
1 package App::SeismicUnixGui::big_streams::iApply_top_mute;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: iApply_top_mute
8 AUTHOR: Juan Lorenzo
9  
10 DESCRIPTION:
11 Purpose: Linear Top Mute of Data
12 Sept. 23, 2015: added oop functinality
13  
14 Modification: plotting functionality added with suxwigb
15 Modifier: Nathan Benton
16 Date: 07/09/2017
17 Purpose: viewing both image and wiggle plots for muting purposes
18 helps facilitate better muting of the surface wave - note that
19 the wiggle plotting was added for this very reason - viewing the
20 wiggle plot of each shotgather (or cmp) can sometimes be better than
21 just viewing the image plot, especially when a good or bad gain has
22 been applied
23  
24 =head2 USE
25  
26 =head2 NOTES
27  
28 TODO replace iApply_top_mute with iApply_mute with an adidtional method='purpse'
29  
30 =cut
31  
32 =head2
33  
34 needed packages
35  
36 =cut
37  
38 use Moose;
39 our $VERSION = '1.0.3';
40 use aliased 'App::SeismicUnixGui::misc::message';
41 use aliased 'App::SeismicUnixGui::misc::flow';
42 use aliased 'App::SeismicUnixGui::sunix::filter::sufilter';
43 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain';
44 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sumute';
45 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind';
46 use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb';
47 use aliased 'App::SeismicUnixGui::sunix::plot::suximage';
48 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
49 use aliased 'App::SeismicUnixGui::messages::SuMessages';
50  
51 use App::SeismicUnixGui::misc::SeismicUnix
52 qw($go $in $on $off $itop_mute $itemp_top_mute_picks_ $itemp_top_mute_num_points $itemp_top_mute_picks_sorted_par_ $itop_mute_par_ $suffix_su $suffix_hyphen $to);
53  
54 =head2
55  
56 inherit other packages
57 1. Instantiate classes
58 Create a new version of the package
59 Personalize to give it a new name if you wish
60 Use the following classes:
61  
62 =cut
63  
64 my $log = message->new();
65 my $run = flow->new();
66 my $sufilter = sufilter->new();
67 my $sugain = sugain->new();
68 my $sumute = sumute->new();
69 my $suwind = suwind->new();
70 my $suxwigb = suxwigb->new();
71 my $suximage = suximage->new();
72 my $Project = Project_config->new();
73 my $SuMessages = SuMessages->new();
74  
75 =head2
76  
77 Import file-name and directory definitions
78  
79 =cut
80  
81 use App::SeismicUnixGui::misc::SeismicUnix
82 qw($itemp_top_mute_picks_sorted_par_);
83  
84 my ($DATA_SEISMIC_TXT)= $Project->DATA_SEISMIC_TXT();
85 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
86  
87 =head2
88
89 establish just the locally scoped variables
90  
91 =cut
92  
93 my ( @items, @flow, @sugain, @sufilter, @suwind );
94 my ( @suximage, @suxwigb, @sumute ); #suxwigb added here by Nate B. (07/09/2017)
95 my ( $windowtitle, $base_caption );
96  
97 =head2
98  
99 hash array of important variables used within
100 this package
101 Assume that the parameter file already exists
102 Assume that the name of this parameter file is:
103 $itemp_top_mute_picks_sorted_par_.$iApply_top_mute->{_file_in}
104  
105 =cut
106  
107 my $iApply_top_mute = {
108 _gather_num => '',
109 _gather_header => '',
110 _offset_type => '',
111 _file_in => '',
112 _freq => '',
113 _inbound => '',
114 _message_type => '',
115 _ntaper => '',
116 _number_of_tries => '',
117 _textfile_in => '',
118 _parfile_in => '',
119 };
120  
121 =head2
122  
123 subroutine clear
124 to blank out hash array values
125  
126 =cut
127  
128 sub clear {
129 $iApply_top_mute->{_gather_num} = '';
130 $iApply_top_mute->{_file_in} = '';
131 $iApply_top_mute->{_freq} = '';
132 $iApply_top_mute->{_inbound} = '';
133 $iApply_top_mute->{_message_type} = '';
134 $iApply_top_mute->{_gather_header} = '';
135 $iApply_top_mute->{_offset_type} = '';
136 $iApply_top_mute->{_ntaper} = '';
137 $iApply_top_mute->{_number_of_tries} = '';
138 $iApply_top_mute->{_file_in} = '';
139 $iApply_top_mute->{_parfile_in} = '';
140 $iApply_top_mute->{_textfile_in} = '';
141 }
142  
143 =head2 subroutine gather_header
144  
145 define the header for the xmute values
146 binheader type value helps define the xmute values
147 e.g. if gather_header = 'gather'
148 the the xmute values are 'offset'
149  
150 =cut
151  
152 sub gather_header {
153 my ( $variable, $gather_header ) = @_;
154 $iApply_top_mute->{_gather_header} = $gather_header
155 if defined($gather_header);
156  
157 #print(" header type is $iApply_top_mute->{_gather_header}\n\n");
158 }
159  
160 =head2 subroutine offset_type
161  
162 define the header for the xmute values
163 offset type value helps define the xmute values
164 e.g. if offset_type = 'gather'
165 the the xmute values are 'offset'
166  
167 =cut
168  
169 sub offset_type {
170 my ( $variable, $offset_type ) = @_;
171 $iApply_top_mute->{_offset_type} = $offset_type if defined($offset_type);
172  
173 print(" header type is $iApply_top_mute->{_offset_type}\n\n");
174 }
175  
176 =head2 subroutine gather
177  
178 sets gather number to consider
179  
180 =cut
181  
182 sub gather_num {
183 my ( $variable, $gather_num ) = @_;
184 $iApply_top_mute->{_gather_num} = $gather_num if defined($gather_num);
185 }
186  
187 =head2
188  
189 subroutine freq
190 creates the bandpass frequencies to filter data
191 e.g., "3,6,40,50"
192
193 =cut
194  
195 sub freq {
196 my ( $variable, $freq ) = @_;
197 $iApply_top_mute->{_freq} = $freq if defined($freq);
198  
199 #print("freq is $iApply_top_mute->{_freq}\n\n");
200 }
201  
202 =head2
203  
204 subroutine file_in
205 Required file name
206 on which to apply top mute values
207  
208 =cut
209  
210 sub file_in {
211 my ( $variable, $file_in ) = @_;
212 $iApply_top_mute->{_file_in} = $file_in if defined($file_in);
213 $iApply_top_mute->{_inbound} =
214 $DATA_SEISMIC_SU . '/' . $iApply_top_mute->{_file_in} . $suffix_su;
215 }
216  
217 =head2
218  
219 subroutine minumum amplitude to plot
220  
221 =cut
222  
223 sub min_amplitude {
224 my ( $variable, $min_amplitude ) = @_;
225 $iApply_top_mute->{_min_amplitude} = $min_amplitude
226 if defined($min_amplitude);
227  
228 #print("min_amplitude is $iApply_top_mute->{_min_amplitude}\n\n");
229 }
230  
231 =head2
232  
233 subroutine maximum amplitude to plot
234  
235 =cut
236  
237 sub max_amplitude {
238 my ( $variable, $max_amplitude ) = @_;
239 $iApply_top_mute->{_max_amplitude} = $max_amplitude
240 if defined($max_amplitude);
241  
242 #print("max_amplitude is $iApply_top_mute->{_max_amplitude}\n\n");
243 }
244  
245 =head2 subroutine calcNdisplay
246  
247 main processing flow
248 calculate mute and display results
249  
250 =cut
251  
252 sub calcNdisplay {
253  
254 # print("iApply_top_mute, made it \n\n");
255  
256 =head2
257  
258 Assume that the parameter file already exists
259 Assume that the name of this parameter file is:
260 $itemp_top_mute_picks_sorted_par_.$iApply_top_mute->{_file_in}
261  
262 =cut
263  
264 $iApply_top_mute->{_parfile_in} =
265 $itemp_top_mute_picks_sorted_par_ . $iApply_top_mute->{_file_in};
266  
267 # print(
268 # "iApply_top_mute, mute pick file is $iApply_top_mute->{_parfile_in}\n\n"
269 # );
270  
271 =head2
272  
273 MUTE DATA by
274  
275 =cut
276  
277 $sumute->clear();
278 $sumute->par_directory('DATA_SEISMIC_TXT');
279 $sumute->par_file( $iApply_top_mute->{_parfile_in} );
280 $sumute->offset_word( $iApply_top_mute->{_offset_type} );
281  
282 # not taper applied
283 # $sumute ->ntaper($iApply_top_mute->{_ntaper});
284 $sumute->type('top');
285 $sumute[1] = $sumute->Step();
286  
287 =head2
288  
289 WINDOW DATA
290  
291 =cut
292  
293 $suwind->clear();
294 $suwind->setheaderword( $iApply_top_mute->{_gather_header} );
295 $suwind->min( $iApply_top_mute->{_gather_num} );
296 $suwind->max( $iApply_top_mute->{_gather_num} );
297  
298 # print("gather num is $iApply_top_mute->{_gather_num}\n\n");
299 $suwind[1] = $suwind->Step();
300  
301 $suwind->clear();
302  
303 #$suwind -> setheaderword('time');
304 $suwind->tmin(0);
305 $suwind->tmax(1);
306 $suwind[2] = $suwind->Step();
307  
308 =head2
309  
310 set filtering parameters
311  
312 =cut
313  
314 $sufilter->clear();
315 $sufilter->freq( $iApply_top_mute->{_freq} );
316 $sufilter[1] = $sufilter->Step();
317  
318 =head2
319  
320 GAIN DATA
321  
322 =cut
323  
324 $sugain->clear();
325 $sugain->pbal($on);
326 $sugain[1] = $sugain->Step();
327  
328 $sugain->clear();
329 $sugain->agc($on);
330 $sugain->width(0.1);
331  
332 # $sugain -> setdt(1000);
333 $sugain[2] = $sugain->Step();
334  
335 # $sugain->clear();
336 # $sugain->tpower(1.8);
337 # $sugain[3] = $sugain->Step();
338  
339 =head2
340  
341 DISPLAY DATA (SUXIMAGE)
342  
343 =cut
344  
345 $base_caption =
346 $iApply_top_mute->{_file_in}
347 . quotemeta(' f=')
348 . $iApply_top_mute->{_freq};
349 $windowtitle =
350 $iApply_top_mute->{_gather_header}
351 . quotemeta(' = ')
352 . $iApply_top_mute->{_gather_num};
353  
354 $suximage->clear();
355 $suximage->box_width(500);
356 $suximage->box_height(700);
357 $suximage->box_X0(100);
358 $suximage->box_Y0(200);
359 $suximage->title($base_caption);
360 $suximage->windowtitle($windowtitle);
361 $suximage->ylabel( quotemeta('TWTTs') );
362 $suximage->xlabel( $iApply_top_mute->{_offset_type} );
363 $suximage->legend($on);
364 $suximage->cmap('rgb0');
365 $suximage->loclip( $iApply_top_mute->{_min_amplitude} );
366 $suximage->hiclip( $iApply_top_mute->{_max_amplitude} );
367 $suximage->verbose($off);
368 $suximage[1] = $suximage->Step();
369  
370 =head2
371  
372 DISPLAY DATA (SUXWIGB)
373  
374 =cut
375  
376 $base_caption =
377 $iApply_top_mute->{_file_in}
378 . quotemeta(' f=')
379 . $iApply_top_mute->{_freq};
380 $windowtitle =
381 $iApply_top_mute->{_gather_header}
382 . quotemeta(' = ')
383 . $iApply_top_mute->{_gather_num};
384  
385 $suxwigb->clear();
386 $suxwigb->box_width(500);
387 $suxwigb->box_height(700);
388 $suxwigb->box_X0(700);
389 $suxwigb->box_Y0(200);
390 $suxwigb->title($base_caption);
391 $suxwigb->windowtitle($windowtitle);
392 $suxwigb->ylabel( quotemeta('TWTTs') );
393 $suxwigb->xlabel( $iApply_top_mute->{_offset_type} );
394 $suxwigb->clip('1.5'); #clip/perc set manually
395 $suxwigb->verbose($off);
396 $suxwigb[1] = $suxwigb->Step();
397  
398 =head2
399
400 DEFINE FLOW(S) - for both suximage AND suxwigb
401  
402 =cut
403  
404 #save copy for below
405 #@items = ($suwind[1],$in,$iApply_top_mute->{_inbound},$to,$suwind[2],$to,$sumute[1],$to,$sufilter[1],$to,$suximage[1],$go);
406  
407 #for suximage
408 @items = (
409 $suwind[1],
410 $in, $iApply_top_mute->{_inbound},
411 $to, $suwind[2],
412 $to, $sumute[1],
413 $to, $sugain[2],
414 $to, $suximage[1],
415 $go
416 );
417  
418 $flow[1] = $run->modules( \@items );
419  
420 #for suxwigb
421 @items = (
422 $suwind[1],
423 $in, $iApply_top_mute->{_inbound},
424 $to, $suwind[2],
425 $to, $sumute[1],
426 $to, $sugain[2],
427 $to, $suxwigb[1],
428 $go
429 );
430 $flow[2] = $run->modules( \@items );
431  
432 =head2
433  
434 RUN FLOW(S)
435 output copy of picked data points
436 only occurs after the number of tries
437 is updated
438  
439 =cut
440  
441 #for suximage
442 $run->flow( \$flow[1] );
443  
444 #for suxwigb
445 $run->flow( \$flow[2] );
446  
447 =head2
448  
449 LOG FLOW(S)TO SCREEN AND FILE
450  
451 =cut
452  
453 #for suximage
454 #print("iApply_top_mute:$flow[1]\n");
455 $log->file( $flow[1] );
456  
457 #for suxwigb
458 # print "iApply_top_mute: $flow[2]\n";
459  
460 } # end calcNdisplay subroutine
461  
462 1;