lib/App/SeismicUnixGui/sunix/shapeNcut/suramp.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 80 CC 4 SCAR 13.1
CC
4
Cov
0%
dt
6.0
tmax
6.0
tmin
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::shapeNcut::suramp;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (only Perl)
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 SURAMP - Linearly taper the start and/or end of traces to zero.
25  
26  
27  
28 suramp <stdin >stdout [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 if dt is not set in header, then dt is mandatory
35  
36  
37  
38 Optional parameters
39  
40 tmin=tr.delrt/1000 end of starting ramp (sec)
41  
42 tmax=(nt-1)*dt beginning of ending ramp (sec)
43  
44 dt = (from header) sampling interval (sec)
45  
46  
47  
48 The taper is a linear ramp from 0 to tmin and/or tmax to the
49  
50 end of the trace. Default is a no-op!
51  
52  
53  
54  
55  
56 Credits:
57  
58  
59  
60 CWP: Jack K. Cohen, Ken Larner
61  
62  
63  
64 Trace header fields accessed: ns, dt, delrt
65  
66  
67  
68 =head2 User's notes (Juan Lorenzo)
69 untested
70  
71 =cut
72  
73  
74 =head2 CHANGES and their DATES
75  
76 =cut
77  
78 use Moose;
79 our $VERSION = '0.0.1';
80  
81  
82 =head2 Import packages
83  
84 =cut
85  
86 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
87  
88 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
89 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
90  
91  
92 =head2 instantiation of packages
93  
94 =cut
95  
96 my $get = L_SU_global_constants->new();
97 my $Project = Project_config->new();
98 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
99 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
100 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
101  
102 my $PS_SEISMIC = $Project->PS_SEISMIC();
103  
104 my $var = $get->var();
105 my $on = $var->{_on};
106 my $off = $var->{_off};
107 my $true = $var->{_true};
108 my $false = $var->{_false};
109 my $empty_string = $var->{_empty_string};
110  
111 =head2 Encapsulated
112 hash of private variables
113  
114 =cut
115  
116 my $suramp = {
117 _dt => '',
118 _tmax => '',
119 _tmin => '',
120 _Step => '',
121 _note => '',
122  
123 };
124  
125 =head2 sub Step
126  
127 collects switches and assembles bash instructions
128 by adding the program name
129  
130 =cut
131  
132 sub Step {
133  
134 $suramp->{_Step} = 'suramp'.$suramp->{_Step};
135 return ( $suramp->{_Step} );
136  
137 }
138  
139  
140 =head2 sub note
141  
142 collects switches and assembles bash instructions
143 by adding the program name
144  
145 =cut
146  
147 sub note {
148  
149 $suramp->{_note} = 'suramp'.$suramp->{_note};
150 return ( $suramp->{_note} );
151  
152 }
153  
154  
155  
156 =head2 sub clear
157  
158 =cut
159  
160 sub clear {
161  
162 $suramp->{_dt} = '';
163 $suramp->{_tmax} = '';
164 $suramp->{_tmin} = '';
165 $suramp->{_Step} = '';
166 $suramp->{_note} = '';
167 }
168  
169  
170 =head2 sub dt
171  
172  
173 =cut
174  
175 sub dt {
176  
177 my ( $self,$dt ) = @_;
178 if ( $dt ne $empty_string ) {
179  
180 $suramp->{_dt} = $dt;
181 $suramp->{_note} = $suramp->{_note}.' dt='.$suramp->{_dt};
182 $suramp->{_Step} = $suramp->{_Step}.' dt='.$suramp->{_dt};
183  
184 } else {
185 print("suramp, dt, missing dt,\n");
186 }
187 }
188  
189  
190 =head2 sub tmax
191  
192  
193 =cut
194  
195 sub tmax {
196  
197 my ( $self,$tmax ) = @_;
198 if ( $tmax ne $empty_string ) {
199  
200 $suramp->{_tmax} = $tmax;
201 $suramp->{_note} = $suramp->{_note}.' tmax='.$suramp->{_tmax};
202 $suramp->{_Step} = $suramp->{_Step}.' tmax='.$suramp->{_tmax};
203  
204 } else {
205 print("suramp, tmax, missing tmax,\n");
206 }
207 }
208  
209  
210 =head2 sub tmin
211  
212  
213 =cut
214  
215 sub tmin {
216  
217 my ( $self,$tmin ) = @_;
218 if ( $tmin ne $empty_string ) {
219  
220 $suramp->{_tmin} = $tmin;
221 $suramp->{_note} = $suramp->{_note}.' tmin='.$suramp->{_tmin};
222 $suramp->{_Step} = $suramp->{_Step}.' tmin='.$suramp->{_tmin};
223  
224 } else {
225 print("suramp, tmin, missing tmin,\n");
226 }
227 }
228  
229  
230 =head2 sub get_max_index
231  
232 max index = number of input variables -1
233
234 =cut
235
236 sub get_max_index {
237 my ($self) = @_;
238 my $max_index = 2;
239  
240 return($max_index);
241 }
242
243
244 1;