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

filter: Statementstmt 0.0% 0 / 151 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 31 Podpod 0.0% 0 / 19 totaltotal 0.0% 0 / 227 CC 14 SCAR 14.7
CC
14
Cov
0%
gather_header
6.0
offset_type
6.0
gather_type
6.0
CRAP 4.4
1 package App::SeismicUnixGui::big_streams::iBottomMute;
2  
3 =head1 DOCUMENTATION
4 =head2 SYNOPSIS
5  
6 PERL PROGRAM NAME: iBottomMute.pm
7 AUTHOR: Juan Lorenzo
8 DATE: Sept. 14 2015
9 DATE: June 12, 2017 adapted from iTop_Mute3.pm
10
11  
12 DESCRIPTION:
13 Package used for interactive bottom mute
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4
20 Examples
21  
22 =head3 SEISMIC UNIX NOTES
23  
24 =head4 CHANGES and their DATES
25  
26  
27 =cut
28  
29 =head2 STEPS
30  
31 1. define the types of variables you are using
32 these would be the values you enter into
33 each of the Seismic Unix programs each of the
34 Seismic Unix programs
35  
36 2. build a list or hash with all the possible variable
37 names you may use and you can even change them
38  
39 set defaults
40  
41 VELAN DATA
42 m/s
43  
44 =cut
45  
46 =head2 Import
47  
48 packages
49 directory definitions
50  
51 =cut
52  
53 use Moose;
54 our $VERSION = '1.0.3';
55 use aliased 'App::SeismicUnixGui::sunix::shell::cp';
56 use aliased 'App::SeismicUnixGui::misc::flow';
57 use aliased 'App::SeismicUnixGui::big_streams::iApply_bottom_mute';
58 use aliased 'App::SeismicUnixGui::big_streams::iSave_bottom_mute_picks';
59 use aliased 'App::SeismicUnixGui::big_streams::iSelect_tr_Sumute_bottom';
60 use aliased 'App::SeismicUnixGui::big_streams::iBottomMutePicks2par';
61 use aliased 'App::SeismicUnixGui::misc::message';
62 use aliased 'App::SeismicUnixGui::misc::old_data';
63 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
64 use App::SeismicUnixGui::misc::SeismicUnix
65 qw($on $off $in $to $go $ibot_mute_par_ $ibot_mute_check_pickfile_ $false $true );
66 use aliased 'App::SeismicUnixGui::messages::SuMessages';
67  
68 =head2 establish private hash of shared variables
69  
70 =cut
71  
72 my $iBottomMute = {
73 _gather_header => '',
74 _offset_type => '',
75 _gather_num => '',
76 _gather_num_suffix => '',
77 _exists => '',
78 _file_in => '',
79 _freq => '',
80 _gather_type => '',
81 _min_amplitude => '',
82 _max_amplitude => '',
83 _next_step => '',
84 _number_of_tries => '',
85 _TX_inbound => '',
86 _TX_outbound => '',
87 _textfile_in => '',
88 _textfile_out => ''
89 };
90  
91 =head2 instantiate
92  
93 programs
94  
95 =cut
96  
97 my $cp = cp->new();
98 my $log = message->new();
99 my $run = flow->new();
100 my $iApply_bottom_mute = iApply_bottom_mute->new();
101 my $iSelect_tr_Sumute_bottom = iSelect_tr_Sumute_bottom->new();
102 my $iPicks2par = iBottomMutePicks2par->new();
103 my $check4old_data = old_data->new();
104 my $Project = Project_config->new();
105 my $iSave_bottom_mute_picks = iSave_bottom_mute_picks->new();
106 my $SuMessages = SuMessages->new();
107  
108 my ($DATA_SEISMIC_TXT)= $Project->DATA_SEISMIC_TXT();
109 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
110 my ($date) = $Project->date();
111  
112 =head2
113
114 declare variables types
115 establish just the locally scoped variables
116  
117 =cut
118  
119 my ( @flow, @cp, @items );
120  
121 =head2 subroutine clear
122  
123 sets all variable strings to ''
124  
125 =cut
126  
127 sub clear {
128 $iBottomMute->{_gather_num} = '';
129 $iBottomMute->{_gather_type} = '';
130 $iBottomMute->{_gather_header} = '';
131 $iBottomMute->{_offset_type} = '';
132 $iBottomMute->{_gather_num_suffix} = '';
133 $iBottomMute->{_exists} = '';
134 $iBottomMute->{_file_in} = '';
135 $iBottomMute->{_freq} = '';
136 $iBottomMute->{_min_amplitude} = '';
137 $iBottomMute->{_max_amplitude} = '';
138 $iBottomMute->{_next_step} = '';
139 $iBottomMute->{_number_of_tries} = '';
140 $iBottomMute->{_textfile_in} = '';
141 $iBottomMute->{_textfile_out} = '';
142 $iBottomMute->{_TX_inbound} = '';
143 $iBottomMute->{_TX_outbound} = '';
144 }
145  
146 =head2 subroutine gather_header
147  
148 define which values to use in the xaxis
149  
150 =cut
151  
152 sub gather_header {
153 my ( $variable, $gather_header ) = @_;
154 $iBottomMute->{_gather_header} = $gather_header
155 if defined($gather_header);
156 }
157  
158 =head2 subroutine offset_type
159  
160 define which values to use in the xaxis
161  
162 =cut
163  
164 sub offset_type {
165 my ( $variable, $offset_type ) = @_;
166 $iBottomMute->{_offset_type} = $offset_type if defined($offset_type);
167  
168 #print("offset type -2 $offset_type\n\n");
169 }
170  
171 =head2 subroutine gather_type
172  
173 define which family of messages to use
174  
175 =cut
176  
177 sub gather_type {
178 my ( $variable, $gather_type ) = @_;
179 $iBottomMute->{_gather_type} = $gather_type if defined($gather_type);
180 }
181  
182 =head2 subroutine iBM_Select_tr_Sumute_bottom_
183 Select mute points in traces
184 provide file name
185
186 =cut
187  
188 sub iBM_Select_tr_Sumute_bottom {
189 $iSelect_tr_Sumute_bottom->gather_type( $iBottomMute->{_gather_type} );
190 $iSelect_tr_Sumute_bottom->offset_type( $iBottomMute->{_offset_type} );
191 $iSelect_tr_Sumute_bottom->gather_header( $iBottomMute->{_gather_header} );
192 $iSelect_tr_Sumute_bottom->file_in( $iBottomMute->{_file_in} );
193 $iSelect_tr_Sumute_bottom->freq( $iBottomMute->{_freq} );
194 $iSelect_tr_Sumute_bottom->gather_num( $iBottomMute->{_gather_num} );
195 $iSelect_tr_Sumute_bottom->min_amplitude( $iBottomMute->{_min_amplitude} );
196 $iSelect_tr_Sumute_bottom->max_amplitude( $iBottomMute->{_max_amplitude} );
197 $iSelect_tr_Sumute_bottom->number_of_tries(
198 $iBottomMute->{_number_of_tries} );
199 $iSelect_tr_Sumute_bottom->calcNdisplay();
200 }
201  
202 =head2 subroutine iBM_Apply_bottom_mute
203  
204 Mute the data using selected parameters
205
206 =cut
207  
208 sub iBM_Apply_bottom_mute {
209 $iApply_bottom_mute->file_in( $iBottomMute->{_file_in} );
210 $iApply_bottom_mute->gather_header( $iBottomMute->{_gather_header} );
211 $iApply_bottom_mute->offset_type( $iBottomMute->{_offset_type} );
212 $iApply_bottom_mute->freq( $iBottomMute->{_freq} );
213 $iApply_bottom_mute->gather_num( $iBottomMute->{_gather_num} );
214 $iApply_bottom_mute->min_amplitude( $iBottomMute->{_min_amplitude} );
215 $iApply_bottom_mute->max_amplitude( $iBottomMute->{_max_amplitude} );
216 $iApply_bottom_mute->calcNdisplay();
217 }
218  
219 =head2 subroutine iPicks2par
220  
221 convert format of pick files for use later
222 into "par" format
223
224 =cut
225  
226 sub iPicks2par {
227 $iPicks2par->file_in( $iBottomMute->{_file_in} );
228 $iPicks2par->calc();
229 }
230  
231 =head2 subroutine iBM_Save_bottom_mute_picks
232  
233 save pick files for later use
234
235 =cut
236  
237 sub iBM_Save_bottom_mute_picks {
238 print("iBM_save\n");
239 $iSave_bottom_mute_picks->gather_num( $iBottomMute->{_gather_num} );
240 $iSave_bottom_mute_picks->gather_header( $iBottomMute->{_gather_header} );
241 $iSave_bottom_mute_picks->gather_type( $iBottomMute->{_gather_type} );
242 $iSave_bottom_mute_picks->file_in( $iBottomMute->{_file_in} );
243 $iSave_bottom_mute_picks->calc();
244 }
245  
246 =head2 sub set_message
247  
248 define the message family (type) to use
249 also set the gather nuimber (TODO: move option elsewhere)
250  
251 =cut
252  
253 sub set_message {
254 my ( $variable, $type ) = @_;
255 $iBottomMute->{_message_type} = $type if defined($type);
256 $SuMessages->set( $iBottomMute->{_message_type} );
257  
258 =head2
259  
260 update gather number for messages
261  
262 =cut
263  
264 $SuMessages->gather_num( $iBottomMute->{_gather_num} );
265 $SuMessages->gather_header( $iBottomMute->{_gather_header} );
266 $SuMessages->gather_type( $iBottomMute->{_gather_type} );
267 }
268  
269 =head2 subroutine iBM_message
270  
271 instructions
272  
273 =cut
274  
275 sub iBM_message {
276 my ( $variable, $instructions ) = @_;
277 $iBottomMute->{_instructions} = $instructions if defined($instructions);
278  
279 =head2
280 update gather number for messages
281 =cut
282  
283 $SuMessages->gather_num( $iBottomMute->{_gather_num} );
284 $SuMessages->instructions( $iBottomMute->{_instructions} );
285 $SuMessages->gather_header( $iBottomMute->{_gather_header} );
286 $SuMessages->gather_type( $iBottomMute->{_gather_type} );
287 }
288  
289 =head2
290  
291 look for old data
292  
293 Are there old picks to read?
294 These old picks are of a type e.g. velan or gather
295
296  
297 =cut
298  
299 sub type {
300  
301 my ( $variable, $type ) = @_;
302
303 $iBottomMute->{_type} = $type if defined($type);
304 $check4old_data->gather_num( $iBottomMute->{_gather_num} );
305 $check4old_data->file_in( $iBottomMute->{_file_in} );
306 $iBottomMute->{_exists} = $check4old_data->type( $iBottomMute->{_type} );
307  
308 return $iBottomMute->{_exists};
309 }
310  
311 =head2 subroutine gather_num
312  
313 sets gather number to consider
314  
315 =cut
316  
317 sub gather_num {
318 my ( $variable, $gather_num ) = @_;
319 $iBottomMute->{_gather_num} = $gather_num if defined($gather_num);
320 $iBottomMute->{_gather_num_suffix} = '_gather' . $iBottomMute->{_gather_num}
321  
322 }
323  
324 =head2
325  
326 subroutine file_in
327 Required file name
328 on which to pick bottom mute values
329  
330 =cut
331  
332 sub file_in {
333 my ( $variable, $file_in ) = @_;
334 $iBottomMute->{_file_in} = $file_in if defined($file_in);
335  
336 #print("file name is $iBottomMute->{_file_in} \n\n");
337 }
338  
339 =head2
340  
341 subroutine data_scale
342 Required data plotting scale
343  
344 =cut
345  
346 sub data_scale {
347 my ( $variable, $data_scale ) = @_;
348 $iBottomMute->{_data_scale} = $data_scale if defined($data_scale);
349  
350 #print("ds=$iBottomMute->{_data_scale}\n\n");
351 }
352  
353 =head2
354  
355 subroutine freq
356 creates the bandpass frequencies to filter data before
357 conducting amplitude analysis
358 e.g., "3,6,40,50"
359
360 =cut
361  
362 sub freq {
363 my ( $variable, $freq ) = @_;
364 $iBottomMute->{_freq} = $freq if defined($freq);
365  
366 #print("freq is $iBottomMute->{_freq}\n\n");
367 }
368  
369 =head2
370  
371 subroutine maximum amplitude to plot
372  
373 =cut
374  
375 sub max_amplitude {
376 my ( $variable, $max_amplitude ) = @_;
377 $iBottomMute->{_max_amplitude} = $max_amplitude
378 if defined($max_amplitude);
379  
380 #print("max_amplitude is $iBottomMute->{_max_amplitude}\n\n");
381 }
382  
383 =head2
384  
385 subroutine minumum amplitude to plot
386  
387 =cut
388  
389 sub min_amplitude {
390 my ( $variable, $min_amplitude ) = @_;
391 $iBottomMute->{_min_amplitude} = $min_amplitude
392 if defined($min_amplitude);
393  
394 #print("min_amplitude is $iBottomMute->{_min_amplitude}\n\n");
395 }
396  
397 =head2
398  
399 subroutine number_of_tries
400 required count of the number of attempts
401 at estimating the velocity
402  
403 =cut
404  
405 sub number_of_tries {
406 my ( $variable, $number_of_tries ) = @_;
407 $iBottomMute->{_number_of_tries} = $number_of_tries
408 if defined($number_of_tries);
409  
410 #print("number_of_tries is $iBottomMute->{_number_of_tries} \n\n");
411 }
412  
413 =head2
414  
415 subroutine icp_sorted_2_old_picks
416 When user wants to recheck the data
417 this subroutine will allow the user to
418 recheck using an old sorted file
419 Juan M. Lorenzo
420 Jan 10 2010
421  
422 input file is ivpicks_sorted
423 output pick file
424 text file out: ivpicks_old
425  
426  
427 =cut
428  
429 sub icp_sorted2oldpicks {
430  
431 my ( $inbound, $outbound );
432 my ($writefile_out);
433 my ($flow);
434 my ( $suffix, $sortfile_in, $sorted_suffix, $XTpicks_out, $XTpicks_in );
435  
436 # suffixes
437 $sorted_suffix = '_sorted';
438 $suffix = '_gather' . $iBottomMute->{_gather_num};
439  
440 #XT file names
441 $XTpicks_in = 'XTpicks_old' . $sorted_suffix;
442 $XTpicks_out = 'XTpicks_old';
443  
444 # sort file names
445 $sortfile_in = $XTpicks_in;
446 $inbound =
447 $DATA_SEISMIC_TXT . '/'
448 . $sortfile_in . '_'
449 . $iBottomMute->{_file_in} . '_'
450 . $iBottomMute->{_gather_num_suffix};
451  
452 # TX write file names
453 $writefile_out = $XTpicks_out;
454 $outbound =
455 $DATA_SEISMIC_TXT . '/'
456 . $writefile_out . '_'
457 . $iBottomMute->{_file_in} . '_'
458 . $iBottomMute->{_gather_num_suffix};
459  
460 $cp->from($inbound);
461 $cp->to($outbound);
462 $cp[1] = $cp->Step();
463  
464 =head2
465  
466 DEFINE FLOW(S)
467  
468 =cut
469  
470 @items = ( $cp[1] );
471 $flow[1] = $run->modules( \@items );
472  
473 =head2
474  
475 RUN FLOW(S)
476  
477 =cut
478  
479 $run->flow( \$flow[1] );
480  
481 =head2
482  
483 LOG FLOW(S)TO SCREEN AND FILE
484  
485 =cut
486  
487 #print "$flow[1]\n";
488 #$log->file($flow[1]);
489  
490 #end of copy of XT old picks sorted to iXTpicks_old
491 }
492  
493 1;