lib/App/SeismicUnixGui/sunix/NMO_Vel_Stk/suresamp.pm untested

filter: Statementstmt 0.0% 0 / 84 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 124 CC 8 SCAR 15.1
CC
8
Cov
0%
d1
6.0
dt
6.0
f
6.0
CRAP 4.5
1 package App::SeismicUnixGui::sunix::NMO_Vel_Stk::suresamp;
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 SURESAMP - Resample in time
25  
26  
27  
28 suresamp <stdin >stdout [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional Parameters:
39  
40 nt=tr.ns number of time samples on output
41  
42 dt= time sampling interval on output
43  
44 default is:
45  
46 tr.dt/10^6 seismic data
47  
48 tr.d1 non-seismic data
49  
50 tmin= time of first sample in output
51  
52 default is:
53  
54 tr.delrt/10^3 seismic data
55  
56 tr.f1 non-seismic data
57  
58 rf= resampling factor;
59  
60 if defined, set nt=nt_in*rf and dt=dt_in/rf
61  
62 verbose=0 =1 for advisory messages
63  
64  
65  
66  
67  
68 Example 1: (assume original data had dt=.004 nt=256)
69  
70 sufilter <data f=40,50 amps=1.,0. |
71  
72 suresamp nt=128 dt=.008 | ...
73  
74 Using the resampling factor rf, this example translates to:
75  
76 sufilter <data f=40,50 amps=1.,0. | suresamp rf=0.5 | ...
77  
78  
79  
80 Note the typical anti-alias filtering before sub-sampling!
81  
82  
83  
84 Example 2: (assume original data had dt=.004 nt=256)
85  
86 suresamp <data nt=512 dt=.002 | ...
87  
88 or use:
89  
90 suresamp <data rf=2 | ...
91  
92  
93  
94 Example 3: (assume original data had d1=.1524 nt=8192)
95  
96 sufilter <data f=0,1,3,3.28 amps=1,1,1,0 |
97  
98 suresamp <data nt=4096 dt=.3048 | ...
99  
100  
101  
102 Example 4: (assume original data had d1=.5 nt=4096)
103  
104 suresamp <data nt=8192 dt=.25 | ...
105  
106  
107  
108  
109  
110 Credits:
111  
112 CWP: Dave (resamp algorithm), Jack (SU adaptation)
113  
114 CENPET: Werner M. Heigl - modified for well log support
115  
116 RISSC: Nils Maercklin 2006 - minor fixes, added rf option
117  
118  
119  
120 Algorithm:
121  
122 Resampling is done via 8-coefficient sinc-interpolation.
123  
124 See "$CWPROOT/src/cwp/lib/intsinc8.c" for technical details.
125  
126  
127  
128 Trace header fields accessed: ns, dt, delrt, d1, f1, trid
129  
130 Trace header fields modified: ns, dt, delrt (only when set tmin)
131  
132 d1, f1 (only when set tmin)
133  
134  
135  
136 =head2 User's notes (Juan Lorenzo)
137 untested
138  
139 =cut
140  
141  
142 =head2 CHANGES and their DATES
143  
144 =cut
145  
146 use Moose;
147 our $VERSION = '0.0.1';
148  
149  
150 =head2 Import packages
151  
152 =cut
153  
154 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
155  
156 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
157 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
158  
159  
160 =head2 instantiation of packages
161  
162 =cut
163  
164 my $get = L_SU_global_constants->new();
165 my $Project = Project_config->new();
166 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
167 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
168 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
169  
170 my $PS_SEISMIC = $Project->PS_SEISMIC();
171  
172 my $var = $get->var();
173 my $on = $var->{_on};
174 my $off = $var->{_off};
175 my $true = $var->{_true};
176 my $false = $var->{_false};
177 my $empty_string = $var->{_empty_string};
178  
179 =head2 Encapsulated
180 hash of private variables
181  
182 =cut
183  
184 my $suresamp = {
185 _d1 => '',
186 _dt => '',
187 _f => '',
188 _nt => '',
189 _rf => '',
190 _tmin => '',
191 _verbose => '',
192 _Step => '',
193 _note => '',
194  
195 };
196  
197 =head2 sub Step
198  
199 collects switches and assembles bash instructions
200 by adding the program name
201  
202 =cut
203  
204 sub Step {
205  
206 $suresamp->{_Step} = 'suresamp'.$suresamp->{_Step};
207 return ( $suresamp->{_Step} );
208  
209 }
210  
211  
212 =head2 sub note
213  
214 collects switches and assembles bash instructions
215 by adding the program name
216  
217 =cut
218  
219 sub note {
220  
221 $suresamp->{_note} = 'suresamp'.$suresamp->{_note};
222 return ( $suresamp->{_note} );
223  
224 }
225  
226  
227  
228 =head2 sub clear
229  
230 =cut
231  
232 sub clear {
233  
234 $suresamp->{_d1} = '';
235 $suresamp->{_dt} = '';
236 $suresamp->{_f} = '';
237 $suresamp->{_nt} = '';
238 $suresamp->{_rf} = '';
239 $suresamp->{_tmin} = '';
240 $suresamp->{_verbose} = '';
241 $suresamp->{_Step} = '';
242 $suresamp->{_note} = '';
243 }
244  
245  
246 =head2 sub d1
247  
248  
249 =cut
250  
251 sub d1 {
252  
253 my ( $self,$d1 ) = @_;
254 if ( $d1 ne $empty_string ) {
255  
256 $suresamp->{_d1} = $d1;
257 $suresamp->{_note} = $suresamp->{_note}.' d1='.$suresamp->{_d1};
258 $suresamp->{_Step} = $suresamp->{_Step}.' d1='.$suresamp->{_d1};
259  
260 } else {
261 print("suresamp, d1, missing d1,\n");
262 }
263 }
264  
265  
266 =head2 sub dt
267  
268  
269 =cut
270  
271 sub dt {
272  
273 my ( $self,$dt ) = @_;
274 if ( $dt ne $empty_string ) {
275  
276 $suresamp->{_dt} = $dt;
277 $suresamp->{_note} = $suresamp->{_note}.' dt='.$suresamp->{_dt};
278 $suresamp->{_Step} = $suresamp->{_Step}.' dt='.$suresamp->{_dt};
279  
280 } else {
281 print("suresamp, dt, missing dt,\n");
282 }
283 }
284  
285  
286 =head2 sub f
287  
288  
289 =cut
290  
291 sub f {
292  
293 my ( $self,$f ) = @_;
294 if ( $f ne $empty_string ) {
295  
296 $suresamp->{_f} = $f;
297 $suresamp->{_note} = $suresamp->{_note}.' f='.$suresamp->{_f};
298 $suresamp->{_Step} = $suresamp->{_Step}.' f='.$suresamp->{_f};
299  
300 } else {
301 print("suresamp, f, missing f,\n");
302 }
303 }
304  
305  
306 =head2 sub nt
307  
308  
309 =cut
310  
311 sub nt {
312  
313 my ( $self,$nt ) = @_;
314 if ( $nt ne $empty_string ) {
315  
316 $suresamp->{_nt} = $nt;
317 $suresamp->{_note} = $suresamp->{_note}.' nt='.$suresamp->{_nt};
318 $suresamp->{_Step} = $suresamp->{_Step}.' nt='.$suresamp->{_nt};
319  
320 } else {
321 print("suresamp, nt, missing nt,\n");
322 }
323 }
324  
325  
326 =head2 sub rf
327  
328  
329 =cut
330  
331 sub rf {
332  
333 my ( $self,$rf ) = @_;
334 if ( $rf ne $empty_string ) {
335  
336 $suresamp->{_rf} = $rf;
337 $suresamp->{_note} = $suresamp->{_note}.' rf='.$suresamp->{_rf};
338 $suresamp->{_Step} = $suresamp->{_Step}.' rf='.$suresamp->{_rf};
339  
340 } else {
341 print("suresamp, rf, missing rf,\n");
342 }
343 }
344  
345  
346 =head2 sub tmin
347  
348  
349 =cut
350  
351 sub tmin {
352  
353 my ( $self,$tmin ) = @_;
354 if ( $tmin ne $empty_string ) {
355  
356 $suresamp->{_tmin} = $tmin;
357 $suresamp->{_note} = $suresamp->{_note}.' tmin='.$suresamp->{_tmin};
358 $suresamp->{_Step} = $suresamp->{_Step}.' tmin='.$suresamp->{_tmin};
359  
360 } else {
361 print("suresamp, tmin, missing tmin,\n");
362 }
363 }
364  
365  
366 =head2 sub verbose
367  
368  
369 =cut
370  
371 sub verbose {
372  
373 my ( $self,$verbose ) = @_;
374 if ( $verbose ne $empty_string ) {
375  
376 $suresamp->{_verbose} = $verbose;
377 $suresamp->{_note} = $suresamp->{_note}.' verbose='.$suresamp->{_verbose};
378 $suresamp->{_Step} = $suresamp->{_Step}.' verbose='.$suresamp->{_verbose};
379  
380 } else {
381 print("suresamp, verbose, missing verbose,\n");
382 }
383 }
384  
385  
386 =head2 sub get_max_index
387  
388 max index = number of input variables -1
389
390 =cut
391
392 sub get_max_index {
393 my ($self) = @_;
394 my $max_index = 6;
395  
396 return($max_index);
397 }
398
399
400 1;