« lib/App/SeismicUnixGui/big_streams/iSuvelan.pm
↑ Summary
lib/App/SeismicUnixGui/misc/param_flow_blue.pm »
| 1 | package App::SeismicUnixGui::big_streams::iVA; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: iVA.pm | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | DATE: Nov 1 2012, | ||
| 10 | sept. 13 2013 | ||
| 11 | oct. 21 2013 | ||
| 12 | July 15 2015 | ||
| 13 | Aug 18 2016 | ||
| 14 | Jan 7 2017 | ||
| 15 | |||
| 16 | DESCRIPTION: | ||
| 17 | Version: 1.0 | ||
| 18 | Package used for interactive velocity analysis | ||
| 19 | Version 1.0.1 separates graphics from calculations | ||
| 20 | Version 1.0.2 removes dependency on Config-Simple | ||
| 21 | Version 1.0.3 considers scaleco or scalel in header | ||
| 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 | Jan 13 2020 Version 1.0.3 | ||
| 35 | _get_data_scale is now calculated internally | ||
| 36 | data_scale parameter removed from gui | ||
| 37 | |||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | =head2 STEPS | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | =head2 | ||
| 46 | |||
| 47 | set defaults | ||
| 48 | |||
| 49 | VELAN DATA | ||
| 50 | m/s | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | =head2 import and then | ||
| 55 | |||
| 56 | instantiate iclasses | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | use Moose; | ||
| 61 | our $VERSION = '1.0.3'; | ||
| 62 | |||
| 63 | use App::SeismicUnixGui::misc::control '0.0.3'; | ||
| 64 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 65 | |||
| 66 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 67 | use aliased 'App::SeismicUnixGui::big_streams::iSunmo'; | ||
| 68 | use aliased 'App::SeismicUnixGui::configs::big_streams::iVA_config'; | ||
| 69 | use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb'; | ||
| 70 | use aliased 'App::SeismicUnixGui::big_streams::iSuvelan'; | ||
| 71 | use aliased 'App::SeismicUnixGui::big_streams::iWrite_All_iva_out'; | ||
| 72 | use aliased 'App::SeismicUnixGui::big_streams::iVpicks2par'; | ||
| 73 | use aliased 'App::SeismicUnixGui::big_streams::iVrms2Vint'; | ||
| 74 | use aliased 'App::SeismicUnixGui::misc::manage_files_by2'; | ||
| 75 | use aliased 'App::SeismicUnixGui::misc::readfiles'; | ||
| 76 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 77 | use aliased 'App::SeismicUnixGui::messages::SuMessages'; | ||
| 78 | use aliased 'App::SeismicUnixGui::sunix::shell::xk'; | ||
| 79 | use aliased 'App::SeismicUnixGui::sunix::header::header_values'; | ||
| 80 | |||
| 81 | =head2 establish hash of shared variables | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | my $iVA = { | ||
| 86 | _anis1 => '', | ||
| 87 | _anis2 => '', | ||
| 88 | _cdp_last => '', | ||
| 89 | _cdp_first => '', | ||
| 90 | _cdp_num => '', | ||
| 91 | _cdp_num_suffix => '', | ||
| 92 | _cdp_inc => '', | ||
| 93 | _data_scale => '', | ||
| 94 | _dtratio => '', | ||
| 95 | _dt_s => '', | ||
| 96 | _base_file_name => '', | ||
| 97 | _freq => '', | ||
| 98 | _instructions => '', | ||
| 99 | _min_semblance => '', | ||
| 100 | _max_semblance => '', | ||
| 101 | _message_type => 'iva', | ||
| 102 | _next_step => '', | ||
| 103 | _nsmooth => '', | ||
| 104 | _number_of_tries => '', | ||
| 105 | _number_of_velocities => '', | ||
| 106 | _old_data => '', | ||
| 107 | _pwr => '', | ||
| 108 | _smute => '', | ||
| 109 | _tmax_s => '', | ||
| 110 | _Tvel_inbound => '', | ||
| 111 | _Tvel_outbound => '', | ||
| 112 | _textfile_in => '', | ||
| 113 | _textfile_out => '', | ||
| 114 | _type => '', | ||
| 115 | _velocity_increment => '', | ||
| 116 | _velocity_min => '', | ||
| 117 | _velocity_max => '', | ||
| 118 | }; | ||
| 119 | |||
| 120 | =head2 Instantiate classes: | ||
| 121 | |||
| 122 | Option to create a new version of the package | ||
| 123 | with a unique name | ||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | my $read = readfiles->new(); | ||
| 128 | my $control = control->new(); | ||
| 129 | |||
| 130 | my $suxwigb = suxwigb->new(); | ||
| 131 | my $semblance = iSuvelan->new(); | ||
| 132 | my $iWrite_All_iva_out = iWrite_All_iva_out->new(); | ||
| 133 | my $iVpicks2par = iVpicks2par->new(); | ||
| 134 | my $iVrms2Vint = iVrms2Vint->new(); | ||
| 135 | my $test = manage_files_by2->new(); | ||
| 136 | my $SuMessages = SuMessages->new(); | ||
| 137 | my $iSunmo = iSunmo->new(); | ||
| 138 | my $get = L_SU_global_constants->new(); | ||
| 139 | #my $global_libs = $get->global_libs(); | ||
| 140 | my $Project = Project_config->new(); | ||
| 141 | my $iVA_config = iVA_config->new(); | ||
| 142 | my $xk = xk->new(); | ||
| 143 | |||
| 144 | =head2 Import Special Variables | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | my $var = $get->var(); | ||
| 149 | my $empty_string = $var->{_empty_string}; | ||
| 150 | |||
| 151 | |||
| 152 | =head2 Get configuration information | ||
| 153 | from gui | ||
| 154 | |||
| 155 | =cut | ||
| 156 | |||
| 157 | my ( $CFG_h, $CFG_aref ) = $iVA_config->get_values(); | ||
| 158 | |||
| 159 | $iVA->{_base_file_name} = $CFG_h->{iva}{1}{base_file_name}; | ||
| 160 | $iVA->{_cdp_first} = $CFG_h->{iva}{1}{cdp_first}; | ||
| 161 | $iVA->{_cdp_inc} = $CFG_h->{iva}{1}{cdp_inc}; | ||
| 162 | $iVA->{_cdp_last} = $CFG_h->{iva}{1}{cdp_last}; | ||
| 163 | $iVA->{_tmax_s} = $CFG_h->{iva}{1}{tmax_s}; | ||
| 164 | |||
| 165 | $iVA->{_dt_s} = $CFG_h->{iva}{1}{dt_s}; | ||
| 166 | $iVA->{_freq} = $CFG_h->{iva}{1}{freq}; | ||
| 167 | $iVA->{_first_velocity} = $CFG_h->{iva}{1}{first_velocity}; | ||
| 168 | $iVA->{_min_semblance} = $CFG_h->{iva}{1}{min_semblance}; | ||
| 169 | $iVA->{_max_semblance} = $CFG_h->{iva}{1}{max_semblance}; | ||
| 170 | $iVA->{_number_of_velocities} = $CFG_h->{iva}{1}{number_of_velocities}; | ||
| 171 | $iVA->{_velocity_increment} = $CFG_h->{iva}{1}{velocity_increment}; | ||
| 172 | $iVA->{_anis1} = $CFG_h->{iva}{1}{anis1}; | ||
| 173 | $iVA->{_anis2} = $CFG_h->{iva}{1}{anis2}; | ||
| 174 | $iVA->{_dtratio} = $CFG_h->{iva}{1}{dtratio}; | ||
| 175 | $iVA->{_nsmooth} = $CFG_h->{iva}{1}{nsmooth}; | ||
| 176 | $iVA->{_smute} = $CFG_h->{iva}{1}{smute}; | ||
| 177 | $iVA->{_pwr} = $CFG_h->{iva}{1}{pwr}; | ||
| 178 | |||
| 179 | # remove ticks at the start and end of base_file_names | ||
| 180 | $control->set_infection( $iVA->{_base_file_name} ); | ||
| 181 | $iVA->{_base_file_name} = $control->get_ticksBgone(); | ||
| 182 | |||
| 183 | # remove ticks at the start and end of freqquncy series | ||
| 184 | $control->set_infection( $iVA->{_freq} ); | ||
| 185 | $iVA->{_freq} = $control->get_ticksBgone(); | ||
| 186 | |||
| 187 | # print("1. iVA, file name --without su extension -- is $iVA->{_base_file_name}\n\n"); | ||
| 188 | |||
| 189 | # get data scale from headers of the sunix data file | ||
| 190 | $iVA->{_data_scale} = _get_data_scale(); | ||
| 191 | |||
| 192 | =head2 | ||
| 193 | |||
| 194 | VELAN DATA | ||
| 195 | must be in units of: m/s | ||
| 196 | must seed first cdp | ||
| 197 | |||
| 198 | Set the type of messages you will receive | ||
| 199 | for now it also sets the CDP number to use | ||
| 200 | so keep it after setting cdp numbers | ||
| 201 | |||
| 202 | =cut | ||
| 203 | |||
| 204 | =head2 | ||
| 205 | |||
| 206 | Import directory definitions | ||
| 207 | |||
| 208 | =cut | ||
| 209 | |||
| 210 | my ($PL_SEISMIC) = $Project->PL_SEISMIC(); | ||
| 211 | |||
| 212 | =head2 subroutine clear | ||
| 213 | |||
| 214 | sets all variable strings to '' | ||
| 215 | |||
| 216 | =cut | ||
| 217 | |||
| 218 | sub clear { | ||
| 219 | $iVA->{_anis1} = ''; | ||
| 220 | $iVA->{_anis2} = ''; | ||
| 221 | $iVA->{_cdp_num} = ''; | ||
| 222 | $iVA->{_cdp_first} = ''; | ||
| 223 | $iVA->{_cdp_last} = ''; | ||
| 224 | $iVA->{_cdp_inc} = ''; | ||
| 225 | $iVA->{_data_scale} = ''; | ||
| 226 | $iVA->{_dtratio} = ''; | ||
| 227 | $iVA->{_dt_s} = ''; | ||
| 228 | $iVA->{_base_file_name} = ''; | ||
| 229 | $iVA->{_freq} = ''; | ||
| 230 | $iVA->{_instructions} = ''; | ||
| 231 | $iVA->{_min_semblance} = ''; | ||
| 232 | $iVA->{_max_semblance} = ''; | ||
| 233 | $iVA->{_message_type} = ''; | ||
| 234 | $iVA->{_next_step} = ''; | ||
| 235 | $iVA->{_nsmooth} = ''; | ||
| 236 | $iVA->{_number_of_tries} = ''; | ||
| 237 | $iVA->{_number_of_velocities} = ''; | ||
| 238 | $iVA->{_old_data} = ''; | ||
| 239 | $iVA->{_smute} = ''; | ||
| 240 | $iVA->{_pwr} = ''; | ||
| 241 | $iVA->{_test} = ''; | ||
| 242 | $iVA->{_tmax_s} = ''; | ||
| 243 | $iVA->{_Tvel_inbound} = ''; | ||
| 244 | $iVA->{_Tvel_outbound} = ''; | ||
| 245 | $iVA->{_velocity_min} = ''; | ||
| 246 | $iVA->{_velocity_max} = ''; | ||
| 247 | $iVA->{_velocity_increment} = ''; | ||
| 248 | } | ||
| 249 | |||
| 250 | =head2 sub _get_data_scale | ||
| 251 | |||
| 252 | get scalco or scalel from file header | ||
| 253 | |||
| 254 | =cut | ||
| 255 | |||
| 256 | sub _get_data_scale { | ||
| 257 | my ($self) = @_; | ||
| 258 | |||
| 259 | =head2 instantiate class | ||
| 260 | |||
| 261 | =cut | ||
| 262 | |||
| 263 | my $header_values = header_values->new(); | ||
| 264 | |||
| 265 | if ( defined $iVA->{_base_file_name} | ||
| 266 | && $iVA->{_base_file_name} ne $empty_string ) | ||
| 267 | { | ||
| 268 | $header_values->set_base_file_name( $iVA->{_base_file_name} ); | ||
| 269 | $header_values->set_header_name('scalel'); | ||
| 270 | my $data_scale = $header_values->get_number(); | ||
| 271 | |||
| 272 | my $result = $data_scale; | ||
| 273 | # print("2. iVA, _get_data_scale, data_scale = $data_scale\n"); | ||
| 274 | return($result); | ||
| 275 | |||
| 276 | } else { | ||
| 277 | |||
| 278 | my $data_scale = 1; | ||
| 279 | my $result = $data_scale; | ||
| 280 | # print("iVA, _get_data_scale, data_scale = 1:1\n"); | ||
| 281 | return ($result); | ||
| 282 | |||
| 283 | } | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | =head2 subroutine set_message | ||
| 288 | |||
| 289 | define the message family to use | ||
| 290 | alsoset the cdp nuber (TODO: move option elsewhere) | ||
| 291 | |||
| 292 | =cut | ||
| 293 | |||
| 294 | sub set_message { | ||
| 295 | my ( $variable, $type ) = @_; | ||
| 296 | $iVA->{_message_type} = $type if defined($type); | ||
| 297 | |||
| 298 | #print("message type is $iVA->{_message_type}\n\n"); | ||
| 299 | $SuMessages->set( $iVA->{_message_type} ); | ||
| 300 | $SuMessages->cdp_num( $iVA->{_cdp_num} ); | ||
| 301 | |||
| 302 | } | ||
| 303 | |||
| 304 | =head2 subroutine message | ||
| 305 | |||
| 306 | instructions | ||
| 307 | |||
| 308 | =cut | ||
| 309 | |||
| 310 | sub _message { | ||
| 311 | my ($instructions) = @_; | ||
| 312 | |||
| 313 | if ($instructions) { | ||
| 314 | $iVA->{_instructions} = $instructions | ||
| 315 | if defined($instructions); | ||
| 316 | $SuMessages->instructions( $iVA->{_instructions} ); | ||
| 317 | |||
| 318 | #print("Instructions are $iVA->{_instructions} \n\n"); | ||
| 319 | } | ||
| 320 | } | ||
| 321 | |||
| 322 | =head2 | ||
| 323 | |||
| 324 | subroutine TV pick file out | ||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | sub refresh_Tvel_outbound { | ||
| 329 | $iVA->{_textfile_out} = | ||
| 330 | 'ivpicks_' . $iVA->{_base_file_name} . $iVA->{_cdp_num_suffix}; | ||
| 331 | $iVA->{_Tvel_outbound} = $PL_SEISMIC . '/' . $iVA->{_textfile_out}; | ||
| 332 | |||
| 333 | #print("output file is $iVA->{_Tvel_outbound} \n\n"); | ||
| 334 | } | ||
| 335 | |||
| 336 | =head2 | ||
| 337 | |||
| 338 | subroutine TV pick file in | ||
| 339 | |||
| 340 | =cut | ||
| 341 | |||
| 342 | sub refresh_Tvel_inbound { | ||
| 343 | $iVA->{_textfile_in} = | ||
| 344 | 'ivpicks_old' . '_' . $iVA->{_base_file_name} . $iVA->{_cdp_num_suffix}; | ||
| 345 | $iVA->{_Tvel_inbound} = $PL_SEISMIC . '/' . $iVA->{_textfile_in}; | ||
| 346 | } | ||
| 347 | |||
| 348 | =head2 look for old data | ||
| 349 | |||
| 350 | There is an old pick file to read | ||
| 351 | textfile_in: ivpicks_old | ||
| 352 | Requires knowing current cdp number | ||
| 353 | becaus we are at the start of the process | ||
| 354 | we will provide the lowest cdp as an indicator | ||
| 355 | TODO: check all old cdp data files before going on | ||
| 356 | to subsequent analyses | ||
| 357 | |||
| 358 | =cut | ||
| 359 | |||
| 360 | sub old_data { | ||
| 361 | my ( $variable, $old_data ) = @_; | ||
| 362 | my $ans; | ||
| 363 | |||
| 364 | # print("variable and old_data $variable, $old_data\n\n"); | ||
| 365 | #switches old data of velan type | ||
| 366 | if ($old_data) { | ||
| 367 | $iVA->{_type} = $old_data; | ||
| 368 | if ( $iVA->{_type} eq 'velan' ) { | ||
| 369 | |||
| 370 | cdp_num( $iVA->{_cdp_first} ); | ||
| 371 | cdp_num_suffix( $iVA->{_cdp_num} ); | ||
| 372 | |||
| 373 | $iVA->{_textfile_in} = | ||
| 374 | 'ivpicks_old' . '_' | ||
| 375 | . $iVA->{_base_file_name} | ||
| 376 | . $iVA->{_cdp_num_suffix}; | ||
| 377 | |||
| 378 | if ($PL_SEISMIC) { | ||
| 379 | $iVA->{_Tvel_inbound} = | ||
| 380 | $PL_SEISMIC . '/' . $iVA->{_textfile_in}; | ||
| 381 | $ans = $test->does_file_exist( \$iVA->{_Tvel_inbound} ); | ||
| 382 | |||
| 383 | if ( $iVA->{_base_file_name} | ||
| 384 | && $iVA->{_cdp_num_suffix} ) | ||
| 385 | { | ||
| 386 | $iVA->{_textfile_out} = | ||
| 387 | 'ivpicks_' | ||
| 388 | . $iVA->{_base_file_name} | ||
| 389 | . $iVA->{_cdp_num_suffix}; | ||
| 390 | $iVA->{_Tvel_outbound} = | ||
| 391 | $PL_SEISMIC . '/' . $iVA->{_textfile_out}; | ||
| 392 | } | ||
| 393 | } | ||
| 394 | |||
| 395 | # print("TV in is $iVA->{_Tvel_inbound}\n\n"); | ||
| 396 | #print("TV out is $iVA->{_Tvel_outbound}\n\n"); | ||
| 397 | |||
| 398 | if ($ans) { | ||
| 399 | |||
| 400 | # TODO put a message into the gui | ||
| 401 | # use App::SeismicUnixGui::messages::message_director; | ||
| 402 | # | ||
| 403 | #=head2 sub set_hash_ref | ||
| 404 | # | ||
| 405 | # copies with simplified names are also kept (40) so later | ||
| 406 | # the hash can be returned to a calling module | ||
| 407 | # | ||
| 408 | # imports external hash into private settings via gui_history | ||
| 409 | # accessory | ||
| 410 | # | ||
| 411 | #print("color_flow,set_hash_ref,hash_ref->{_log_view}: $ans\n"); | ||
| 412 | #my $ans = $gui_history->get_log_view(); | ||
| 413 | #print("2. color_flow,set_hash_ref: gui_history->get_log_view:$ans \n"); | ||
| 414 | # | ||
| 415 | #=cut | ||
| 416 | # | ||
| 417 | #sub set_hash_ref { | ||
| 418 | # my ( $self, $hash_ref ) = @_; | ||
| 419 | # | ||
| 420 | # $gui_history->set_defaults($hash_ref); | ||
| 421 | # $color_flow_href = $gui_history->get_defaults(); | ||
| 422 | # | ||
| 423 | # # REALLY? | ||
| 424 | # # set up param_widgets for later use | ||
| 425 | # # give param_widgets the needed values | ||
| 426 | # $param_widgets->set_hash_ref($color_flow_href); | ||
| 427 | # | ||
| 428 | # $flow_color = $color_flow_href->{_flow_color}; | ||
| 429 | # | ||
| 430 | # # $gui_history_aref = $color_flow_href->{_gui_history_aref}; | ||
| 431 | # | ||
| 432 | # # for local use | ||
| 433 | # $last_flow_color = $color_flow_href->{_last_flow_color}; # used in flow_select | ||
| 434 | # $message_w = $color_flow_href->{_message_w}; | ||
| 435 | # $parameter_values_frame = $color_flow_href->{_parameter_values_frame}; | ||
| 436 | # $parameter_values_button_frame = $color_flow_href->{_parameter_values_button_frame}; | ||
| 437 | # | ||
| 438 | # # $sunix_listbox = $color_flow_href->{_sunix_listbox}; | ||
| 439 | # | ||
| 440 | # # print("color_flow, set_hash_ref _check_buttons_settings_aref: @{$color_flow_href->{_check_buttons_settings_aref}}\n"); | ||
| 441 | # | ||
| 442 | # # print("color_flow,set_hash_ref: print gui_history->view\n"); | ||
| 443 | # # $gui_history->view(); | ||
| 444 | # | ||
| 445 | # return (); | ||
| 446 | #} | ||
| 447 | # my $message_w; | ||
| 448 | # $message_w = $color_flow_href->{_message_w}; | ||
| 449 | # my $iva_messages = message_director->new(); | ||
| 450 | # my $message = $color_flow_messages->null_button(0); | ||
| 451 | # $message_w->delete( "1.0", 'end' ); | ||
| 452 | # $message_w->insert( 'end', $message ); | ||
| 453 | |||
| 454 | print("Old picks already exist.\n"); | ||
| 455 | print("Delete \(\"rm -rf \*old\*\"\) or, \n"); | ||
| 456 | print("Save old picks (in: $PL_SEISMIC), and then restart\n\n"); | ||
| 457 | exit; | ||
| 458 | } | ||
| 459 | return ($ans); | ||
| 460 | } | ||
| 461 | |||
| 462 | } | ||
| 463 | } | ||
| 464 | |||
| 465 | =head2 subroutine cdp | ||
| 466 | |||
| 467 | sets cdp number to consider and is used only | ||
| 468 | by sub start | ||
| 469 | |||
| 470 | =cut | ||
| 471 | |||
| 472 | sub cdp_num { | ||
| 473 | my ($cdp_num) = @_; | ||
| 474 | $iVA->{_cdp_num} = $cdp_num if defined($cdp_num); | ||
| 475 | |||
| 476 | #print("cdp_num is $cdp_num\n\n"); | ||
| 477 | } | ||
| 478 | |||
| 479 | =head2 subroutine cdp_num_suffix | ||
| 480 | |||
| 481 | sets cdp number suffix to consider | ||
| 482 | used by subs start and next | ||
| 483 | |||
| 484 | =cut | ||
| 485 | |||
| 486 | sub cdp_num_suffix { | ||
| 487 | my ($cdp_num) = @_; | ||
| 488 | if ($cdp_num) { | ||
| 489 | $iVA->{_cdp_num_suffix} = '_cdp' . $cdp_num; | ||
| 490 | |||
| 491 | #print("cdp_num suffix in iVA.pm is $iVA->{_cdp_num_suffix}\n\n"); | ||
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 | =head2 subroutine start | ||
| 496 | |||
| 497 | sets first cdp to use internally | ||
| 498 | and display in the messages | ||
| 499 | sets the type of messages to relay | ||
| 500 | sets the counter for attempts at velocity | ||
| 501 | analysis for a particular cdp | ||
| 502 | |||
| 503 | =cut | ||
| 504 | |||
| 505 | sub start { | ||
| 506 | |||
| 507 | print("NEW PICKS\n"); | ||
| 508 | set_message( $iVA->{_message_type} ); | ||
| 509 | $SuMessages->cdp_num( $iVA->{_cdp_first} ); | ||
| 510 | |||
| 511 | cdp_num( $iVA->{_cdp_first} ); | ||
| 512 | cdp_num_suffix( $iVA->{_cdp_first} ); | ||
| 513 | |||
| 514 | # print("cdp_num_suffix is $iVA->{_cdp_num_suffix}\n\n"); | ||
| 515 | _message('first_velan'); | ||
| 516 | $iVA->{_number_of_tries} = 0; | ||
| 517 | semblance(); | ||
| 518 | |||
| 519 | } | ||
| 520 | |||
| 521 | =head2 subroutine pick | ||
| 522 | |||
| 523 | Picking data | ||
| 524 | send cdp number to subroutine | ||
| 525 | update cdp_num_suffix | ||
| 526 | and update the Tvel_outbound. | ||
| 527 | delete output of previous semblance | ||
| 528 | |||
| 529 | -replot 1st semblance | ||
| 530 | -PICK V-T pairs | ||
| 531 | -Increment number of tries. | ||
| 532 | Semblance display becomes interactive | ||
| 533 | when number_of_tries >= 1 | ||
| 534 | Because display blocks flow, | ||
| 535 | place message before semblance | ||
| 536 | |||
| 537 | =cut | ||
| 538 | |||
| 539 | sub pick { | ||
| 540 | |||
| 541 | print("Picking...cdp $iVA->{_cdp_num}\n"); | ||
| 542 | print("NOW, PICK\n\n"); | ||
| 543 | cdp_num_suffix( $iVA->{_cdp_num} ); | ||
| 544 | refresh_Tvel_inbound(); | ||
| 545 | refresh_Tvel_outbound(); | ||
| 546 | |||
| 547 | #$xk->kill_this('suximage'); | ||
| 548 | #$xk->kill_this('suxwigb'); | ||
| 549 | _message('pre_pick_velan'); | ||
| 550 | $iVA->{_number_of_tries}++; | ||
| 551 | semblance(); | ||
| 552 | |||
| 553 | } | ||
| 554 | |||
| 555 | =head2 sub next | ||
| 556 | |||
| 557 | 1. increment cdp | ||
| 558 | update variable variables | ||
| 559 | (cdp_num_suffix, Tvel_inbound and Tvel_outbound) | ||
| 560 | Exit if beyond last cdp | ||
| 561 | 2. reset prompt | ||
| 562 | reset the number of tries to zero again | ||
| 563 | 3. Otherwise display the first semblance | ||
| 564 | -Based on semblance, | ||
| 565 | decide whether to PICK or move on to NEXT CDP | ||
| 566 | -radio_buttons stop flow | ||
| 567 | |||
| 568 | delete output of previous semblance | ||
| 569 | delete the output of semblance and iSunmo | ||
| 570 | delete the output of Vrms2Vint | ||
| 571 | |||
| 572 | =cut | ||
| 573 | |||
| 574 | sub next { | ||
| 575 | |||
| 576 | $iVA->{_cdp_num} = $iVA->{_cdp_num} + $iVA->{_cdp_inc}; | ||
| 577 | cdp_num_suffix( $iVA->{_cdp_num} ); | ||
| 578 | refresh_Tvel_inbound(); | ||
| 579 | refresh_Tvel_outbound(); | ||
| 580 | $iVA->{_number_of_tries} = 0; | ||
| 581 | |||
| 582 | #print("Next CDP_NUM IS $iVA->{_cdp_num}"); | ||
| 583 | |||
| 584 | #$xk->kill_this('suximage'); | ||
| 585 | #$xk->kill_this('suxwigb'); | ||
| 586 | #$xk->kill_this('xgraph'); | ||
| 587 | if ( $iVA->{_cdp_num} > $iVA->{_cdp_last} ) { | ||
| 588 | exit(); | ||
| 589 | } | ||
| 590 | |||
| 591 | semblance(); | ||
| 592 | $SuMessages->cdp_num( $iVA->{_cdp_num} ); | ||
| 593 | _message('first_velan'); | ||
| 594 | |||
| 595 | } | ||
| 596 | |||
| 597 | =head2 subroutine exit | ||
| 598 | |||
| 599 | =cut | ||
| 600 | |||
| 601 | sub exit { | ||
| 602 | |||
| 603 | print("Good bye.\n"); | ||
| 604 | print("Not continuing to next cdp\n"); | ||
| 605 | $xk->kill_this('suximage'); | ||
| 606 | $xk->kill_this('suxwigb'); | ||
| 607 | $xk->kill_this('xgraph'); | ||
| 608 | exit(1); | ||
| 609 | |||
| 610 | } | ||
| 611 | |||
| 612 | =head2 Calculate NMO | ||
| 613 | |||
| 614 | 0. Message to user | ||
| 615 | 1. delete the output of previous semblance | ||
| 616 | 2. calculations | ||
| 617 | 3. message is needed because semblance halts flow | ||
| 618 | when number_of_tries >0 | ||
| 619 | |||
| 620 | =cut | ||
| 621 | |||
| 622 | sub calc { | ||
| 623 | |||
| 624 | # print("iVA, calc, Calculating...\n"); | ||
| 625 | |||
| 626 | #$xk->kill_this('suximage'); | ||
| 627 | #$xk->kill_this('suxwigb'); | ||
| 628 | _iWrite_All_iva_out(); | ||
| 629 | _iVrms2Vint(); | ||
| 630 | _icp_sorted2oldpicks(); | ||
| 631 | _iVpicks2par(); | ||
| 632 | # print("iVA, calc, Calculating...\n"); | ||
| 633 | _iSunmo(); | ||
| 634 | $iVA->{_number_of_tries}++; | ||
| 635 | _message('post_pick_velan'); | ||
| 636 | semblance(); | ||
| 637 | |||
| 638 | } | ||
| 639 | |||
| 640 | =head2 | ||
| 641 | |||
| 642 | subroutine icp_sorted_2_old_picks | ||
| 643 | When user wants to recheck the data velocity_increment | ||
| 644 | this subroutine will allow the user to recheck using an old sorted file | ||
| 645 | Juan M. Lorenzo | ||
| 646 | Jan 10 2010 | ||
| 647 | |||
| 648 | input file is ivpicks_sorted | ||
| 649 | output pick file | ||
| 650 | text file out: ivpicks_old | ||
| 651 | |||
| 652 | |||
| 653 | =cut | ||
| 654 | |||
| 655 | sub _icp_sorted2oldpicks { | ||
| 656 | |||
| 657 | my ( @cdp_num, @sorted_suffix, @suffix ); | ||
| 658 | my ( @sufile_in, @vpicks_in, @vpicks_out ); | ||
| 659 | my ( @sortfile_in, @inbound, @outbound ); | ||
| 660 | my (@writefile_out); | ||
| 661 | my (@flow); | ||
| 662 | |||
| 663 | $cdp_num[1] = $iVA->{_cdp_num}; | ||
| 664 | |||
| 665 | # suffixes | ||
| 666 | $sorted_suffix[1] = '_sorted'; | ||
| 667 | $suffix[3] = '_cdp' . $iVA->{_cdp_num}; | ||
| 668 | |||
| 669 | # su file names | ||
| 670 | $sufile_in[1] = $iVA->{_base_file_name}; # any itnernal ticks removed | ||
| 671 | |||
| 672 | #V file names | ||
| 673 | $vpicks_in[1] = 'ivpicks_old' . $sorted_suffix[1]; | ||
| 674 | $vpicks_out[1] = 'ivpicks_old'; | ||
| 675 | |||
| 676 | # sort file names | ||
| 677 | $sortfile_in[1] = $vpicks_in[1]; | ||
| 678 | $inbound[1] = | ||
| 679 | $PL_SEISMIC . '/' . $sortfile_in[1] . '_' . $sufile_in[1] . $suffix[3]; | ||
| 680 | |||
| 681 | # Velocity write file names | ||
| 682 | $writefile_out[1] = $vpicks_out[1]; | ||
| 683 | $outbound[1] = | ||
| 684 | $PL_SEISMIC . '/' . $writefile_out[1] . '_' . $sufile_in[1] . $suffix[3]; | ||
| 685 | |||
| 686 | # DEFINE FLOW(S) | ||
| 687 | $flow[1] = ( | ||
| 688 | " \\ | ||
| 689 | cp \\ | ||
| 690 | $inbound[1] \\ | ||
| 691 | $outbound[1] \\ | ||
| 692 | " | ||
| 693 | ); | ||
| 694 | |||
| 695 | # RUN FLOW(S) | ||
| 696 | system $flow[1]; | ||
| 697 | |||
| 698 | # system 'echo', $flow[1]; | ||
| 699 | #end of copy of Vrms old picks sorted to ivpicks_old | ||
| 700 | } | ||
| 701 | |||
| 702 | =head2 sub _iVrms2Vint | ||
| 703 | |||
| 704 | Purpose: Convert Vrms to Vinterval | ||
| 705 | Juan M. Lorenzo | ||
| 706 | April 7 2009 | ||
| 707 | Nov. 19 2013 | ||
| 708 | |||
| 709 | =cut | ||
| 710 | |||
| 711 | sub _iVrms2Vint { | ||
| 712 | |||
| 713 | $iVrms2Vint->first_velocity( $iVA->{_first_velocity} ); | ||
| 714 | $iVrms2Vint->number_of_velocities( $iVA->{_number_of_velocities} ); | ||
| 715 | $iVrms2Vint->velocity_increment( $iVA->{_velocity_increment} ); | ||
| 716 | $iVrms2Vint->file_in( $iVA->{_base_file_name} ); | ||
| 717 | $iVrms2Vint->cdp_num( $iVA->{_cdp_num} ); | ||
| 718 | $iVrms2Vint->tmax_s( $iVA->{_tmax_s} ); | ||
| 719 | $iVrms2Vint->calcNdisplay(); | ||
| 720 | |||
| 721 | } | ||
| 722 | |||
| 723 | =head2 sub iVpicsk2par_Vpicks | ||
| 724 | |||
| 725 | Purpose: Prepare velocity picks for | ||
| 726 | input to Sunmo | ||
| 727 | Interactive mode | ||
| 728 | Juan M. Lorenzo | ||
| 729 | April 7 2009 | ||
| 730 | Adapted from Forel and Pennington's iva.sh script | ||
| 731 | Nov 19 2013 | ||
| 732 | |||
| 733 | =cut | ||
| 734 | |||
| 735 | sub _iVpicks2par { | ||
| 736 | |||
| 737 | my ($self) = @_; | ||
| 738 | |||
| 739 | $iVpicks2par->file_in( $iVA->{_base_file_name} ) | ||
| 740 | ; # only if internal ticks have been removed | ||
| 741 | $iVpicks2par->cdp_num( $iVA->{_cdp_num} ); | ||
| 742 | $iVpicks2par->flows(); | ||
| 743 | |||
| 744 | } | ||
| 745 | |||
| 746 | sub _iSunmo { | ||
| 747 | |||
| 748 | my ($self) = @_; | ||
| 749 | |||
| 750 | print(" iVA, _iSunmo base_file_name=$iVA->{_base_file_name}\n\n"); | ||
| 751 | |||
| 752 | $iSunmo->file_in( $iVA->{_base_file_name} ); | ||
| 753 | $iSunmo->cdp_num( $iVA->{_cdp_num} ); | ||
| 754 | $iSunmo->freq( $iVA->{_freq} ); | ||
| 755 | $iSunmo->tmax_s( $iVA->{_tmax_s} ); | ||
| 756 | $iSunmo->calcNdisplay(); | ||
| 757 | |||
| 758 | } | ||
| 759 | |||
| 760 | =head2 sub semblance | ||
| 761 | |||
| 762 | Purpose: Generate Velocity Analysis | ||
| 763 | and Plot the results | ||
| 764 | |||
| 765 | =cut | ||
| 766 | |||
| 767 | sub semblance { | ||
| 768 | |||
| 769 | # print(" running semblance\n"); | ||
| 770 | # print(" iVA, semblance, number of tries is $iVA->{_number_of_tries}\n\n"); | ||
| 771 | |||
| 772 | $semblance->clear(); | ||
| 773 | $semblance->cdp_num( $iVA->{_cdp_num} ); | ||
| 774 | $semblance->cdp_num_suffix( $iVA->{_cdp_num} ); | ||
| 775 | $semblance->file_in( $iVA->{_base_file_name} ); | ||
| 776 | $semblance->set_data_scale( $iVA->{_data_scale} ); | ||
| 777 | $semblance->dt_s( $iVA->{_dt_s} ); | ||
| 778 | $semblance->tmax_s( $iVA->{_tmax_s} ); | ||
| 779 | $semblance->first_velocity( $iVA->{_first_velocity} ); | ||
| 780 | $semblance->freq( $iVA->{_freq} ); | ||
| 781 | $semblance->max_semblance( $iVA->{_max_semblance} ); | ||
| 782 | $semblance->min_semblance( $iVA->{_min_semblance} ); | ||
| 783 | $semblance->number_of_tries( $iVA->{_number_of_tries} ); | ||
| 784 | $semblance->number_of_velocities( $iVA->{_number_of_velocities} ); | ||
| 785 | $semblance->set_anis1($iVA->{_anis1} ); | ||
| 786 | $semblance->set_anis2($iVA->{_anis2} ); | ||
| 787 | $semblance->set_smute($iVA->{_smute} ); | ||
| 788 | $semblance->set_dtratio($iVA->{_dtratio} ); | ||
| 789 | $semblance->set_nsmooth($iVA->{_nsmooth} ); | ||
| 790 | $semblance->set_pwr($iVA->{_pwr} ); | ||
| 791 | # $semblance->set_verbose(} );; | ||
| 792 | $semblance->velocity_increment( $iVA->{_velocity_increment} ); | ||
| 793 | $semblance->Tvel_inbound( $iVA->{_Tvel_inbound} ); | ||
| 794 | $semblance->Tvel_outbound( $iVA->{_Tvel_outbound} ); | ||
| 795 | $semblance->calcNdisplay(); | ||
| 796 | } | ||
| 797 | |||
| 798 | =head2 | ||
| 799 | |||
| 800 | subroutine Write_All_iva_out.pl | ||
| 801 | Purpose: Write out best vpicked files from iVA | ||
| 802 | needs sufile name and cdp number | ||
| 803 | |||
| 804 | =cut | ||
| 805 | |||
| 806 | sub _iWrite_All_iva_out { | ||
| 807 | |||
| 808 | $iWrite_All_iva_out->file_in( $iVA->{_base_file_name} ); | ||
| 809 | $iWrite_All_iva_out->cdp_num( $iVA->{_cdp_num} ); | ||
| 810 | $iWrite_All_iva_out->flows(); | ||
| 811 | |||
| 812 | } | ||
| 813 | |||
| 814 | 1; |