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

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