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

filter: Statementstmt 0.0% 0 / 47 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 / 65 CC 3 SCAR 12.0
CC
3
Cov
0%
cdp_num
6.0
file_in
6.0
clear
2.0
CRAP 3.3
1 package App::SeismicUnixGui::big_streams::iVpicks2par;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
6 use aliased 'App::SeismicUnixGui::big_streams::iWrite_All_iva_out';
7 use aliased 'App::SeismicUnixGui::misc::manage_files_by2';
8  
9 =head1 DOCUMENTATION
10  
11 =head2 SYNOPSIS
12  
13 PERL PROGRAM NAME: iVpicks2par
14 AUTHOR: Juan Lorenzo
15 DATE: Nov 1 2012,
16 sept. 13 2013
17 oct. 21 2013
18 July 15 2015
19  
20 DESCRIPTION:
21 Version: 1.1
22 Package used for interactive velocity analysis
23 Convert pick files into a format suvelan can use
24  
25 =head2 USE
26  
27 =head3 NOTES
28  
29 =head4
30 Examples
31  
32 =head3 SEISMIC UNIX NOTES
33  
34 =head4 CHANGES and their DATES
35  
36  
37 =cut
38  
39 =pod
40  
41 =head3 STEPS
42  
43 1. define the types of variables you are using
44 these would be the values you enter into
45 each of the Seismic Unix programs each of the
46 Seismic Unix programs
47  
48 2. build a list or hash with all the possible variable
49 names you may use and you can even change them
50  
51 =cut
52  
53 =pod
54  
55 set defaults
56  
57 VELAN DATA
58 m/s
59  
60
61 =cut
62  
63 my $iVpicks2par = {
64 _cdp_num => '',
65 _file_in => '',
66 _base_file_name => '',
67 };
68  
69 =pod =head3
70  
71 Import directory definitions
72  
73 =cut
74  
75 use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $in $to $go);
76 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
77 my $Project = Project_config->new();
78 my ($PL_SEISMIC) = $Project->PL_SEISMIC();
79  
80  
81 my $get = L_SU_global_constants->new();
82 my $var = $get->var();
83 my $empty_string = $var->{_empty_string};
84  
85 =pod
86  
87 instantiate programs
88  
89 =cut
90  
91 my $iWrite_All_iva_out = iWrite_All_iva_out->new();
92 my $test = manage_files_by2->new();
93  
94 =head2 subroutine clear
95  
96 sets all variable strings to ''
97  
98 =cut
99  
100 sub clear {
101 $iVpicks2par->{_cdp_num} = '';
102 $iVpicks2par->{_file_in} = '';
103 $iVpicks2par->{_base_file_name} = '';
104 }
105 my ( @suffix, @file_in, @sortfile_in, @inbound );
106 my ( @parfile_out, @outbound, @sort, @mkparfile );
107 my (@flow);
108  
109  
110 =pod
111  
112 =head2 subroutine cdp
113  
114 sets cdp number to consider
115  
116 =cut
117  
118 sub cdp_num {
119 my ( $variable, $cdp_num ) = @_;
120 $iVpicks2par->{_cdp_num} = $cdp_num if defined($cdp_num);
121 }
122  
123 =pod =head3
124  
125 subroutine file_in
126 Required file name
127 on which to perform velocity analyses
128  
129 =cut
130  
131 sub file_in {
132 my ( $variable, $file_in ) = @_;
133 $iVpicks2par->{_file_in} = $file_in if defined($file_in);
134  
135 #print("file name is $iVpicks2par->{_file_in} \n\n");
136 }
137  
138 =pod
139 =head3
140  
141 sort and properly format picks for seismic unix
142 Sunmo will need these values properly formatted
143  
144 =cut
145  
146 sub flows {
147  
148 # suffixes
149 $suffix[1] = '_cdp' . $iVpicks2par->{_cdp_num};
150  
151 # sort file names
152 $file_in[1] = $iVpicks2par->{_file_in};
153 $sortfile_in[1] = 'ivpicks_old' . '_' . $file_in[1] . $suffix[1];
154  
155 # $sortfile_out[1] = 'ivpicks_sorted_'.$file_in[1];
156 $inbound[1] = $PL_SEISMIC . '/' . $sortfile_in[1];
157  
158 # par file names
159 $parfile_out[1] = 'ivpicks_sorted_par_' . $file_in[1] . $suffix[1];
160 $outbound[1] = $PL_SEISMIC . '/' . $parfile_out[1];
161  
162 # my $data_scale = _get_data_scale();
163 # print("2. iVpicks2par, data_scale = $data_scale\n");
164  
165 # | awk '{print $1, $2* ${data_scale} }'
166 # SORT a TEXT FILE
167 $sort[1] = q(
168 sort -n );
169  
170 # CONVERT TEXT FILE TO PAR FILE
171 $mkparfile[1] = (
172 "mkparfile \\
173 string1=tnmo \\
174 string2=vnmo \\
175 "
176 );
177  
178 # Prepare picks for sunmo
179 # DEFINE FLOW(S)
180 $flow[1] = (
181 " \\
182 $sort[1] \\
183 < $inbound[1] | \\
184 $mkparfile[1] \\
185 >$outbound[1] \\
186 & \\
187 "
188 );
189  
190 # RUN FLOW(S)
191 system $flow[1];
192  
193 # system 'echo', $flow[1];
194 }
195  
196  
197 #end flows
198 # following line returns a "true" logical value to the program
199 1;