lib/App/SeismicUnixGui/sunix/model/grm.pm untested

filter: Statementstmt 0.0% 0 / 77 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 113 CC 7 SCAR 14.8
CC
7
Cov
0%
XY
6.0
abtime
6.0
dx
6.0
CRAP 4.4
1 package App::SeismicUnixGui::sunix::model::grm;
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 GRM - Generalized Reciprocal refraction analysis for a single layer
25  
26  
27  
28 grm <stdin >stdout [parameters]
29  
30  
31  
32 Required parameters:
33  
34 nt= Number of arrival time pairs
35  
36 dx= Geophone spacing (m)
37  
38 v0= Velocity in weathering layer (m/s)
39  
40 abtime= If set to 0, use last time as a-b, else give time (ms)
41  
42  
43  
44 Optional parameters:
45  
46 XY= Value of XY if you want to override the optimum XY
47  
48 algorithm in the program. If it is not an integer multiple of
49  
50 dx, then it will be converted to the closest
51  
52 one.
53  
54 XYmax Maximum offset distance allowed when searching for
55  
56 optimum XY (m) (Default is 2*dx*10)
57  
58 depthres Size of increment in x during verical depth search(m)
59  
60 (Default is 0.5m)
61  
62 Input file:
63  
64 4 column ASCII - x,y, forward time, reverse time
65  
66 Output file:
67  
68 1) XYoptimum
69  
70 2) apparent refractor velcocity
71  
72 3) x, y, z(x,y), y-z(x,y)
73  
74 z(x,y) = calculated (GRM) depth below (x y)
75  
76 y-z(x,y) = GRM depth subtracted from y - absolute depth
77  
78 .............
79  
80 4) x, y, d(x,y), y-d(x,y), (error)
81  
82 d(x,y) = dip corrected depth estimate below (x,y)
83  
84 y-d(x,y) = dip corrected absolute depth
85  
86 error = estimated error in depth due only to the inexact
87  
88 matching of tangents to arcs in dip estimate.
89  
90  
91  
92 If the XY calculation is bypassed and XY specified, the values
93  
94 used will precede 1) above. XYoptimum will still be calculated
95  
96 and displayed for reference.
97  
98  
99  
100 Notes:
101  
102 Uses average refactor velocity along interface.
103  
104  
105  
106 Credits:
107  
108  
109  
110 CWP: Steven D. Sheaffer
111  
112
113  
114 D. Palmer, "The Generalized Reciprocal Method of Seismic
115  
116 Refraction Interpretation", SEG, 1982.
117  
118  
119  
120  
121  
122 =head2 User's notes (Juan Lorenzo)
123 untested
124  
125 =cut
126  
127  
128 =head2 CHANGES and their DATES
129  
130 =cut
131  
132 use Moose;
133 our $VERSION = '0.0.1';
134  
135  
136 =head2 Import packages
137  
138 =cut
139  
140 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
141  
142 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
143 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
144  
145  
146 =head2 instantiation of packages
147  
148 =cut
149  
150 my $get = L_SU_global_constants->new();
151 my $Project = Project_config->new();
152 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
153 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
154 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
155  
156 my $PS_SEISMIC = $Project->PS_SEISMIC();
157  
158 my $var = $get->var();
159 my $on = $var->{_on};
160 my $off = $var->{_off};
161 my $true = $var->{_true};
162 my $false = $var->{_false};
163 my $empty_string = $var->{_empty_string};
164  
165 =head2 Encapsulated
166 hash of private variables
167  
168 =cut
169  
170 my $grm = {
171 _XY => '',
172 _abtime => '',
173 _dx => '',
174 _error => '',
175 _nt => '',
176 _v0 => '',
177 _Step => '',
178 _note => '',
179  
180 };
181  
182 =head2 sub Step
183  
184 collects switches and assembles bash instructions
185 by adding the program name
186  
187 =cut
188  
189 sub Step {
190  
191 $grm->{_Step} = 'grm'.$grm->{_Step};
192 return ( $grm->{_Step} );
193  
194 }
195  
196  
197 =head2 sub note
198  
199 collects switches and assembles bash instructions
200 by adding the program name
201  
202 =cut
203  
204 sub note {
205  
206 $grm->{_note} = 'grm'.$grm->{_note};
207 return ( $grm->{_note} );
208  
209 }
210  
211  
212  
213 =head2 sub clear
214  
215 =cut
216  
217 sub clear {
218  
219 $grm->{_XY} = '';
220 $grm->{_abtime} = '';
221 $grm->{_dx} = '';
222 $grm->{_error} = '';
223 $grm->{_nt} = '';
224 $grm->{_v0} = '';
225 $grm->{_Step} = '';
226 $grm->{_note} = '';
227 }
228  
229  
230 =head2 sub XY
231  
232  
233 =cut
234  
235 sub XY {
236  
237 my ( $self,$XY ) = @_;
238 if ( $XY ne $empty_string ) {
239  
240 $grm->{_XY} = $XY;
241 $grm->{_note} = $grm->{_note}.' XY='.$grm->{_XY};
242 $grm->{_Step} = $grm->{_Step}.' XY='.$grm->{_XY};
243  
244 } else {
245 print("grm, XY, missing XY,\n");
246 }
247 }
248  
249  
250 =head2 sub abtime
251  
252  
253 =cut
254  
255 sub abtime {
256  
257 my ( $self,$abtime ) = @_;
258 if ( $abtime ne $empty_string ) {
259  
260 $grm->{_abtime} = $abtime;
261 $grm->{_note} = $grm->{_note}.' abtime='.$grm->{_abtime};
262 $grm->{_Step} = $grm->{_Step}.' abtime='.$grm->{_abtime};
263  
264 } else {
265 print("grm, abtime, missing abtime,\n");
266 }
267 }
268  
269  
270 =head2 sub dx
271  
272  
273 =cut
274  
275 sub dx {
276  
277 my ( $self,$dx ) = @_;
278 if ( $dx ne $empty_string ) {
279  
280 $grm->{_dx} = $dx;
281 $grm->{_note} = $grm->{_note}.' dx='.$grm->{_dx};
282 $grm->{_Step} = $grm->{_Step}.' dx='.$grm->{_dx};
283  
284 } else {
285 print("grm, dx, missing dx,\n");
286 }
287 }
288  
289  
290 =head2 sub error
291  
292  
293 =cut
294  
295 sub error {
296  
297 my ( $self,$error ) = @_;
298 if ( $error ne $empty_string ) {
299  
300 $grm->{_error} = $error;
301 $grm->{_note} = $grm->{_note}.' error='.$grm->{_error};
302 $grm->{_Step} = $grm->{_Step}.' error='.$grm->{_error};
303  
304 } else {
305 print("grm, error, missing error,\n");
306 }
307 }
308  
309  
310 =head2 sub nt
311  
312  
313 =cut
314  
315 sub nt {
316  
317 my ( $self,$nt ) = @_;
318 if ( $nt ne $empty_string ) {
319  
320 $grm->{_nt} = $nt;
321 $grm->{_note} = $grm->{_note}.' nt='.$grm->{_nt};
322 $grm->{_Step} = $grm->{_Step}.' nt='.$grm->{_nt};
323  
324 } else {
325 print("grm, nt, missing nt,\n");
326 }
327 }
328  
329  
330 =head2 sub v0
331  
332  
333 =cut
334  
335 sub v0 {
336  
337 my ( $self,$v0 ) = @_;
338 if ( $v0 ne $empty_string ) {
339  
340 $grm->{_v0} = $v0;
341 $grm->{_note} = $grm->{_note}.' v0='.$grm->{_v0};
342 $grm->{_Step} = $grm->{_Step}.' v0='.$grm->{_v0};
343  
344 } else {
345 print("grm, v0, missing v0,\n");
346 }
347 }
348  
349  
350 =head2 sub get_max_index
351  
352 max index = number of input variables -1
353
354 =cut
355
356 sub get_max_index {
357 my ($self) = @_;
358 my $max_index = 5;
359  
360 return($max_index);
361 }
362
363
364 1;