« lib/App/SeismicUnixGui/sunix/data/segdread.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/plot/todo/viewer3.pm »
| 1 | package App::SeismicUnixGui::sunix::filter::sudipfilt; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: SUDIPFILT - DIP--or better--SLOPE Filter in f-k domain | ||
| 8 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 9 | DATE: | ||
| 10 | DESCRIPTION: | ||
| 11 | Version: | ||
| 12 | |||
| 13 | =head2 USE | ||
| 14 | |||
| 15 | =head3 NOTES | ||
| 16 | |||
| 17 | =head4 Examples | ||
| 18 | |||
| 19 | =head3 SEISMIC UNIX NOTES | ||
| 20 | |||
| 21 | SUDIPFILT - DIP--or better--SLOPE Filter in f-k domain | ||
| 22 | |||
| 23 | sudipfilt <infile >outfile [optional parameters] | ||
| 24 | |||
| 25 | Required Parameters: | ||
| 26 | dt=(from header) if not set in header then mandatory | ||
| 27 | dx=(from header, d1) if not set in header then mandatory | ||
| 28 | |||
| 29 | Optional parameters: | ||
| 30 | slopes=0.0 monotonically increasing slopes | ||
| 31 | amps=1.0 amplitudes corresponding to slopes | ||
| 32 | bias=0.0 slope made horizontal before filtering | ||
| 33 | |||
| 34 | verbose=0 verbose = 1 echoes information | ||
| 35 | |||
| 36 | tmpdir= if non-empty, use the value as a directory path | ||
| 37 | prefix for storing temporary files; else if the | ||
| 38 | the CWP_TMPDIR environment variable is set use | ||
| 39 | its value for the path; else use tmpfile() | ||
| 40 | |||
| 41 | Notes: | ||
| 42 | d2 is an acceptable alias for dx in the getpar | ||
| 43 | |||
| 44 | Slopes are defined by delta_t/delta_x, where delta | ||
| 45 | means change. Units of delta_t and delta_x are the same | ||
| 46 | as dt and dx. It is sometimes useful to fool the program | ||
| 47 | with dx=1 dt=1, thus avoiding units and small slope values. | ||
| 48 | |||
| 49 | Linear interpolation and constant extrapolation are used to | ||
| 50 | determine amplitudes for slopes that are not specified. | ||
| 51 | Linear moveout is removed before slope filtering to make | ||
| 52 | slopes equal to bias appear horizontal. This linear moveout | ||
| 53 | is restored after filtering. The bias parameter may be | ||
| 54 | useful for spatially aliased data. The slopes parameter is | ||
| 55 | compensated for bias, so you need not change slopes when you | ||
| 56 | change bias. | ||
| 57 | |||
| 58 | |||
| 59 | Credits: | ||
| 60 | |||
| 61 | CWP: Dave (algorithm--originally called slopef) | ||
| 62 | Jack (reformatting for SU) | ||
| 63 | |||
| 64 | Trace header fields accessed: ns, dt, d2 | ||
| 65 | |||
| 66 | =head2 CHANGES and their DATES | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | use Moose; | ||
| 71 | our $VERSION = '0.0.1'; | ||
| 72 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 73 | |||
| 74 | my $get = L_SU_global_constants->new(); | ||
| 75 | |||
| 76 | my $var = $get->var(); | ||
| 77 | my $empty_string = $var->{_empty_string}; | ||
| 78 | |||
| 79 | my $sudipfilt = { | ||
| 80 | _amps => '', | ||
| 81 | _bias => '', | ||
| 82 | _dt => '', | ||
| 83 | _dx => '', | ||
| 84 | _slopes => '', | ||
| 85 | _tmpdir => '', | ||
| 86 | _verbose => '', | ||
| 87 | _Step => '', | ||
| 88 | _note => '', | ||
| 89 | }; | ||
| 90 | |||
| 91 | =head2 sub Step | ||
| 92 | |||
| 93 | collects switches and assembles bash instructions | ||
| 94 | by adding the program name | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | sub Step { | ||
| 99 | |||
| 100 | $sudipfilt->{_Step} = 'sudipfilt' . $sudipfilt->{_Step}; | ||
| 101 | return ( $sudipfilt->{_Step} ); | ||
| 102 | |||
| 103 | } | ||
| 104 | |||
| 105 | =head2 sub note | ||
| 106 | |||
| 107 | collects switches and assembles bash instructions | ||
| 108 | by adding the program name | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | sub note { | ||
| 113 | |||
| 114 | $sudipfilt->{_note} = 'sudipfilt' . $sudipfilt->{_note}; | ||
| 115 | return ( $sudipfilt->{_note} ); | ||
| 116 | |||
| 117 | } | ||
| 118 | |||
| 119 | =head2 sub clear | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | sub clear { | ||
| 124 | |||
| 125 | $sudipfilt->{_amps} = ''; | ||
| 126 | $sudipfilt->{_bias} = ''; | ||
| 127 | $sudipfilt->{_dt} = ''; | ||
| 128 | $sudipfilt->{_dx} = ''; | ||
| 129 | $sudipfilt->{_slopes} = ''; | ||
| 130 | $sudipfilt->{_tmpdir} = ''; | ||
| 131 | $sudipfilt->{_verbose} = ''; | ||
| 132 | $sudipfilt->{_Step} = ''; | ||
| 133 | $sudipfilt->{_note} = ''; | ||
| 134 | } | ||
| 135 | |||
| 136 | =head2 sub amps | ||
| 137 | |||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | sub amps { | ||
| 142 | |||
| 143 | my ( $self, $amps ) = @_; | ||
| 144 | if ($amps) { | ||
| 145 | |||
| 146 | $sudipfilt->{_amps} = $amps; | ||
| 147 | $sudipfilt->{_note} = | ||
| 148 | $sudipfilt->{_note} . ' amps=' . $sudipfilt->{_amps}; | ||
| 149 | $sudipfilt->{_Step} = | ||
| 150 | $sudipfilt->{_Step} . ' amps=' . $sudipfilt->{_amps}; | ||
| 151 | |||
| 152 | } | ||
| 153 | else { | ||
| 154 | print("sudipfilt, amps, missing amps,\n"); | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | =head2 sub bias | ||
| 159 | |||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | sub bias { | ||
| 164 | |||
| 165 | my ( $self, $bias ) = @_; | ||
| 166 | if ( $bias ne $empty_string ) { | ||
| 167 | |||
| 168 | $sudipfilt->{_bias} = $bias; | ||
| 169 | $sudipfilt->{_note} = | ||
| 170 | $sudipfilt->{_note} . ' bias=' . $sudipfilt->{_bias}; | ||
| 171 | $sudipfilt->{_Step} = | ||
| 172 | $sudipfilt->{_Step} . ' bias=' . $sudipfilt->{_bias}; | ||
| 173 | |||
| 174 | } | ||
| 175 | else { | ||
| 176 | print("sudipfilt, bias, missing bias,\n"); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | =head2 sub dt | ||
| 181 | |||
| 182 | |||
| 183 | =cut | ||
| 184 | |||
| 185 | sub dt { | ||
| 186 | |||
| 187 | my ( $self, $dt ) = @_; | ||
| 188 | if ($dt) { | ||
| 189 | |||
| 190 | $sudipfilt->{_dt} = $dt; | ||
| 191 | $sudipfilt->{_note} = | ||
| 192 | $sudipfilt->{_note} . ' dt=' . $sudipfilt->{_dt}; | ||
| 193 | $sudipfilt->{_Step} = | ||
| 194 | $sudipfilt->{_Step} . ' dt=' . $sudipfilt->{_dt}; | ||
| 195 | |||
| 196 | } | ||
| 197 | else { | ||
| 198 | print("sudipfilt, dt, missing dt,\n"); | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 202 | =head2 sub dx | ||
| 203 | |||
| 204 | |||
| 205 | =cut | ||
| 206 | |||
| 207 | sub dx { | ||
| 208 | |||
| 209 | my ( $self, $dx ) = @_; | ||
| 210 | if ($dx) { | ||
| 211 | |||
| 212 | $sudipfilt->{_dx} = $dx; | ||
| 213 | $sudipfilt->{_note} = | ||
| 214 | $sudipfilt->{_note} . ' dx=' . $sudipfilt->{_dx}; | ||
| 215 | $sudipfilt->{_Step} = | ||
| 216 | $sudipfilt->{_Step} . ' dx=' . $sudipfilt->{_dx}; | ||
| 217 | |||
| 218 | } | ||
| 219 | else { | ||
| 220 | print("sudipfilt, dx, missing dx,\n"); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | |||
| 224 | =head2 sub slopes | ||
| 225 | |||
| 226 | |||
| 227 | =cut | ||
| 228 | |||
| 229 | sub slopes { | ||
| 230 | |||
| 231 | my ( $self, $slopes ) = @_; | ||
| 232 | if ($slopes) { | ||
| 233 | |||
| 234 | $sudipfilt->{_slopes} = $slopes; | ||
| 235 | $sudipfilt->{_note} = | ||
| 236 | $sudipfilt->{_note} . ' slopes=' . $sudipfilt->{_slopes}; | ||
| 237 | $sudipfilt->{_Step} = | ||
| 238 | $sudipfilt->{_Step} . ' slopes=' . $sudipfilt->{_slopes}; | ||
| 239 | |||
| 240 | } | ||
| 241 | else { | ||
| 242 | print("sudipfilt, slopes, missing slopes,\n"); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | |||
| 246 | =head2 sub tmpdir | ||
| 247 | |||
| 248 | |||
| 249 | =cut | ||
| 250 | |||
| 251 | sub tmpdir { | ||
| 252 | |||
| 253 | my ( $self, $tmpdir ) = @_; | ||
| 254 | if ($tmpdir) { | ||
| 255 | |||
| 256 | $sudipfilt->{_tmpdir} = $tmpdir; | ||
| 257 | $sudipfilt->{_note} = | ||
| 258 | $sudipfilt->{_note} . ' tmpdir=' . $sudipfilt->{_tmpdir}; | ||
| 259 | $sudipfilt->{_Step} = | ||
| 260 | $sudipfilt->{_Step} . ' tmpdir=' . $sudipfilt->{_tmpdir}; | ||
| 261 | |||
| 262 | } | ||
| 263 | else { | ||
| 264 | print("sudipfilt, tmpdir, missing tmpdir,\n"); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | =head2 sub verbose | ||
| 269 | |||
| 270 | |||
| 271 | =cut | ||
| 272 | |||
| 273 | sub verbose { | ||
| 274 | |||
| 275 | my ( $self, $verbose ) = @_; | ||
| 276 | if ( $verbose ne $empty_string ) { | ||
| 277 | |||
| 278 | $sudipfilt->{_verbose} = $verbose; | ||
| 279 | $sudipfilt->{_note} = | ||
| 280 | $sudipfilt->{_note} . ' verbose=' . $sudipfilt->{_verbose}; | ||
| 281 | $sudipfilt->{_Step} = | ||
| 282 | $sudipfilt->{_Step} . ' verbose=' . $sudipfilt->{_verbose}; | ||
| 283 | |||
| 284 | } | ||
| 285 | else { | ||
| 286 | print("sudipfilt, verbose, missing verbose,\n"); | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| 290 | =head2 sub get_max_index | ||
| 291 | |||
| 292 | max index = number of input variables -1 | ||
| 293 | |||
| 294 | =cut | ||
| 295 | |||
| 296 | sub get_max_index { | ||
| 297 | my ($self) = @_; | ||
| 298 | |||
| 299 | # only file_name : index=36 | ||
| 300 | my $max_index = 36; | ||
| 301 | |||
| 302 | return ($max_index); | ||
| 303 | } | ||
| 304 | |||
| 305 | 1; |