« lib/App/SeismicUnixGui/configs/big_streams/RestoreProject_config.pm
↑ Summary
lib/App/SeismicUnixGui/configs/big_streams/Sucat_config.pm »
| 1 | package App::SeismicUnixGui::configs::big_streams::Sseg2su_config; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PERL PROGRAM NAME: Sseg2su_config.pm | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | DATE: July 29 2016 | ||
| 10 | April 4, 2018 V 1.0.2 | ||
| 11 | |||
| 12 | DESCRIPTION Combines configuration variables | ||
| 13 | both from a simple text file and from | ||
| 14 | from additional packages. | ||
| 15 | Takes seg2-formatted data and converts to | ||
| 16 | su fomratted data with SIOSEIS (USC) | ||
| 17 | |||
| 18 | USED FOR | ||
| 19 | Upper-level variables | ||
| 20 | definitions in Sseg2su | ||
| 21 | Seismic data is assumed currently to be in | ||
| 22 | dat/seg2 format, as output by Geometerics | ||
| 23 | |||
| 24 | |||
| 25 | BASED ON: | ||
| 26 | Version X Based on linux command "cat" | ||
| 27 | Version XX based on Sucat.pm June 29 2016 | ||
| 28 | Added a simple configuration file readable | ||
| 29 | and writable using Config::Simple (CPAN) | ||
| 30 | Version 1.0.2 derives from Sseg2su_config.pl | ||
| 31 | |||
| 32 | |||
| 33 | Needs: Simple (ASCII) local configuration | ||
| 34 | file is Sseg2su.config | ||
| 35 | Needs sioseis executable already installed | ||
| 36 | sioseis binary executable must be automatically available | ||
| 37 | pn a system path. | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | =head2 EXAMPLE configuration file | ||
| 42 | |||
| 43 | A local onfiguration file | ||
| 44 | An example Sseg2su.config contains: | ||
| 45 | |||
| 46 | $number_of_files = 38; | ||
| 47 | $first_file_number = 1000; | ||
| 48 | |||
| 49 | print("number of files is $number_of_files\n"); | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | use Moose; | ||
| 54 | our $VERSION = '1.0.2'; | ||
| 55 | use App::SeismicUnixGui::misc::control '0.0.3'; | ||
| 56 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 57 | use aliased 'App::SeismicUnixGui::misc::config_superflows'; | ||
| 58 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 59 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 60 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su); | ||
| 61 | |||
| 62 | my $get = L_SU_global_constants->new(); | ||
| 63 | my $config_superflows = config_superflows->new(); | ||
| 64 | my $control = control->new(); | ||
| 65 | my $Project = Project_config->new(); | ||
| 66 | |||
| 67 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 68 | my $superflow_config_names = $get->superflow_config_names_aref(); | ||
| 69 | |||
| 70 | # WARNING---- watch out for missing underscore!! | ||
| 71 | # print("1. Sseg2su_config,superflow_config_name : $$superflow_config_names[0]\n"); | ||
| 72 | |||
| 73 | =head2 private hash | ||
| 74 | |||
| 75 | =cut | ||
| 76 | |||
| 77 | my $Sseg2su_config = { | ||
| 78 | _prog_name => '', | ||
| 79 | _values_aref => '', | ||
| 80 | }; | ||
| 81 | |||
| 82 | # set the superflow name: 9 is for Sseg2su | ||
| 83 | |||
| 84 | sub get_values { | ||
| 85 | my ($self) = @_; | ||
| 86 | |||
| 87 | # Warning: set using a scalar reference | ||
| 88 | $Sseg2su_config->{_prog_name} = \@{$superflow_config_names}[9]; | ||
| 89 | |||
| 90 | # print("Sseg2su_config, prog_name : @{$superflow_config_names}[9]\n"); | ||
| 91 | |||
| 92 | $config_superflows->set_program_name( $Sseg2su_config->{_prog_name} ); | ||
| 93 | |||
| 94 | # parameter values from superflow configuration file | ||
| 95 | $Sseg2su_config->{_values_aref} = $config_superflows->get_values(); | ||
| 96 | |||
| 97 | # print("Sseg2su_config,values=@{$Sseg2su->{_values_aref}}\n"); | ||
| 98 | |||
| 99 | my $number_of_files = @{ $Sseg2su_config->{_values_aref} }[0]; | ||
| 100 | my $first_file_number = @{ $Sseg2su_config->{_values_aref} }[1]; | ||
| 101 | |||
| 102 | =head2 LOCAL VARIABLES FOR THIS PROJECT | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | my $CFG = { | ||
| 107 | seg2su => { | ||
| 108 | 1 => { | ||
| 109 | number_of_files => $number_of_files, | ||
| 110 | first_file_number => $first_file_number | ||
| 111 | } | ||
| 112 | } | ||
| 113 | }; # end of CFG hash | ||
| 114 | |||
| 115 | return ( $CFG, $Sseg2su_config->{_values_aref} ) | ||
| 116 | ; # hash and arrary reference | ||
| 117 | |||
| 118 | }; # end of sub get_values | ||
| 119 | |||
| 120 | =head2 sub get_max_index | ||
| 121 | |||
| 122 | max index = number of input variables -1 | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub get_max_index { | ||
| 127 | my ($self) = @_; | ||
| 128 | |||
| 129 | # only file_name : index=1 | ||
| 130 | my $max_index = 1; | ||
| 131 | |||
| 132 | return ($max_index); | ||
| 133 | } | ||
| 134 | |||
| 135 | 1; # end of package |