« lib/App/SeismicUnixGui/big_streams/iSave_mute_picks.pm
↑ Summary
lib/App/SeismicUnixGui/big_streams/iSave_bottom_mute_picks.pm »
| 1 | package App::SeismicUnixGui::big_streams::iApply_mute; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: iApply_mute | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | |||
| 10 | DESCRIPTION: | ||
| 11 | Purpose: Mute of Data | ||
| 12 | |||
| 13 | =head2 USE | ||
| 14 | |||
| 15 | =head2 NOTES | ||
| 16 | Derives from iApply_top_mute.pm V3 Sept. 23, 2015: | ||
| 17 | |||
| 18 | =head4 | ||
| 19 | Examples | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | use Moose; | ||
| 24 | our $VERSION = '0.0.1'; | ||
| 25 | use aliased 'App::SeismicUnixGui::misc::flow'; | ||
| 26 | use aliased 'App::SeismicUnixGui::misc::manage_files_by'; | ||
| 27 | use aliased 'App::SeismicUnixGui::misc::message'; | ||
| 28 | use aliased 'App::SeismicUnixGui::misc::readfiles'; | ||
| 29 | use aliased 'App::SeismicUnixGui::sunix::filter::sufilter'; | ||
| 30 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain'; | ||
| 31 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sumute'; | ||
| 32 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind'; | ||
| 33 | use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb'; | ||
| 34 | use aliased 'App::SeismicUnixGui::sunix::plot::suximage'; | ||
| 35 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 36 | use aliased 'App::SeismicUnixGui::messages::SuMessages'; | ||
| 37 | |||
| 38 | use App::SeismicUnixGui::misc::SeismicUnix | ||
| 39 | qw($go $in $out $on $off $itop_mute $itemp_top_mute_picks_ | ||
| 40 | $itemp_top_mute_num_points $itemp_top_mute_picks_sorted_par_ | ||
| 41 | $itop_mute_par_ $suffix_su $suffix_hyphen $to); | ||
| 42 | |||
| 43 | =head2 | ||
| 44 | |||
| 45 | inherit other packages | ||
| 46 | 1. Instantiate classes | ||
| 47 | Create a new version of the package | ||
| 48 | Personalize to give it a new name if you wish | ||
| 49 | Use the following classes: | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | my $log = message->new(); | ||
| 54 | my $read = readfiles->new(); | ||
| 55 | my $run = flow->new(); | ||
| 56 | my $sufilter = sufilter->new(); | ||
| 57 | my $sugain = sugain->new(); | ||
| 58 | my $sumute = sumute->new(); | ||
| 59 | my $suwind = suwind->new(); | ||
| 60 | my $suxwigb = suxwigb->new(); | ||
| 61 | my $suximage = suximage->new(); | ||
| 62 | my $SuMessages = SuMessages->new(); | ||
| 63 | my $Project = Project_config->new(); | ||
| 64 | |||
| 65 | =head2 | ||
| 66 | |||
| 67 | Import file-name and directory definitions | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | use App::SeismicUnixGui::misc::SeismicUnix qw($itemp_top_mute_picks_sorted_par_); | ||
| 72 | my ($PL_SEISMIC) = $Project->PL_SEISMIC(); | ||
| 73 | my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU(); | ||
| 74 | |||
| 75 | =head2 | ||
| 76 | |||
| 77 | establish just the locally scoped variables | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | my ( @items, @flow, @sugain, @sufilter, @suwind ); | ||
| 82 | my ( @suximage, @suxwigb, @sumute ); | ||
| 83 | my ( $windowtitle, $base_caption ); | ||
| 84 | |||
| 85 | =head2 | ||
| 86 | |||
| 87 | hash array of important variables used within | ||
| 88 | this package | ||
| 89 | Assume that the parameter file already exists | ||
| 90 | Assume that the name of this parameter file is: | ||
| 91 | $itemp_top_mute_picks_sorted_par_.$iApply_mute->{_file_in} | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | my $iApply_mute = { | ||
| 96 | _gather_num => '', | ||
| 97 | _gather_header => '', | ||
| 98 | _offset_type => '', | ||
| 99 | _file_in => '', | ||
| 100 | _freq => '', | ||
| 101 | _inbound => '', | ||
| 102 | _message_type => '', | ||
| 103 | _purpose => '', | ||
| 104 | _number_of_tries => '', | ||
| 105 | _outbound => '', | ||
| 106 | _textfile_in => '', | ||
| 107 | _parfile_in => '' | ||
| 108 | }; | ||
| 109 | |||
| 110 | =head2 | ||
| 111 | |||
| 112 | subroutine clear | ||
| 113 | to blank out hash array values | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | sub clear { | ||
| 118 | $iApply_mute->{_gather_num} = ''; | ||
| 119 | $iApply_mute->{_file_in} = ''; | ||
| 120 | $iApply_mute->{_freq} = ''; | ||
| 121 | $iApply_mute->{_inbound} = ''; | ||
| 122 | $iApply_mute->{_message_type} = ''; | ||
| 123 | $iApply_mute->{_gather_header} = ''; | ||
| 124 | $iApply_mute->{_offset_type} = ''; | ||
| 125 | $iApply_mute->{_number_of_tries} = ''; | ||
| 126 | $iApply_mute->{_outbound} = ''; | ||
| 127 | $iApply_mute->{_purpose} = ''; | ||
| 128 | $iApply_mute->{_parfile_in} = ''; | ||
| 129 | $iApply_mute->{_textfile_in} = ''; | ||
| 130 | } | ||
| 131 | |||
| 132 | =head2 subroutine gather_header | ||
| 133 | |||
| 134 | define the header for the xmute values | ||
| 135 | binheader type value helps define the xmute values | ||
| 136 | e.g. if gather_header = 'gather' | ||
| 137 | the the xmute values are 'offset' | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | sub gather_header { | ||
| 142 | my ( $variable, $gather_header ) = @_; | ||
| 143 | $iApply_mute->{_gather_header} = $gather_header | ||
| 144 | if defined($gather_header); | ||
| 145 | |||
| 146 | #print(" header type is $iApply_mute->{_gather_header}\n\n"); | ||
| 147 | } | ||
| 148 | |||
| 149 | =head2 subroutine offset_type | ||
| 150 | |||
| 151 | define the header for the xmute values | ||
| 152 | offset type value helps define the xmute values | ||
| 153 | e.g. if offset_type = 'gather' | ||
| 154 | the the xmute values are 'offset' | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | sub offset_type { | ||
| 159 | my ( $variable, $offset_type ) = @_; | ||
| 160 | $iApply_mute->{_offset_type} = $offset_type if defined($offset_type); | ||
| 161 | |||
| 162 | #print(" header type is $iApply_mute->{_offset_type}\n\n"); | ||
| 163 | } | ||
| 164 | |||
| 165 | =head2 subroutine gather | ||
| 166 | |||
| 167 | sets gather number to consider | ||
| 168 | |||
| 169 | =cut | ||
| 170 | |||
| 171 | sub gather_num { | ||
| 172 | my ( $variable, $gather_num ) = @_; | ||
| 173 | $iApply_mute->{_gather_num} = $gather_num if defined($gather_num); | ||
| 174 | } | ||
| 175 | |||
| 176 | =head2 | ||
| 177 | |||
| 178 | subroutine freq | ||
| 179 | creates the bandpass frequencies to filter data | ||
| 180 | e.g., "3,6,40,50" | ||
| 181 | |||
| 182 | =cut | ||
| 183 | |||
| 184 | sub freq { | ||
| 185 | my ( $variable, $freq ) = @_; | ||
| 186 | $iApply_mute->{_freq} = $freq if defined($freq); | ||
| 187 | |||
| 188 | #print("freq is $iApply_mute->{_freq}\n\n"); | ||
| 189 | } | ||
| 190 | |||
| 191 | =head2 | ||
| 192 | |||
| 193 | subroutine file_in | ||
| 194 | Required file name | ||
| 195 | on which to apply top mute values | ||
| 196 | print(" iApply inbound is $iApply_mute->{_inbound}\n\n"); | ||
| 197 | |||
| 198 | =cut | ||
| 199 | |||
| 200 | sub file_in { | ||
| 201 | my ( $variable, $file_in ) = @_; | ||
| 202 | if ( defined($file_in) ) { | ||
| 203 | $iApply_mute->{_file_in} = $file_in; | ||
| 204 | print(" file in is $iApply_mute->{_file_in} in iApply_Mute\n\n"); | ||
| 205 | $iApply_mute->{_inbound} = | ||
| 206 | $DATA_SEISMIC_SU . '/' | ||
| 207 | . $iApply_mute->{_file_in} . '_' | ||
| 208 | . $iApply_mute->{_gather_type} | ||
| 209 | . $iApply_mute->{_gather_num} | ||
| 210 | . $suffix_su; | ||
| 211 | |||
| 212 | $iApply_mute->{_outbound} = | ||
| 213 | $DATA_SEISMIC_SU . '/' | ||
| 214 | . $iApply_mute->{_file_in} . '_' | ||
| 215 | . $iApply_mute->{_gather_type} | ||
| 216 | . $iApply_mute->{_gather_num} . '_mute' | ||
| 217 | . $suffix_su; | ||
| 218 | print(" iApply outbound is $iApply_mute->{_outbound}\n\n"); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | =head2 subroutine gather_type | ||
| 223 | |||
| 224 | sets gather type to consider | ||
| 225 | e.g., 'ep', 'cdp', etc. | ||
| 226 | |||
| 227 | =cut | ||
| 228 | |||
| 229 | sub gather_type { | ||
| 230 | my ( $variable, $gather_type ) = @_; | ||
| 231 | $iApply_mute->{_gather_type} = $gather_type if defined($gather_type); | ||
| 232 | } | ||
| 233 | |||
| 234 | =head2 | ||
| 235 | |||
| 236 | subroutine minumum amplitude to plot | ||
| 237 | |||
| 238 | =cut | ||
| 239 | |||
| 240 | sub min_amplitude { | ||
| 241 | my ( $variable, $min_amplitude ) = @_; | ||
| 242 | $iApply_mute->{_min_amplitude} = $min_amplitude | ||
| 243 | if defined($min_amplitude); | ||
| 244 | |||
| 245 | #print("min_amplitude is $iApply_mute->{_min_amplitude}\n\n"); | ||
| 246 | } | ||
| 247 | |||
| 248 | =head2 | ||
| 249 | |||
| 250 | subroutine maximum amplitude to plot | ||
| 251 | |||
| 252 | =cut | ||
| 253 | |||
| 254 | sub max_amplitude { | ||
| 255 | my ( $variable, $max_amplitude ) = @_; | ||
| 256 | $iApply_mute->{_max_amplitude} = $max_amplitude | ||
| 257 | if defined($max_amplitude); | ||
| 258 | |||
| 259 | #print("max_amplitude is $iApply_mute->{_max_amplitude}\n\n"); | ||
| 260 | } | ||
| 261 | |||
| 262 | =head2 subroutine purpose | ||
| 263 | |||
| 264 | are the picks for a future top mute | ||
| 265 | or a future bottom mute ? | ||
| 266 | e.g.= _bottom_mute | ||
| 267 | |||
| 268 | =cut | ||
| 269 | |||
| 270 | sub purpose { | ||
| 271 | |||
| 272 | my ( $variable, $purpose ) = @_; | ||
| 273 | |||
| 274 | if ( defined($purpose) ) { | ||
| 275 | $iApply_mute->{_purpose} = $purpose; | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | =head2 subroutine calcNdisplay | ||
| 280 | |||
| 281 | main processing flow | ||
| 282 | calculate mute and display results | ||
| 283 | |||
| 284 | =cut | ||
| 285 | |||
| 286 | sub calcNdisplay { | ||
| 287 | |||
| 288 | =head2 | ||
| 289 | |||
| 290 | Assume that the parameter file already exists | ||
| 291 | Assume that the name of this parameter file is: | ||
| 292 | $itemp_top_mute_picks_sorted_par_.$iApply_mute->{_file_in} | ||
| 293 | |||
| 294 | =cut | ||
| 295 | |||
| 296 | $iApply_mute->{_parfile_in} = | ||
| 297 | $PL_SEISMIC . '/' | ||
| 298 | . 'itemp_' | ||
| 299 | . $iApply_mute->{_purpose} | ||
| 300 | . '_picks_sorted_par_' | ||
| 301 | . $iApply_mute->{_file_in} . '_' | ||
| 302 | . $iApply_mute->{_gather_type} | ||
| 303 | . $iApply_mute->{_gather_num}; | ||
| 304 | |||
| 305 | print("mute pick file is $iApply_mute->{_parfile_in}\n\n"); | ||
| 306 | print("/lib/iApply_mute : mute type is $iApply_mute->{_purpose}\n\n"); | ||
| 307 | |||
| 308 | =head2 | ||
| 309 | |||
| 310 | MUTE DATA by | ||
| 311 | |||
| 312 | =cut | ||
| 313 | |||
| 314 | $sumute->clear(); | ||
| 315 | $sumute->par_file( $iApply_mute->{_parfile_in} ); | ||
| 316 | $sumute->offset_word( $iApply_mute->{_offset_type} ); | ||
| 317 | $sumute->type( $iApply_mute->{_purpose} ); | ||
| 318 | $sumute[1] = $sumute->Step(); | ||
| 319 | |||
| 320 | =head2 | ||
| 321 | |||
| 322 | set filtering parameters | ||
| 323 | |||
| 324 | =cut | ||
| 325 | |||
| 326 | $sufilter->clear(); | ||
| 327 | $sufilter->freq( $iApply_mute->{_freq} ); | ||
| 328 | $sufilter[1] = $sufilter->Step(); | ||
| 329 | |||
| 330 | =head2 | ||
| 331 | |||
| 332 | GAIN DATA | ||
| 333 | |||
| 334 | =cut | ||
| 335 | |||
| 336 | $sugain->clear(); | ||
| 337 | $sugain->pbal($on); | ||
| 338 | $sugain[1] = $sugain->Step(); | ||
| 339 | |||
| 340 | $sugain->clear(); | ||
| 341 | $sugain->agc($on); | ||
| 342 | $sugain->width(0.1); | ||
| 343 | |||
| 344 | # $sugain -> setdt(1000); | ||
| 345 | $sugain[2] = $sugain->Step(); | ||
| 346 | |||
| 347 | $sugain->clear(); | ||
| 348 | $sugain->tpower(3); | ||
| 349 | $sugain[3] = $sugain->Step(); | ||
| 350 | |||
| 351 | =head2 | ||
| 352 | |||
| 353 | DISPLAY DATA | ||
| 354 | |||
| 355 | =cut | ||
| 356 | |||
| 357 | # $base_caption = $iApply_mute->{_file_in}.quotemeta(' f=').$iApply_mute->{_freq}; | ||
| 358 | # $windowtitle = ''; | ||
| 359 | |||
| 360 | # $suximage -> clear(); | ||
| 361 | # $suximage -> box_width(300); | ||
| 362 | # $suximage -> box_height(700); | ||
| 363 | # $suximage -> box_X0(70); | ||
| 364 | # $suximage -> box_Y0(120); | ||
| 365 | # $suximage -> title($base_caption); | ||
| 366 | # $suximage -> windowtitle($windowtitle); | ||
| 367 | # $suximage -> ylabel(quotemeta('TWTTs')); | ||
| 368 | # $suximage -> xlabel($iApply_mute->{_offset_type}); | ||
| 369 | # $suximage -> legend($on); | ||
| 370 | # $suximage -> cmap('rgb0'); | ||
| 371 | # #$suximage -> loclip($iApply_mute->{_min_amplitude}); | ||
| 372 | # #$suximage -> hiclip($iApply_mute->{_max_amplitude}); | ||
| 373 | # $suximage -> verbose($off); | ||
| 374 | # $suximage[1] = $suximage -> Step(); | ||
| 375 | # | ||
| 376 | |||
| 377 | =head2 Set wiggle plot | ||
| 378 | |||
| 379 | for tau-p data | ||
| 380 | |||
| 381 | =cut | ||
| 382 | |||
| 383 | $suxwigb->clear(); | ||
| 384 | $suxwigb->defaults( 'iSurf4', 'top_middle' ); | ||
| 385 | $suxwigb->key('tracl'); | ||
| 386 | $suxwigb->title( $iApply_mute->{_file_in} ); | ||
| 387 | |||
| 388 | #$suxwigb-> pmin($CFG->{sutaup}{1}{pmin}); | ||
| 389 | #$suxwigb-> dp($dp); | ||
| 390 | $suxwigb->box_width(400); | ||
| 391 | $suxwigb->box_height(500); | ||
| 392 | |||
| 393 | #$suxwigb-> percent(99.9); | ||
| 394 | $suxwigb->clip(1); | ||
| 395 | $suxwigb->windowtitle( quotemeta('Muted Taup Data') ); | ||
| 396 | $suxwigb[1] = $suxwigb->Step(); | ||
| 397 | |||
| 398 | =head2 | ||
| 399 | |||
| 400 | DEFINE FLOW(S) | ||
| 401 | |||
| 402 | =cut | ||
| 403 | |||
| 404 | @items = | ||
| 405 | ( $sumute[1], $in, $iApply_mute->{_inbound}, $to, $suxwigb[1], $go ); | ||
| 406 | $flow[1] = $run->modules( \@items ); | ||
| 407 | |||
| 408 | @items = ( | ||
| 409 | $sumute[1], $in, $iApply_mute->{_inbound}, | ||
| 410 | $out, $iApply_mute->{_outbound}, $go | ||
| 411 | ); | ||
| 412 | $flow[2] = $run->modules( \@items ); | ||
| 413 | |||
| 414 | =head2 | ||
| 415 | |||
| 416 | RUN FLOW(S) | ||
| 417 | output copy of picked data points | ||
| 418 | only occurs after the number of tries | ||
| 419 | is updated | ||
| 420 | |||
| 421 | =cut | ||
| 422 | |||
| 423 | $run->flow( \$flow[1] ); | ||
| 424 | $run->flow( \$flow[2] ); | ||
| 425 | |||
| 426 | =head2 | ||
| 427 | |||
| 428 | LOG FLOW(S)TO SCREEN AND FILE | ||
| 429 | |||
| 430 | =cut | ||
| 431 | |||
| 432 | #print "$flow[1]\n"; | ||
| 433 | #$log->file($flow[1]); | ||
| 434 | print "$flow[2]\n"; | ||
| 435 | |||
| 436 | #$log->file($flow[2]); | ||
| 437 | |||
| 438 | } # end calcNdisplay subroutine | ||
| 439 | |||
| 440 | 1; |