| 1 | package App::SeismicUnixGui::misc::old_data; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | our $VERSION = '0.0.1'; | ||
| 5 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 6 | |||
| 7 | =pod | ||
| 8 | |||
| 9 | =head1 DOCUMENTATION | ||
| 10 | |||
| 11 | =head2 SYNOPSIS | ||
| 12 | |||
| 13 | |||
| 14 | PERL PROGRAM NAME: old_data | ||
| 15 | AUTHOR: Juan Lorenzo | ||
| 16 | DATE: Sept. 18 2015 | ||
| 17 | |||
| 18 | DESCRIPTION: | ||
| 19 | Version: 1.1 | ||
| 20 | Package used to locate pre-exisitng data sets | ||
| 21 | |||
| 22 | =head2 USE | ||
| 23 | |||
| 24 | =head3 NOTES | ||
| 25 | |||
| 26 | =head4 | ||
| 27 | Examples | ||
| 28 | |||
| 29 | =head3 SEISMIC UNIX NOTES | ||
| 30 | |||
| 31 | =head4 CHANGES and their DATES | ||
| 32 | |||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | =pod | ||
| 37 | |||
| 38 | =head3 STEPS | ||
| 39 | |||
| 40 | 1. define the types of variables you are using | ||
| 41 | these would be the values you enter into | ||
| 42 | each of the Seismic Unix programs each of the | ||
| 43 | Seismic Unix programs | ||
| 44 | |||
| 45 | 2. build a list or hash with all the possible variable | ||
| 46 | names you may use and you can even change them | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | my $get = L_SU_global_constants->new(); | ||
| 51 | |||
| 52 | my $var = $get->var(); | ||
| 53 | my $empty_string = $var->{_empty_string}; | ||
| 54 | |||
| 55 | my $old_data = { | ||
| 56 | _TX_inbound => '', | ||
| 57 | _TX_outbound => '', | ||
| 58 | _Tvel_inbound => '', | ||
| 59 | _Tvel_outbound => '', | ||
| 60 | _cdp_num => '', | ||
| 61 | _gather_num => '', | ||
| 62 | _exists => '', | ||
| 63 | _textfile_in => '', | ||
| 64 | _textfile_out => '', | ||
| 65 | _type => '' | ||
| 66 | |||
| 67 | }; | ||
| 68 | |||
| 69 | =head3 | ||
| 70 | |||
| 71 | Import file-name and directory definitions | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $in $to $go | ||
| 76 | $itemp_top_mute_picks_ $itop_mute_par_ $itemp_top_mute_picks_sorted_par_ | ||
| 77 | $itop_mute_check_pickfile_ | ||
| 78 | $itemp_bot_mute_picks_ $ibot_mute_par_ $itemp_bot_mute_picks_sorted_par_ | ||
| 79 | $ibot_mute_check_pickfile_ | ||
| 80 | $itemp_picks_ $ipicks_par_ $itemp_picks_sorted_par_ | ||
| 81 | $ipick_check_pickfile_ | ||
| 82 | $false $true $suffix_su $suffix_su); | ||
| 83 | |||
| 84 | =head2 | ||
| 85 | |||
| 86 | other needed packages | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 91 | my $Project = Project_config->new(); | ||
| 92 | use aliased 'App::SeismicUnixGui::misc::manage_files_by2'; | ||
| 93 | |||
| 94 | my ($PL_SEISMIC) = $Project->PL_SEISMIC(); | ||
| 95 | my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT; | ||
| 96 | |||
| 97 | =pod | ||
| 98 | |||
| 99 | instantiate packages | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | my $test = manage_files_by2->new(); | ||
| 104 | |||
| 105 | =head2 subroutine clear | ||
| 106 | |||
| 107 | sets all variable strings to '' | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub clear { | ||
| 112 | |||
| 113 | $old_data->{_TX_inbound} = ''; | ||
| 114 | $old_data->{_TX_outbound} = ''; | ||
| 115 | $old_data->{_Tvel_inbound} = ''; | ||
| 116 | $old_data->{_Tvel_outbound} = ''; | ||
| 117 | $old_data->{_cdp_num} = ''; | ||
| 118 | $old_data->{_gather_num} = ''; | ||
| 119 | $old_data->{_exists} = ''; | ||
| 120 | $old_data->{_textfile_in} = ''; | ||
| 121 | $old_data->{_textfile_out} = ''; | ||
| 122 | $old_data->{_type} = ''; | ||
| 123 | } | ||
| 124 | |||
| 125 | my ( $file_existence1, $file_existence2 ); | ||
| 126 | my ( $ans, $itop_mute_picks, $itop_mute_par ); | ||
| 127 | my @answers; | ||
| 128 | |||
| 129 | =head2 subroutine cdp | ||
| 130 | |||
| 131 | sets cdp number to consider | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub cdp_num { | ||
| 136 | my ( $self, $cdp_num ) = @_; | ||
| 137 | $old_data->{_cdp_num} = $cdp_num if defined($cdp_num); | ||
| 138 | $old_data->{_cdp_num_suffix} = '_cdp' . $old_data->{_cdp_num}; | ||
| 139 | } | ||
| 140 | |||
| 141 | =head2 subroutine gather | ||
| 142 | |||
| 143 | sets gather number to consider | ||
| 144 | |||
| 145 | =cut | ||
| 146 | |||
| 147 | sub gather_num { | ||
| 148 | my ( $self, $gather_num ) = @_; | ||
| 149 | $old_data->{_gather_num} = $gather_num if defined($gather_num); | ||
| 150 | $old_data->{_gather_num_suffix} = '_gather' . $old_data->{_gather_num}; | ||
| 151 | } | ||
| 152 | |||
| 153 | =head3 subroutine file_in | ||
| 154 | |||
| 155 | Required file name | ||
| 156 | on which to pick top mute values | ||
| 157 | |||
| 158 | =cut | ||
| 159 | |||
| 160 | sub file_in { | ||
| 161 | |||
| 162 | my ( $self, $file_in ) = @_; | ||
| 163 | $old_data->{_file_in} = $file_in if defined($file_in); | ||
| 164 | |||
| 165 | # print("old_data,file_in,file name is $old_data->{_file_in} \n\n"); | ||
| 166 | } | ||
| 167 | |||
| 168 | =head3 sub type | ||
| 169 | |||
| 170 | switches for old data of two different types | ||
| 171 | |||
| 172 | for type: velan | ||
| 173 | test whether previous velan pick files exist | ||
| 174 | textfile_in: ivpicks_old | ||
| 175 | |||
| 176 | for type: Top_mute | ||
| 177 | test whether previous mute pick files exist | ||
| 178 | |||
| 179 | for type: iSpectralAnalysis | ||
| 180 | test whether previous spectral analyses picks files exist | ||
| 181 | |||
| 182 | for type: iPick_xt files (general picking of x,t pairs) | ||
| 183 | |||
| 184 | |||
| 185 | =cut | ||
| 186 | |||
| 187 | sub type { | ||
| 188 | |||
| 189 | my ( $self, $type ) = @_; | ||
| 190 | |||
| 191 | if ( $type && $type ne $empty_string ) { | ||
| 192 | |||
| 193 | $old_data->{_type} = $type; | ||
| 194 | |||
| 195 | if ( $old_data->{_type} eq 'iSpectralAnalysis' ) { | ||
| 196 | |||
| 197 | $old_data->{_textfile_in} = | ||
| 198 | 'waveform' . '_' | ||
| 199 | . $old_data->{_file_in} | ||
| 200 | . $old_data->{_cdp_num_suffix} | ||
| 201 | if defined($old_data); | ||
| 202 | $old_data->{_Tvel_inbound} = | ||
| 203 | $PL_SEISMIC . '/' . $old_data->{_textfile_in} | ||
| 204 | if defined( ( $old_data && $PL_SEISMIC ) ); | ||
| 205 | $ans = $test->does_file_exist( \$old_data->{_Tvel_inbound} ); | ||
| 206 | return ($ans); | ||
| 207 | } | ||
| 208 | |||
| 209 | if ( $old_data->{_type} eq 'velan' ) { | ||
| 210 | |||
| 211 | $old_data->{_textfile_in} = | ||
| 212 | 'ivpicks_old' . '_' | ||
| 213 | . $old_data->{_file_in} | ||
| 214 | . $old_data->{_cdp_num_suffix} | ||
| 215 | if defined($old_data); | ||
| 216 | $old_data->{_Tvel_inbound} = | ||
| 217 | $PL_SEISMIC . '/' . $old_data->{_textfile_in} | ||
| 218 | if defined( ( $old_data && $PL_SEISMIC ) ); | ||
| 219 | $ans = $test->does_file_exist( \$old_data->{_Tvel_inbound} ); | ||
| 220 | |||
| 221 | # $old_data->{_textfile_out} = 'ivpicks_'.$old_data->{_file_in}.$old_data->{_cdp_num_suffix} if defined(($old_data && ($old_data->{_file_in} && $old_data->{_cdp_num_suffix}))); | ||
| 222 | # $old_data->{_Tvel_outbound} = $PL_SEISMIC.'/'.$old_data->{_textfile_out} if defined(($old_data && $PL_SEISMIC )); | ||
| 223 | # print("Tvel out is $old_data->{_Tvel_outbound}\n\n"); | ||
| 224 | # print("Tvel in is $old_data->{_Tvel_inbound}\n\n"); | ||
| 225 | return ($ans); | ||
| 226 | |||
| 227 | } | ||
| 228 | |||
| 229 | =pod | ||
| 230 | |||
| 231 | test whether previous top-mute pick files exist | ||
| 232 | |||
| 233 | =cut | ||
| 234 | |||
| 235 | if ( $old_data->{_type} eq 'TopMute' ) { | ||
| 236 | |||
| 237 | if ( length $itemp_top_mute_picks_sorted_par_ | ||
| 238 | and length $old_data->{_file_in} | ||
| 239 | and length $old_data->{_gather_num_suffix} ) | ||
| 240 | { | ||
| 241 | |||
| 242 | $old_data->{_textfile_in} = | ||
| 243 | $itemp_top_mute_picks_sorted_par_ | ||
| 244 | . $old_data->{_file_in} | ||
| 245 | . $old_data->{_gather_num_suffix}; | ||
| 246 | |||
| 247 | $old_data->{_TX_inbound} = | ||
| 248 | $DATA_SEISMIC_TXT . '/' . $old_data->{_textfile_in} | ||
| 249 | if defined( ( $old_data && $DATA_SEISMIC_TXT ) ); | ||
| 250 | $ans = $test->does_file_exist( \$old_data->{_TX_inbound} ); | ||
| 251 | |||
| 252 | # print("TX in is $old_data->{_TX_inbound}\n\n"); | ||
| 253 | return ($ans); | ||
| 254 | |||
| 255 | } | ||
| 256 | else { | ||
| 257 | print("old_data, missing values\n\n"); | ||
| 258 | print( | ||
| 259 | "itemp_top_mute_picks_sorted_par_=$itemp_top_mute_picks_sorted_par_\n" | ||
| 260 | ); | ||
| 261 | print("old_data->{_file_in}=$old_data->{_file_in}\n"); | ||
| 262 | print( | ||
| 263 | "old_data->{_gather_num_suffix}=$old_data->{_gather_num_suffix}\n" | ||
| 264 | ); | ||
| 265 | return (); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | # print("TX in is $old_data->{_TX_inbound}\n\n"); | ||
| 269 | |||
| 270 | =pod | ||
| 271 | |||
| 272 | test whether previous bottom-mute pick files exist | ||
| 273 | |||
| 274 | =cut | ||
| 275 | |||
| 276 | if ( $old_data->{_type} eq 'BottomMute' ) { | ||
| 277 | |||
| 278 | if ( length $itemp_bot_mute_picks_sorted_par_ | ||
| 279 | and length $old_data->{_file_in} | ||
| 280 | and length $old_data->{_gather_num_suffix} ) | ||
| 281 | { | ||
| 282 | |||
| 283 | $old_data->{_textfile_in} = | ||
| 284 | $itemp_bot_mute_picks_sorted_par_ | ||
| 285 | . $old_data->{_file_in} | ||
| 286 | . $old_data->{_gather_num_suffix}; | ||
| 287 | |||
| 288 | $old_data->{_TX_inbound} = | ||
| 289 | $DATA_SEISMIC_TXT . '/' . $old_data->{_textfile_in} | ||
| 290 | if defined( ( $old_data && $DATA_SEISMIC_TXT ) ); | ||
| 291 | $ans = $test->does_file_exist( \$old_data->{_TX_inbound} ); | ||
| 292 | |||
| 293 | return ($ans); | ||
| 294 | |||
| 295 | } | ||
| 296 | else { | ||
| 297 | print("old_data, missing values\n\n"); | ||
| 298 | print( | ||
| 299 | "itemp_bot_mute_picks_sorted_par_=$itemp_bot_mute_picks_sorted_par_\n" | ||
| 300 | ); | ||
| 301 | print("old_data->{_file_in}=$old_data->{_file_in}\n"); | ||
| 302 | print( | ||
| 303 | "old_data->{_gather_num_suffix}=$old_data->{_gather_num_suffix}\n" | ||
| 304 | ); | ||
| 305 | return (); | ||
| 306 | } | ||
| 307 | } | ||
| 308 | |||
| 309 | print("TX in is $old_data->{_TX_inbound}\n\n"); | ||
| 310 | |||
| 311 | if ( $old_data->{_type} eq 'Pick_xt' ) { | ||
| 312 | $old_data->{_textfile_in} = | ||
| 313 | $itemp_picks_sorted_par_ | ||
| 314 | . $old_data->{_file_in} | ||
| 315 | . $old_data->{_gather_num_suffix}; | ||
| 316 | $old_data->{_TX_inbound} = | ||
| 317 | $DATA_SEISMIC_TXT . '/' . $old_data->{_textfile_in} | ||
| 318 | if defined( ( $old_data && $DATA_SEISMIC_TXT ) ); | ||
| 319 | $ans = $test->does_file_exist( \$old_data->{_TX_inbound} ); | ||
| 320 | |||
| 321 | # print("TX in is $old_data->{_TX_inbound}\n\n"); | ||
| 322 | return ($ans); | ||
| 323 | } | ||
| 324 | |||
| 325 | =pod | ||
| 326 | |||
| 327 | file name definitions | ||
| 328 | |||
| 329 | |||
| 330 | $itop_mute_picks = $PL_SE$DATA_SEISMIC_TXTitop_mute_check_pickfile_.$old_data->{_file_in}; | ||
| 331 | |||
| 332 | $itop_mute_par = $DATA_SEISMIC_TXT.'/'.$itop_mute_par_.$old_data->{_file_in}; | ||
| 333 | |||
| 334 | # set defaults | ||
| 335 | # Do old mute files exist | ||
| 336 | # that can be applied? | ||
| 337 | $file_existence1 = $false; | ||
| 338 | $file_existence2 = $false; | ||
| 339 | |||
| 340 | ($file_existence1) = $test->does_file_exist(\$itop_mute_picks); | ||
| 341 | |||
| 342 | ($file_existence2) = $test->does_file_exist(\$itop_mute_par); | ||
| 343 | $answers[1] = $file_existence1; | ||
| 344 | $answers[2] = $file_existence2; | ||
| 345 | |||
| 346 | return $old_data->{_find}; | ||
| 347 | |||
| 348 | =cut | ||
| 349 | |||
| 350 | =pod | ||
| 351 | |||
| 352 | file name definitions | ||
| 353 | |||
| 354 | |||
| 355 | $itop_mute_picks = $DATA_SEISMIC_TXT.'/'.$itop_mute_check_pickfile_.$old_data->{_file_in}; | ||
| 356 | |||
| 357 | $itop_mute_par = $DATA_SEISMIC_TXT.'/'.$itop_mute_par_.$old_data->{_file_in}; | ||
| 358 | |||
| 359 | # set defaults | ||
| 360 | # Do old mute files exist | ||
| 361 | # that can be applied? | ||
| 362 | $file_existence1 = $false; | ||
| 363 | $file_existence2 = $false; | ||
| 364 | |||
| 365 | ($file_existence1) = $test->does_file_exist(\$itop_mute_picks); | ||
| 366 | |||
| 367 | ($file_existence2) = $test->does_file_exist(\$itop_mute_par); | ||
| 368 | $answers[1] = $file_existence1; | ||
| 369 | $answers[2] = $file_existence2; | ||
| 370 | |||
| 371 | return $old_data->{_find}; | ||
| 372 | |||
| 373 | =cut | ||
| 374 | |||
| 375 | } | ||
| 376 | else { | ||
| 377 | print("old_data,type, old_data,type,unexpected data type\n"); | ||
| 378 | } | ||
| 379 | |||
| 380 | } #end subroutine type | ||
| 381 | |||
| 382 | 1; |