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

filter: Statementstmt 0.0% 0 / 53 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 71 CC 3 SCAR 12.0
CC
3
Cov
0%
file_in
6.0
type
6.0
clear
2.0
CRAP 3.3
1 package App::SeismicUnixGui::big_streams::iTopMutePicks2par;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5 use aliased 'App::SeismicUnixGui::misc::message';
6 use aliased 'App::SeismicUnixGui::misc::flow';
7 use aliased 'App::SeismicUnixGui::misc::mkparfile';
8  
9 =head1 DOCUMENTATION
10  
11 =head2 SYNOPSIS
12  
13 PERL PROGRAM NAME:iTopMutePicks2par.pm
14 AUTHOR: Juan Lorenzo
15 DATE: May 5 2009
16  
17 DESCRIPTION:
18  
19 Purpose: write data pairs to par format for input to sumute
20  
21  
22 =head2 USE
23  
24 =head3 NOTES
25  
26 =head4
27 Examples
28  
29 =head3 SEISMIC UNIX NOTES
30  
31 =head4 CHANGES and their DATES
32  
33 V 1. May 5 2009
34 V2 for interactive top mute picks
35 V3 Sept.19 2015 perl oops for use with GUI
36  
37  
38 =head3 STEPS
39  
40 1. define the types of variables you are using
41 these would be the values you enter into
42 each of the Seismic Unix programs each of the
43 Seismic Unix programs
44  
45 2. build a list or hash with all the possible variable
46 names you may use and you can even change them
47  
48 =cut
49  
50 =pod
51  
52 instantiate classes
53  
54 =cut
55  
56 my $log = message->new();
57 my $run = flow->new();
58 my $mkparfile = mkparfile->new();
59  
60 =pod
61
62 declare variables types
63 establish just the locally scoped variables
64  
65 =cut
66  
67 my @mkparfile;
68 my ( $mkparfile_in, $mkparfile_inbound );
69 my ( $mkparfile_out, $mkparfile_outbound );
70 my ( @items, @flow );
71  
72 =pod
73  
74 create hash with important variables
75  
76 =cut
77  
78 my $iTopMutePicks2par = {
79 _TX_inbound => '',
80 _TX_outbound => '',
81 _taup_inbound => '',
82 _taup_outbound => '',
83 _gather_num => '',
84 _exists => '',
85 _textfile_in => '',
86 _textfile_out => '',
87 _type => ''
88 };
89  
90 =head3
91  
92 Import file-name and directory definitions
93  
94 =cut
95  
96 use App::SeismicUnixGui::misc::SeismicUnix
97 qw($true $false $in $out $to $itop_mute_par_ $itemp_top_mute_picks_ $itemp_top_mute_picks_sorted_par_ $out $suffix_su);
98 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
99 my $Project = Project_config->new();
100 my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();
101  
102 =head2 subroutine clear
103  
104 sets all variable strings to ''
105  
106 =cut
107  
108 sub clear {
109 $iTopMutePicks2par->{_TX_inbound} = '';
110 $iTopMutePicks2par->{_TX_outbound} = '';
111 $iTopMutePicks2par->{_taup_inbound} = '';
112 $iTopMutePicks2par->{_taup_outbound} = '';
113 $iTopMutePicks2par->{_gather_num} = '';
114 $iTopMutePicks2par->{_exists} = '';
115 $iTopMutePicks2par->{_textfile_in} = '';
116 $iTopMutePicks2par->{_textfile_out} = '';
117 $iTopMutePicks2par->{_type} = '';
118 }
119  
120 =head3 subroutine file_in
121  
122 Required file name
123 on which to pick top mute values
124  
125 =cut
126  
127 sub file_in {
128 my ( $variable, $file_in ) = @_;
129 $iTopMutePicks2par->{_file_in} = $file_in if defined($file_in);
130  
131 #print("file name is $iTopMutePicks2par->{_file_in} \n\n");
132 }
133  
134 =head3 sub type
135  
136 switches for old data of two different types
137  
138 for type: tx or taup
139  
140  
141 =cut
142  
143 sub type {
144 my ( $variable, $type ) = @_;
145 $iTopMutePicks2par->{_type} = $iTopMutePicks2par
146 if defined($iTopMutePicks2par);
147 }
148  
149 =pod subroutine calc
150  
151 main processing flow
152 reformats data
153  
154 =cut
155  
156 sub calc {
157  
158 =pod
159  
160 MAKE PARAMETER FILE
161 CONVERT TEXT FILE TO PAR FILE
162  
163 =cut
164  
165 =pod
166  
167 establish par file names
168  
169 TODO if no sorting is ever needed
170 rm file name from $itemp_top_mute_picks_sorted_par to itemp_top_mute_picks
171  
172 =cut
173  
174 $mkparfile_in = $itemp_top_mute_picks_ . $iTopMutePicks2par->{_file_in};
175 $mkparfile_out =
176 $itemp_top_mute_picks_sorted_par_ . $iTopMutePicks2par->{_file_in};
177  
178 $iTopMutePicks2par->{TX_inbound} = $DATA_SEISMIC_TXT . '/' . $mkparfile_in;
179 $iTopMutePicks2par->{TX_outbound} = $DATA_SEISMIC_TXT . '/' . $mkparfile_out;
180  
181 $mkparfile->clear();
182 $mkparfile->string1('tmute');
183 $mkparfile->string2('xmute');
184 $mkparfile[1] = $mkparfile->Step();
185  
186 # DEFINE FLOW(s)
187 # CONVERT t-p picks to t-trace picks
188 # $taup = $taup_data;
189 #
190 # if ($taup == $true) {
191 # print("Mute picks inbound file: $mkparfile_inbound[1]\n\n");
192 # print("This is taup data\n\n");
193 #
194 # ($ref_inbound) = iTop_Mute::tp_piks2ttr(\@mkparfile_inbound[1]);
195 #
196 # $flow[1] = (" \\
197 # $mkparfile[1] \\
198 # < $$ref_inbound[1] \\
199 # >$mkparfile_outbound[1] \\
200 # \\
201 # ");
202 #
203 # }
204 # elsif ($taup == $false) {
205  
206 # in the current flow below
207 # }
208  
209 =pod
210
211 DEFINE FLOW(S)
212  
213 =cut
214  
215 # print("Regular xt data\n\n");
216  
217 @items = (
218 $mkparfile[1], $in, $iTopMutePicks2par->{TX_inbound},
219 $out, $iTopMutePicks2par->{TX_outbound}
220 );
221 $flow[1] = $run->modules( \@items );
222  
223 =pod
224  
225 RUN FLOW(S)
226 output copy of picked data points
227 only occurs after the number of tries
228 is updated
229  
230 =cut
231  
232 $run->flow( \$flow[1] );
233  
234 =pod
235  
236 LOG FLOW(S)TO SCREEN AND FILE
237  
238 =cut
239  
240 # print "$flow[1]\n";
241 #$log->file($flow[1]);
242  
243 } # end calc subroutine
244  
245 1;