« lib/App/SeismicUnixGui/sunix/par/transp.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/statsMath/suconv.pm »
| 1 | package App::SeismicUnixGui::sunix::shapeNcut::suvcat; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 8 | |||
| 9 | DATE: | ||
| 10 | |||
| 11 | DESCRIPTION: | ||
| 12 | |||
| 13 | Version: | ||
| 14 | |||
| 15 | =head2 USE | ||
| 16 | |||
| 17 | =head3 NOTES | ||
| 18 | |||
| 19 | =head4 Examples | ||
| 20 | |||
| 21 | =head2 SYNOPSIS | ||
| 22 | |||
| 23 | =head3 SEISMIC UNIX NOTES | ||
| 24 | SUVCAT - append one data set to another, with or without an ", | ||
| 25 | |||
| 26 | overlapping region. Data in the overlap may be | ||
| 27 | |||
| 28 | determined by one of several methods. | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | suvcat data1 data2 >stdout | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | Required parameters: | ||
| 37 | |||
| 38 | none | ||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | Optional parameters for overlapping sections: | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | taplen=0 Length of overlap in integer number of | ||
| 47 | |||
| 48 | samples.(Default is 0.) | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | taptype=0 Type of taper or combination method in the | ||
| 53 | |||
| 54 | overlap region. 0 - average | ||
| 55 | |||
| 56 | 1 - maximum magnitude | ||
| 57 | |||
| 58 | 2 - cosine scaled | ||
| 59 | |||
| 60 | 3 - summation | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | Computational Notes: | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | This program vertically concatenates traces from data2 onto | ||
| 69 | |||
| 70 | the end of the corresponding traces in data1, with a region | ||
| 71 | |||
| 72 | of overlap, defined by taplen. Data in the overlapping ", | ||
| 73 | |||
| 74 | region is combined by the method specified by taptype. The | ||
| 75 | |||
| 76 | currently available methods are: | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | taptype=0 output is assigned the unweighted average of | ||
| 81 | |||
| 82 | each point in the overlap | ||
| 83 | |||
| 84 | taptype=1 output is assigned the value of the maximum | ||
| 85 | |||
| 86 | absolute value of each point in the overlap | ||
| 87 | |||
| 88 | taptype=2 output is assigned the weighted average of | ||
| 89 | |||
| 90 | each point in the overlap, where the output | ||
| 91 | |||
| 92 | is the sum of cos(x) times the values on the | ||
| 93 | |||
| 94 | first section, and 1-cos(x) times the values | ||
| 95 | |||
| 96 | on the second section, where x is factor that | ||
| 97 | |||
| 98 | goes from 0 to pi/2 across the overlap. This | ||
| 99 | |||
| 100 | favors the upper section in the upper part of | ||
| 101 | |||
| 102 | the overlap, and favors the lower section in | ||
| 103 | |||
| 104 | the lower part of the overlap. | ||
| 105 | |||
| 106 | taptype=3 output is assigned the sum of the amplitudes | ||
| 107 | |||
| 108 | at each sample in the overlap | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | Credits: | ||
| 115 | |||
| 116 | CWP: Jack K. Cohen, Michel Dietrich (Original SUVCAT) | ||
| 117 | |||
| 118 | Steven D. Sheaffer (modifed to include overlap) | ||
| 119 | |||
| 120 | IfG Kiel: Thies Beilecke (added taptype=3) | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | Trace header fields accessed: ns | ||
| 125 | |||
| 126 | Trace header fields modified: ns | ||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | =head2 User's notes (Juan Lorenzo) | ||
| 131 | untested | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | |||
| 136 | =head2 CHANGES and their DATES | ||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | use Moose; | ||
| 141 | our $VERSION = '0.0.1'; | ||
| 142 | |||
| 143 | |||
| 144 | =head2 Import packages | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 149 | |||
| 150 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 151 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 152 | |||
| 153 | |||
| 154 | =head2 instantiation of packages | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | my $get = L_SU_global_constants->new(); | ||
| 159 | my $Project = Project_config->new(); | ||
| 160 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 161 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 162 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 163 | |||
| 164 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 165 | |||
| 166 | my $var = $get->var(); | ||
| 167 | my $on = $var->{_on}; | ||
| 168 | my $off = $var->{_off}; | ||
| 169 | my $true = $var->{_true}; | ||
| 170 | my $false = $var->{_false}; | ||
| 171 | my $empty_string = $var->{_empty_string}; | ||
| 172 | |||
| 173 | =head2 Encapsulated | ||
| 174 | hash of private variables | ||
| 175 | |||
| 176 | =cut | ||
| 177 | |||
| 178 | my $suvcat = { | ||
| 179 | _fileA => '', | ||
| 180 | _fileB => '', | ||
| 181 | _taplen => '', | ||
| 182 | _taptype => '', | ||
| 183 | _Step => '', | ||
| 184 | _note => '', | ||
| 185 | |||
| 186 | }; | ||
| 187 | |||
| 188 | =head2 sub Step | ||
| 189 | |||
| 190 | collects switches and assembles bash instructions | ||
| 191 | by adding the program name | ||
| 192 | |||
| 193 | =cut | ||
| 194 | |||
| 195 | sub Step { | ||
| 196 | |||
| 197 | $suvcat->{_Step} = 'suvcat'.$suvcat->{_Step}; | ||
| 198 | return ( $suvcat->{_Step} ); | ||
| 199 | |||
| 200 | } | ||
| 201 | |||
| 202 | |||
| 203 | =head2 sub note | ||
| 204 | |||
| 205 | collects switches and assembles bash instructions | ||
| 206 | by adding the program name | ||
| 207 | |||
| 208 | =cut | ||
| 209 | |||
| 210 | sub note { | ||
| 211 | |||
| 212 | $suvcat->{_note} = 'suvcat'.$suvcat->{_note}; | ||
| 213 | return ( $suvcat->{_note} ); | ||
| 214 | |||
| 215 | } | ||
| 216 | |||
| 217 | |||
| 218 | |||
| 219 | =head2 sub clear | ||
| 220 | |||
| 221 | =cut | ||
| 222 | |||
| 223 | sub clear { | ||
| 224 | |||
| 225 | $suvcat->{_fileA} = ''; | ||
| 226 | $suvcat->{_fileB} = ''; | ||
| 227 | $suvcat->{_taplen} = ''; | ||
| 228 | $suvcat->{_taptype} = ''; | ||
| 229 | $suvcat->{_Step} = ''; | ||
| 230 | $suvcat->{_note} = ''; | ||
| 231 | } | ||
| 232 | |||
| 233 | =head2 subroutine fileA | ||
| 234 | |||
| 235 | subs fileA and file1, first file with which to operate | ||
| 236 | |||
| 237 | =cut | ||
| 238 | |||
| 239 | sub fileA { | ||
| 240 | |||
| 241 | my ( $self, $fileA ) = @_; | ||
| 242 | |||
| 243 | if ($fileA) { | ||
| 244 | |||
| 245 | $suvcat->{_file1} = $fileA; | ||
| 246 | $suvcat->{_note} = $suvcat->{_note} . ' ' . $suvcat->{_file1}; | ||
| 247 | $suvcat->{_Step} = $suvcat->{_Step} . ' ' . $suvcat->{_file1}; | ||
| 248 | |||
| 249 | } | ||
| 250 | else { | ||
| 251 | print("suvcat, fileA, first file is missing,\n"); | ||
| 252 | } | ||
| 253 | |||
| 254 | return (); | ||
| 255 | } | ||
| 256 | |||
| 257 | =head2 subroutine fileB | ||
| 258 | |||
| 259 | subs file2, fileB, second file with which to operate | ||
| 260 | |||
| 261 | =cut | ||
| 262 | |||
| 263 | sub fileB { | ||
| 264 | |||
| 265 | my ( $self, $fileB ) = @_; | ||
| 266 | |||
| 267 | if ($fileB) { | ||
| 268 | |||
| 269 | $suvcat->{_file2} = $fileB; | ||
| 270 | $suvcat->{_note} = $suvcat->{_note} . ' ' . $suvcat->{_file2}; | ||
| 271 | $suvcat->{_Step} = $suvcat->{_Step} . ' ' . $suvcat->{_file2}; | ||
| 272 | |||
| 273 | } | ||
| 274 | else { | ||
| 275 | print("suvcat, fileB, second file is missing,\n"); | ||
| 276 | } | ||
| 277 | |||
| 278 | return (); | ||
| 279 | } | ||
| 280 | |||
| 281 | |||
| 282 | =head2 sub taplen | ||
| 283 | |||
| 284 | |||
| 285 | =cut | ||
| 286 | |||
| 287 | sub taplen { | ||
| 288 | |||
| 289 | my ( $self,$taplen ) = @_; | ||
| 290 | if ( $taplen ne $empty_string ) { | ||
| 291 | |||
| 292 | $suvcat->{_taplen} = $taplen; | ||
| 293 | $suvcat->{_note} = $suvcat->{_note}.' taplen='.$suvcat->{_taplen}; | ||
| 294 | $suvcat->{_Step} = $suvcat->{_Step}.' taplen='.$suvcat->{_taplen}; | ||
| 295 | |||
| 296 | } else { | ||
| 297 | print("suvcat, taplen, missing taplen,\n"); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | |||
| 302 | =head2 sub taptype | ||
| 303 | |||
| 304 | |||
| 305 | =cut | ||
| 306 | |||
| 307 | sub taptype { | ||
| 308 | |||
| 309 | my ( $self,$taptype ) = @_; | ||
| 310 | if ( $taptype ne $empty_string ) { | ||
| 311 | |||
| 312 | $suvcat->{_taptype} = $taptype; | ||
| 313 | $suvcat->{_note} = $suvcat->{_note}.' taptype='.$suvcat->{_taptype}; | ||
| 314 | $suvcat->{_Step} = $suvcat->{_Step}.' taptype='.$suvcat->{_taptype}; | ||
| 315 | |||
| 316 | } else { | ||
| 317 | print("suvcat, taptype, missing taptype,\n"); | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | |||
| 322 | =head2 sub get_max_index | ||
| 323 | |||
| 324 | max index = number of input variables -1 | ||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | sub get_max_index { | ||
| 329 | my ($self) = @_; | ||
| 330 | my $max_index = 3; | ||
| 331 | |||
| 332 | return($max_index); | ||
| 333 | } | ||
| 334 | |||
| 335 | |||
| 336 | 1; |