« lib/App/SeismicUnixGui/configs/big_streams/Synseis_config.pm
↑ Summary
lib/App/SeismicUnixGui/configs/big_streams/iPick_config.pm »
| 1 | package App::SeismicUnixGui::configs::big_streams::iBottomMute_config; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: iBottomMute_config.pm | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | DATE: July 27 2016 | ||
| 10 | DESCRIPTION Combines configuration variables | ||
| 11 | both from a simple text file and from | ||
| 12 | from additional packages. | ||
| 13 | |||
| 14 | USED FOR | ||
| 15 | Upper-level variable | ||
| 16 | definitions in iBottom_Mute | ||
| 17 | Seismic data is assumed currently to be in | ||
| 18 | su format. | ||
| 19 | |||
| 20 | BASED ON: | ||
| 21 | Based on linux command "cat" | ||
| 22 | Based on Sucat.pm June 29 2016 | ||
| 23 | Added a simple configuration file readable | ||
| 24 | and writable using Config::Simple (CPAN) | ||
| 25 | |||
| 26 | NEEDS: Simple (ASCII) local configuration | ||
| 27 | file is iBottomMute.config | ||
| 28 | |||
| 29 | MODIFICATIONS | ||
| 30 | June 12 adapted from Top_Mute3_config.pl | ||
| 31 | Jan 12 2017: remove Config::Simple dependency | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | =head2 | ||
| 36 | |||
| 37 | reads configuration variables from a | ||
| 38 | text file: iBottomMute.config | ||
| 39 | |||
| 40 | base_file_name = 30Hz_All_geom_geom | ||
| 41 | gather_header = fldr | ||
| 42 | offset_type = tracl | ||
| 43 | first_gather = 1 | ||
| 44 | gather_inc = 1 | ||
| 45 | last_gather = 100 | ||
| 46 | freq = 0,3,100,200 | ||
| 47 | gather_type = fldr | ||
| 48 | min_amplitude = .0 | ||
| 49 | max_amplitude = .75 | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | use Moose; | ||
| 54 | our $VERSION = '1.0.3'; | ||
| 55 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 56 | use aliased 'App::SeismicUnixGui::misc::config_superflows'; | ||
| 57 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 58 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su); | ||
| 59 | |||
| 60 | my $Project = Project_config->new(); | ||
| 61 | my $config_superflows = config_superflows->new(); | ||
| 62 | my $get = L_SU_global_constants->new(); | ||
| 63 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 64 | my $superflow_config_names = $get->superflow_config_names_aref(); | ||
| 65 | |||
| 66 | # WARNING---- watch out for missing underscore!! | ||
| 67 | |||
| 68 | =head2 private hash | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | my $iBottomMute_config = { | ||
| 73 | _prog_name => '', | ||
| 74 | _values_aref => '', | ||
| 75 | }; | ||
| 76 | |||
| 77 | # set the superflow name: 6 is for BottomMute-to-BottomMute | ||
| 78 | sub get_values { | ||
| 79 | |||
| 80 | my ($self) = @_; | ||
| 81 | |||
| 82 | # Warning: set using a scalar reference | ||
| 83 | $iBottomMute_config->{_prog_name} = \@{$superflow_config_names}[6]; | ||
| 84 | |||
| 85 | # print("iBBottomMute_config_config, prog_name : @{$superflow_config_names}[6]\n"); | ||
| 86 | |||
| 87 | $config_superflows->set_program_name( $iBottomMute_config->{_prog_name} ); | ||
| 88 | |||
| 89 | # parameter values from superflow configuration file | ||
| 90 | $iBottomMute_config->{_values_aref} = $config_superflows->get_values(); | ||
| 91 | |||
| 92 | # print("iBottomMute_config_config,values=@{$iBottomMute_config->{_values_aref}}\n"); | ||
| 93 | |||
| 94 | my $base_file_name = @{ $iBottomMute_config->{_values_aref} }[0]; | ||
| 95 | my $gather_header = @{ $iBottomMute_config->{_values_aref} }[1]; | ||
| 96 | my $offset_type = @{ $iBottomMute_config->{_values_aref} }[2]; | ||
| 97 | my $first_gather = @{ $iBottomMute_config->{_values_aref} }[3]; | ||
| 98 | my $gather_inc = @{ $iBottomMute_config->{_values_aref} }[4]; | ||
| 99 | my $last_gather = @{ $iBottomMute_config->{_values_aref} }[5]; | ||
| 100 | my $freq = @{ $iBottomMute_config->{_values_aref} }[6]; | ||
| 101 | my $gather_type = @{ $iBottomMute_config->{_values_aref} }[7]; | ||
| 102 | my $min_amplitude = @{ $iBottomMute_config->{_values_aref} }[8]; | ||
| 103 | my $max_amplitude = @{ $iBottomMute_config->{_values_aref} }[9]; | ||
| 104 | |||
| 105 | print("file name is $base_file_name\n\n"); | ||
| 106 | |||
| 107 | =head2 Example LOCAL VARIABLES FOR THIS PROJECT | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | my $CFG = { | ||
| 112 | sumute => { | ||
| 113 | 1 => { | ||
| 114 | gather_header => $gather_header, | ||
| 115 | offset_type => $offset_type, | ||
| 116 | first_gather => $first_gather, | ||
| 117 | gather_inc => $gather_inc, | ||
| 118 | last_gather => $last_gather, | ||
| 119 | freq => $freq, | ||
| 120 | gather_type => $gather_type, | ||
| 121 | min_amplitude => $min_amplitude, | ||
| 122 | max_amplitude => $max_amplitude, | ||
| 123 | }, | ||
| 124 | }, | ||
| 125 | sugain => { 1 => { freq => $freq, }, }, | ||
| 126 | base_file_name => $base_file_name, | ||
| 127 | }; # end of CFG hash | ||
| 128 | |||
| 129 | return ( $CFG, $iBottomMute_config->{_values_aref} ) | ||
| 130 | ; # hash and arrary reference | ||
| 131 | }; # end of sub get_values | ||
| 132 | |||
| 133 | =head2 sub get_max_index | ||
| 134 | |||
| 135 | max index = number of input variables -1 | ||
| 136 | |||
| 137 | =cut | ||
| 138 | |||
| 139 | sub get_max_index { | ||
| 140 | my ($self) = @_; | ||
| 141 | |||
| 142 | # only file_name : index=9 | ||
| 143 | my $max_index = 9; | ||
| 144 | |||
| 145 | return ($max_index); | ||
| 146 | } | ||
| 147 | |||
| 148 | 1; |