« lib/App/SeismicUnixGui/developer/code/sunix/sunix_spec.pm
↑ Summary
lib/App/SeismicUnixGui/big_streams/iTopMutePicks2par.pm »
| 1 | package App::SeismicUnixGui::big_streams::iBottomMutePicks2par; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | our $VERSION = '0.0.1'; | ||
| 5 | use aliased 'App::SeismicUnixGui::misc::message'; | ||
| 6 | use aliased 'App::SeismicUnixGui::misc::flow'; | ||
| 7 | use aliased 'App::SeismicUnixGui::misc::mkparfile'; | ||
| 8 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 9 | |||
| 10 | =head1 DOCUMENTATION | ||
| 11 | |||
| 12 | =head2 SYNOPSIS | ||
| 13 | |||
| 14 | PERL PROGRAM NAME:iBottomMutePicks2par.pm | ||
| 15 | AUTHOR: Juan Lorenzo | ||
| 16 | DATE: June 12 2017 | ||
| 17 | |||
| 18 | DESCRIPTION: | ||
| 19 | |||
| 20 | Purpose: write data pairs to par format for input to sumute | ||
| 21 | |||
| 22 | |||
| 23 | =head2 USE | ||
| 24 | |||
| 25 | =head3 NOTES | ||
| 26 | |||
| 27 | =head4 | ||
| 28 | Examples | ||
| 29 | |||
| 30 | =head3 SEISMIC UNIX NOTES | ||
| 31 | |||
| 32 | =head4 CHANGES and their DATES | ||
| 33 | |||
| 34 | V 1. May 5 2009 | ||
| 35 | V2 for interactive top mute picks | ||
| 36 | V3 Sept.19 2015 perl oops for use with GUI | ||
| 37 | June 14 adapted from iTopMutePicks2par.pm | ||
| 38 | |||
| 39 | |||
| 40 | =head3 STEPS | ||
| 41 | |||
| 42 | 1. define the types of variables you are using | ||
| 43 | these would be the values you enter into | ||
| 44 | each of the Seismic Unix programs each of the | ||
| 45 | Seismic Unix programs | ||
| 46 | |||
| 47 | 2. build a list or hash with all the possible variable | ||
| 48 | names you may use and you can even change them | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | =pod | ||
| 53 | |||
| 54 | instantiate classes | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | my $log = message->new(); | ||
| 59 | my $run = flow->new(); | ||
| 60 | my $mkparfile = mkparfile->new(); | ||
| 61 | my $Project = Project_config->new(); | ||
| 62 | |||
| 63 | =pod | ||
| 64 | |||
| 65 | declare variables types | ||
| 66 | establish just the locally scoped variables | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | my @mkparfile; | ||
| 71 | my ( $mkparfile_in, $mkparfile_inbound ); | ||
| 72 | my ( $mkparfile_out, $mkparfile_outbound ); | ||
| 73 | my ( @items, @flow ); | ||
| 74 | |||
| 75 | =pod | ||
| 76 | |||
| 77 | create hash with important variables | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | my $iBottomMutePicks2par = { | ||
| 82 | _TX_inbound => '', | ||
| 83 | _TX_outbound => '', | ||
| 84 | _taup_inbound => '', | ||
| 85 | _taup_outbound => '', | ||
| 86 | _gather_num => '', | ||
| 87 | _exists => '', | ||
| 88 | _textfile_in => '', | ||
| 89 | _textfile_out => '', | ||
| 90 | _type => '' | ||
| 91 | }; | ||
| 92 | |||
| 93 | =head3 | ||
| 94 | |||
| 95 | Import file-name and directory definitions | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | use App::SeismicUnixGui::misc::SeismicUnix | ||
| 100 | qw($true $false $in $out $to $ibot_mute_par_ $itemp_bot_mute_picks_ $itemp_bot_mute_picks_sorted_par_ $out $suffix_su); | ||
| 101 | my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT(); | ||
| 102 | |||
| 103 | =head2 subroutine clear | ||
| 104 | |||
| 105 | sets all variable strings to '' | ||
| 106 | |||
| 107 | =cut | ||
| 108 | |||
| 109 | sub clear { | ||
| 110 | $iBottomMutePicks2par->{_TX_inbound} = ''; | ||
| 111 | $iBottomMutePicks2par->{_TX_outbound} = ''; | ||
| 112 | $iBottomMutePicks2par->{_taup_inbound} = ''; | ||
| 113 | $iBottomMutePicks2par->{_taup_outbound} = ''; | ||
| 114 | $iBottomMutePicks2par->{_gather_num} = ''; | ||
| 115 | $iBottomMutePicks2par->{_exists} = ''; | ||
| 116 | $iBottomMutePicks2par->{_textfile_in} = ''; | ||
| 117 | $iBottomMutePicks2par->{_textfile_out} = ''; | ||
| 118 | $iBottomMutePicks2par->{_type} = ''; | ||
| 119 | } | ||
| 120 | |||
| 121 | =head3 subroutine file_in | ||
| 122 | |||
| 123 | Required file name | ||
| 124 | on which to pick bottom mute values | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | sub file_in { | ||
| 129 | my ( $variable, $file_in ) = @_; | ||
| 130 | $iBottomMutePicks2par->{_file_in} = $file_in if defined($file_in); | ||
| 131 | |||
| 132 | #print("file name is $iBottomMutePicks2par->{_file_in} \n\n"); | ||
| 133 | } | ||
| 134 | |||
| 135 | =head3 sub type | ||
| 136 | |||
| 137 | switches for old data of two different types | ||
| 138 | |||
| 139 | for type: tx or taup | ||
| 140 | |||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | sub type { | ||
| 145 | my ( $variable, $type ) = @_; | ||
| 146 | $iBottomMutePicks2par->{_type} = $iBottomMutePicks2par | ||
| 147 | if defined($iBottomMutePicks2par); | ||
| 148 | } | ||
| 149 | |||
| 150 | =pod subroutine calc | ||
| 151 | |||
| 152 | main processing flow | ||
| 153 | reformats data | ||
| 154 | |||
| 155 | =cut | ||
| 156 | |||
| 157 | sub calc { | ||
| 158 | |||
| 159 | =pod | ||
| 160 | |||
| 161 | MAKE PARAMETER FILE | ||
| 162 | CONVERT TEXT FILE TO PAR FILE | ||
| 163 | |||
| 164 | In the old manner: | ||
| 165 | $mkparfile = ("mkparfile \\ | ||
| 166 | string1=tmute \\ | ||
| 167 | string2=xmute \\ | ||
| 168 | "); | ||
| 169 | =cut | ||
| 170 | |||
| 171 | =pod | ||
| 172 | |||
| 173 | establish par file names | ||
| 174 | |||
| 175 | TODO if no sorting is ever needed | ||
| 176 | rm file name from $itemp_bot_mute_picks_sorted_par to itemp_bot_mute_picks | ||
| 177 | |||
| 178 | =cut | ||
| 179 | |||
| 180 | $mkparfile_in = $itemp_bot_mute_picks_ . $iBottomMutePicks2par->{_file_in}; | ||
| 181 | $mkparfile_out = | ||
| 182 | $itemp_bot_mute_picks_sorted_par_ . $iBottomMutePicks2par->{_file_in}; | ||
| 183 | |||
| 184 | $iBottomMutePicks2par->{TX_inbound} = $DATA_SEISMIC_TXT . '/' . $mkparfile_in; | ||
| 185 | $iBottomMutePicks2par->{TX_outbound} = $DATA_SEISMIC_TXT . '/' . $mkparfile_out; | ||
| 186 | |||
| 187 | $mkparfile->clear(); | ||
| 188 | $mkparfile->string1('tmute'); | ||
| 189 | $mkparfile->string2('xmute'); | ||
| 190 | $mkparfile[1] = $mkparfile->Step(); | ||
| 191 | |||
| 192 | # DEFINE FLOW(s) | ||
| 193 | # CONVERT t-p picks to t-trace picks | ||
| 194 | # $taup = $taup_data; | ||
| 195 | # | ||
| 196 | # if ($taup == $true) { | ||
| 197 | # print("Mute picks inbound file: $mkparfile_inbound[1]\n\n"); | ||
| 198 | # print("This is taup data\n\n"); | ||
| 199 | # | ||
| 200 | # ($ref_inbound) = iTop_Mute::tp_piks2ttr(\@mkparfile_inbound[1]); | ||
| 201 | # | ||
| 202 | # $flow[1] = (" \\ | ||
| 203 | # $mkparfile[1] \\ | ||
| 204 | # < $$ref_inbound[1] \\ | ||
| 205 | # >$mkparfile_outbound[1] \\ | ||
| 206 | # \\ | ||
| 207 | # "); | ||
| 208 | # | ||
| 209 | # } | ||
| 210 | # elsif ($taup == $false) { | ||
| 211 | |||
| 212 | # in the current flow below | ||
| 213 | # } | ||
| 214 | |||
| 215 | =pod | ||
| 216 | |||
| 217 | DEFINE FLOW(S) | ||
| 218 | |||
| 219 | In the old manner (non oops): | ||
| 220 | |||
| 221 | $flow[1] = (" \\ | ||
| 222 | $mkparfile[1] \\ | ||
| 223 | < $mkparfile_inbound[1] \\ | ||
| 224 | >$mkparfile_outbound[1] \\ | ||
| 225 | \\ | ||
| 226 | "); | ||
| 227 | |||
| 228 | =cut | ||
| 229 | |||
| 230 | # print("Regular xt data\n\n"); | ||
| 231 | |||
| 232 | @items = ( | ||
| 233 | $mkparfile[1], $in, $iBottomMutePicks2par->{TX_inbound}, | ||
| 234 | $out, $iBottomMutePicks2par->{TX_outbound} | ||
| 235 | ); | ||
| 236 | $flow[1] = $run->modules( \@items ); | ||
| 237 | |||
| 238 | =pod | ||
| 239 | |||
| 240 | RUN FLOW(S) | ||
| 241 | output copy of picked data points | ||
| 242 | only occurs after the number of tries | ||
| 243 | is updated | ||
| 244 | |||
| 245 | =cut | ||
| 246 | |||
| 247 | $run->flow( \$flow[1] ); | ||
| 248 | |||
| 249 | =pod | ||
| 250 | |||
| 251 | LOG FLOW(S)TO SCREEN AND FILE | ||
| 252 | |||
| 253 | =cut | ||
| 254 | |||
| 255 | # print "$flow[1]\n"; | ||
| 256 | #$log->file($flow[1]); | ||
| 257 | |||
| 258 | } # end calc subroutine | ||
| 259 | |||
| 260 | 1; |