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

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