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

filter: Statementstmt 0.0% 0 / 60 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 85 CC 3 SCAR 11.5
CC
3
Cov
0%
file_in
6.0
type
6.0
calc
2.0
CRAP 3.1
1 package App::SeismicUnixGui::big_streams::iPicks2sort;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
6 use App::SeismicUnixGui::misc::control '0.0.3';
7 use aliased 'App::SeismicUnixGui::misc::control';
8 use aliased 'App::SeismicUnixGui::misc::message';
9 use aliased 'App::SeismicUnixGui::misc::flow';
10 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
11  
12 =head1 DOCUMENTATION
13  
14 =head2 SYNOPSIS System_Variables::
15  
16 PERL PROGRAM NAME:iPicks2sort.pm
17 AUTHOR: Juan Lorenzo
18 DATE: June 14 2019
19  
20 DESCRIPTION:
21  
22 Purpose: write data pairs to par format for input
23 into another progam
24  
25  
26 =head2 USE
27  
28 =head3 NOTES
29  
30 =head4
31 Examples
32  
33 =head3 SEISMIC UNIX NOTES
34  
35 =head4 CHANGES and their DATES
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 canSystem_Variables:: even change them
47  
48 =cut
49  
50 =pod
51  
52 instantiate classes
53  
54 =cut
55  
56 my $control = control->new();
57 my $get = L_SU_global_constants->new();
58 my $log = message->new();
59 my $run = flow->new();
60 my $Project = Project_config->new();
61  
62 my $var = $get->var();
63 my $empty_string = $var->{_empty_string};
64  
65 =pod
66
67 declare variables types
68 establish just the locally scoped variables
69  
70 =cut
71  
72 my ( @items, @flow );
73  
74 =pod
75  
76 create hash with important variables
77  
78 =cut
79  
80 my $iPicks2sort = {
81 _TX_inbound => '',
82 _TX_outbound => '',
83 _file_in => '',
84 _gather_num => '',
85 _exists => '',
86 _textfile_in => '',
87 _textfile_out => '',
88 _type => ''
89 };
90  
91 =head3
92  
93 Import file-name and directory definitions
94  
95 =cut
96  
97 use App::SeismicUnixGui::misc::SeismicUnix qw($true $false $in $out $to
98 $itemp_picks_ $itemp_picks_sorted_
99 $out $suffix_su);
100  
101 my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();
102  
103 =head2 subroutine calc
104  
105 main processing flow
106 sorts data
107
108 =cut
109  
110 sub calc {
111  
112 =head2 establish pfile names
113  
114  
115 =cut
116  
117 my $pick_file_in = $itemp_picks_ . $iPicks2sort->{_file_in};
118  
119 my $sorted_pick_file_out = $itemp_picks_sorted_ . $iPicks2sort->{_file_in};
120  
121 $iPicks2sort->{_TX_inbound} = $DATA_SEISMIC_TXT . '/' . $pick_file_in;
122 $iPicks2sort->{_TX_outbound} =
123 $DATA_SEISMIC_TXT . '/' . $sorted_pick_file_out;
124  
125 # SORT a TEXT FILE
126 my @sort;
127 $sort[1] = (
128 " sort \\
129 -n \\
130 "
131 );
132  
133 =head2 DEFINE FLOW(S)
134  
135 =cut
136  
137 # print("Regular xt data\n\n");
138  
139 @items = (
140 $sort[1], $in, $iPicks2sort->{_TX_inbound},
141 $out, $iPicks2sort->{_TX_outbound}
142 );
143  
144 $flow[1] = $run->modules( \@items );
145  
146 =head2
147  
148 RUN FLOW(S)
149 output copy of picked data points
150 only occurs after the number of tries
151 is updated
152  
153 =cut
154  
155 $run->flow( \$flow[1] );
156  
157 =pod
158  
159 LOG FLOW(S)TO SCREEN AND FILE
160  
161 =cut
162  
163 # print "$flow[1]\n";
164 # $log->file($flow[1]);
165  
166 } # end calc subroutine
167  
168 =head2 subroutine clear
169  
170 sets all variable strings to ''
171  
172 =cut
173  
174 sub clear {
175 $iPicks2sort->{_TX_inbound} = '';
176 $iPicks2sort->{_TX_outbound} = '';
177 $iPicks2sort->{_gather_num} = '';
178 $iPicks2sort->{_exists} = '';
179 $iPicks2sort->{_file_in} = '';
180 $iPicks2sort->{_textfile_in} = '';
181 $iPicks2sort->{_textfile_out} = '';
182 $iPicks2sort->{_type} = '';
183 }
184  
185 =head2 subroutine file_in
186  
187 Required file name
188 on which to pick x,t values
189  
190 =cut
191  
192 sub file_in {
193  
194 my ( $self, $file_in ) = @_;
195  
196 if ( defined $file_in && $file_in ne $empty_string ) {
197  
198 # e.g. 'sp1' becomes sp1
199 $control->set_infection($file_in);
200 $file_in = control->get_ticksBgone();
201 $iPicks2sort->{_file_in} = $file_in;
202  
203 # print("iPicks2sort, file_in: $iPicks2sort->{_file_in} \n");
204  
205 }
206 else {
207 print("iPicks2sort, file_in: unexpected file_in \n");
208 }
209 }
210  
211 =head2 sub type
212  
213 switches for old data of two different types
214  
215 for type: tx or taup
216  
217  
218 =cut
219  
220 sub type {
221 my ( $variable, $type ) = @_;
222 $iPicks2sort->{_type} = $iPicks2sort if defined($iPicks2sort);
223 }
224  
225 1;