« lib/App/SeismicUnixGui/big_streams/SetProject.pl
↑ Summary
lib/App/SeismicUnixGui/big_streams/Sucat.pl »
| 1 | |||
| 2 | =head1 DOCUMENTATION | ||
| 3 | |||
| 4 | =head2 SYNOPSIS | ||
| 5 | |||
| 6 | |||
| 7 | PROGRAM NAME: Sseg2su | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | |||
| 10 | =head2 CHANGES and their DATES | ||
| 11 | |||
| 12 | DATE: Aug 9, 2011 | ||
| 13 | Version 1.1 July 29 2016 | ||
| 14 | Introduced pure textual configuration files | ||
| 15 | |||
| 16 | =head2 DESCRIPTION | ||
| 17 | |||
| 18 | File format conversiuon | ||
| 19 | Data format change from Seg2 ("DAT") | ||
| 20 | or geometrics format to su | ||
| 21 | |||
| 22 | =head2 REQUIRES | ||
| 23 | |||
| 24 | sioseis | ||
| 25 | lcoal configuration file called Sseg2su_config | ||
| 26 | |||
| 27 | =head2 Examples | ||
| 28 | |||
| 29 | For example, total number of files =74 first file is "1000.su" | ||
| 30 | |||
| 31 | =head2 STEPS | ||
| 32 | |||
| 33 | 1. use the local library of the user | ||
| 34 | 1.1 bring is user variables from a local file | ||
| 35 | 2. create instances of the needed subroutines | ||
| 36 | |||
| 37 | =head2 NOTES | ||
| 38 | |||
| 39 | We are using Moose. | ||
| 40 | Moose already declares that you need debuggers turned on | ||
| 41 | so you don't need a line like the following: | ||
| 42 | use warnings; | ||
| 43 | |||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | use Moose; | ||
| 48 | our $VERSION = '0.0.1'; | ||
| 49 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 50 | use aliased 'App::SeismicUnixGui::misc::readfiles'; | ||
| 51 | use aliased 'App::SeismicUnixGui::configs::big_streams::Sseg2su_config'; | ||
| 52 | |||
| 53 | =head2 Instantiate classes: | ||
| 54 | |||
| 55 | Create a new version of the package | ||
| 56 | with a unique name | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | my $read = readfiles->new(); | ||
| 61 | my $Project = Project_config->new(); | ||
| 62 | my $Sseg2su_config = Sseg2su_config->new(); | ||
| 63 | |||
| 64 | =head2 Get directory definitions | ||
| 65 | |||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU(); | ||
| 70 | my ($DATA_SEISMIC_SEG2) = $Project->DATA_SEISMIC_SEG2(); | ||
| 71 | |||
| 72 | =head2 Get variable values from local configuration file | ||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | my ( $CFG_h, $CFG_aref ) = $Sseg2su_config->get_values(); | ||
| 77 | |||
| 78 | my $number_of_files = $CFG_h->{seg2su}{1}{number_of_files}; | ||
| 79 | my $first_file_number = $CFG_h->{seg2su}{1}{first_file_number}; | ||
| 80 | |||
| 81 | #print("values are $number_of_files, $first_file_number\n\n"); | ||
| 82 | |||
| 83 | =head2 Convert *dat | ||
| 84 | |||
| 85 | file names to DAT file names for | ||
| 86 | conversion by sioseis | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | my ( $i, $j, $j_char ); | ||
| 91 | my ( @file_name, @cp_dat2DAT, @segyclean ); | ||
| 92 | my ( @sioseis, @flow ); | ||
| 93 | |||
| 94 | for ( | ||
| 95 | $i = 1, $j = $first_file_number ; | ||
| 96 | $i <= $number_of_files ; | ||
| 97 | $i += 1, $j += 1 | ||
| 98 | ) | ||
| 99 | { | ||
| 100 | $j_char = sprintf( "%u", $j ); | ||
| 101 | $file_name[$i] = $j_char; | ||
| 102 | |||
| 103 | # print $j_char . "\n"; | ||
| 104 | |||
| 105 | } | ||
| 106 | |||
| 107 | for ( $i = 1 ; $i <= $number_of_files ; $i++ ) { | ||
| 108 | |||
| 109 | $cp_dat2DAT[$i] = ( | ||
| 110 | " cp $DATA_SEISMIC_SEG2/$file_name[$i].dat \\ | ||
| 111 | $DATA_SEISMIC_SEG2/$file_name[$i].DAT | ||
| 112 | " | ||
| 113 | ); | ||
| 114 | |||
| 115 | # print $cp_dat2DAT[$i] . "\n"; | ||
| 116 | |||
| 117 | =pod INPUT FILE NAMES | ||
| 118 | |||
| 119 | convert seg2 files to su files | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | $sioseis[$i] = ( " | ||
| 124 | cd $DATA_SEISMIC_SEG2; | ||
| 125 | echo 'moving to' `pwd`; | ||
| 126 | sioseis << eof | ||
| 127 | procs seg2in diskoa end | ||
| 128 | seg2in | ||
| 129 | ffilen $file_name[$i] lfilen $file_name[$i] end | ||
| 130 | end | ||
| 131 | diskoa | ||
| 132 | opath $DATA_SEISMIC_SU/$file_name[$i].su | ||
| 133 | ofmt 5 | ||
| 134 | format su end | ||
| 135 | end | ||
| 136 | end | ||
| 137 | eof" ); | ||
| 138 | |||
| 139 | =pod Clean | ||
| 140 | |||
| 141 | su output | ||
| 142 | |||
| 143 | =cut | ||
| 144 | |||
| 145 | $segyclean[$i] = ( | ||
| 146 | " segyclean \\ | ||
| 147 | <$DATA_SEISMIC_SU/$file_name[$i].su \\ | ||
| 148 | >$DATA_SEISMIC_SU/$file_name[$i]_clean.su \\ | ||
| 149 | " | ||
| 150 | ); | ||
| 151 | |||
| 152 | } # END FOR LOOP | ||
| 153 | |||
| 154 | =head2 DEFINE and Run | ||
| 155 | |||
| 156 | FLOW(S) | ||
| 157 | |||
| 158 | =cut | ||
| 159 | |||
| 160 | for ( $i = 1 ; $i <= $number_of_files ; $i += 1 ) { | ||
| 161 | |||
| 162 | $flow[1][$i] = $cp_dat2DAT[$i]; | ||
| 163 | $flow[2][$i] = $sioseis[$i]; | ||
| 164 | |||
| 165 | $flow[3][$i] = $segyclean[$i]; | ||
| 166 | |||
| 167 | system $flow[1][$i]; | ||
| 168 | system 'echo', $flow[1][$i]; | ||
| 169 | |||
| 170 | system $flow[2][$i]; | ||
| 171 | system 'echo', $flow[2][$i]; | ||
| 172 | |||
| 173 | system $flow[3][$i]; | ||
| 174 | system 'echo', $flow[3][$i]; | ||
| 175 | |||
| 176 | } | ||
| 177 |