lib/App/SeismicUnixGui/configs/big_streams/Sucat_config.pm untested

filter: Statementstmt 0.0% 0 / 58 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
get_values
2.0
get_max_index
2.0
BEGIN
2.0
CRAP 2.0
1 package App::SeismicUnixGui::configs::big_streams::Sucat_config;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PERL PROGRAM NAME: Sucat_config.pm
8 AUTHOR: Juan Lorenzo
9 DATE: June 23 2016
10 April 10 2018
11
12 DESCRIPTION Combines configuration variables
13 both from a simple text file and from
14 from additional packages.
15  
16 USED FOR
17 Upper-level variable
18 definitions in Sucat
19 Can do sets of files with numerically
20 sequential names,
21 such as 1000.su, 1001.su, 1002.su etc.
22 Seismic data is assumed currently to be in
23 su format.
24  
25 Version 1 Based on linux command "cat"
26 Version 2 based on Sucat.pm June 29 2016
27 Added a simple configuration file readable
28 and writable using Config::Simple (CPAN)
29 Version 2.1 chnaged local configuration file name
30 from Sucat2.config Sucat.config
31 Version 2.2 derives from Sucat_config.pl
32 and removes dependency on Config::Simple (CPAN)
33
34
35 Notes: Simple configuration files is Sucat.config
36  
37 =cut
38  
39 =head2 Notes from bash
40  
41 cat file1 file2 >output file
42
43 =cut
44  
45 =head2 LOCAL VARIABLES FOR THIS PROJECT
46  
47 One example""
48 uncomment the following 3 lines if you need them, while
49 commenting out the last few lines as well
50 This package uses a list OR a continuous sequence of define
51 numieric names.
52  
53 #$number_of_files_in = 10;
54 #$first_file_number_in = 1;
55 #$last_file_number_in = 10;
56
57 Common to all data files
58 $input_suffix = '.su';
59  
60 Path to directory list
61 $list_directory = '.';
62  
63 One-line or multi-line list with sepcific
64 file names
65 but without an extension or suffix
66 $list = 'cat_list_good_sp';
67  
68 Catted file name
69 $output_base_file_name = 'All_good_sp';
70  
71 Another example:
72 first_file_number_in = 1000 a numerical value,
73 last_file_number_in = 1010 a numerical value,
74 number_of_files_in = 11 a numerical value,
75 #output_base_file_name = 1001_10
76 output_base_file_name = 1000_10
77 #output_base_file_name = All_good_SH_B4diff
78 #output_bas_file_name = SH_from_SW
79 #output_base_file_name = SH_from_NE
80 input_suffix = '_clean.su'
81 #list = list_good_shot_numbers
82 #list = list_good_shot_numbers
83 #list = list_good_SP_from_SW
84 data_type =
85 #list = list_good_SP_from_NE
86 list_directory= ./
87  
88 =cut
89  
90 use Moose;
91 our $VERSION = '2.0.2';
92 use App::SeismicUnixGui::misc::control '0.0.3';
93 use aliased 'App::SeismicUnixGui::misc::control';
94 use aliased 'App::SeismicUnixGui::misc::config_superflows';
95 use App::SeismicUnixGui::configs::big_streams::Project_config;
96 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
97  
98 my $get = L_SU_global_constants->new();
99 my $config_superflows = config_superflows->new();
100 my $control = control->new();
101 my $Project = App::SeismicUnixGui::configs::big_streams::Project_config->new();
102  
103 my $inbound_directory = $Project->DATA_SEISMIC_SU(); #defaulted
104 my $outbound_directory = $Project->DATA_SEISMIC_SU(); #defaulted
105 my $superflow_config_names = $get->superflow_config_names_aref();
106  
107 # WARNING---- watch out for missing underscore!!
108 # print("1. Sucat_config,superflow_config_name : $$superflow_config_names[10]\n");
109  
110 =head2 private hash
111  
112 =cut
113  
114 my $Sucat_config = {
115 _prog_name => '',
116 _values_aref => '',
117 };
118  
119 # set the superflow name: 10 is for Sucat
120  
121 sub get_values {
122 my ($self) = @_;
123  
124 # Warning: set using a scalar reference
125 $Sucat_config->{_prog_name} = \@{$superflow_config_names}[10];
126  
127 # print("Sucat_config, prog_name : @{$superflow_config_names}[10]\n");
128  
129 $config_superflows->set_program_name( $Sucat_config->{_prog_name} );
130  
131 # parameter values from superflow configuration file
132 $Sucat_config->{_values_aref} = $config_superflows->get_values();
133  
134 # print("Sucat_config,values=@{$Sucat_config->{_values_aref}}\n");
135  
136 my $first_file_number_in = @{ $Sucat_config->{_values_aref} }[0];
137 my $last_file_number_in = @{ $Sucat_config->{_values_aref} }[1];
138 my $number_of_files_in = @{ $Sucat_config->{_values_aref} }[2];
139  
140 my $input_suffix = @{ $Sucat_config->{_values_aref} }[3];
141 my $input_name_prefix = @{ $Sucat_config->{_values_aref} }[4];
142 my $input_name_extension = @{ $Sucat_config->{_values_aref} }[5];
143 my $list = @{ $Sucat_config->{_values_aref} }[6];
144 my $output_base_file_name = @{ $Sucat_config->{_values_aref} }[7];
145 my $alternative_inbound_directory = @{ $Sucat_config->{_values_aref} }[8];
146 my $alternative_outbound_directory = @{ $Sucat_config->{_values_aref} }[9];
147  
148 my $CFG = {
149 sucat => {
150 1 => {
151 first_file_number_in => $first_file_number_in,
152 last_file_number_in => $last_file_number_in,
153 number_of_files_in => $number_of_files_in,
154 output_base_file_name => $output_base_file_name,
155 input_suffix => $input_suffix,
156 input_name_prefix => $input_name_prefix,
157 input_name_extension => $input_name_extension,
158 list => $list,
159 alternative_inbound_directory => $alternative_inbound_directory,
160 alternative_outbound_directory => $alternative_outbound_directory,
161 }
162 }
163 }; # end of CFG hash
164  
165 return ( $CFG, $Sucat_config->{_values_aref} ); # hash and arrary reference
166  
167 }; # end of sub get_values
168  
169 =head2 sub get_max_index
170  
171 max index = number of input variables -1
172  
173 =cut
174  
175 sub get_max_index {
176 my ($self) = @_;
177  
178 my $max_index = 9;
179  
180 return ($max_index);
181 }
182  
183 1;