lib/App/SeismicUnixGui/sunix/data/wpccompress.pm untested

filter: Statementstmt 0.0% 0 / 55 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 / 79 CC 4 SCAR 13.1
CC
4
Cov
0%
error
6.0
n1
6.0
n2
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::data::wpccompress;
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 WPCCOMPRESS --- COMPRESS a 2D section using Wavelet Packets
25  
26  
27  
28 wpccompress < stdin n1= n2= [optional parameters ] > stdout
29  
30  
31  
32 Required Parameters:
33  
34 n1= number of samples in the 1st dimension
35  
36 n2= number of samples in the 2nd dimenstion
37  
38  
39  
40 Optional Parameters:
41  
42 error=0.01 relative RMS allowed in compress ",
43  
44  
45  
46 Notes:
47  
48 This program is used to compress a 2D section. It compresses in both
49  
50 directions, vertically and horizontally.
51  
52  
53  
54 The parameter error is used control the allowable compression error,
55  
56 and thus the compression ratio. The larger the error, the more
57  
58 the more compression you can get. The amount of error depends on
59  
60 the type of data and the application of the compression. From my
61  
62 experience, error=0.01 is a safe choice even when the compressed data
63  
64 are used for further processing. For some other applications, it
65  
66 may be set higher to achieve larger compression.
67  
68  
69  
70 Caveats:
71  
72 For the current implementation, the compressed data themselves are
73  
74 NOT portable, i.e., the data compressed on one platform might not be
75  
76 recognizable on another.
77  
78  
79  
80 =head2 User's notes (Juan Lorenzo)
81 untested
82  
83 =cut
84  
85  
86 =head2 CHANGES and their DATES
87  
88 =cut
89  
90 use Moose;
91 our $VERSION = '0.0.1';
92  
93  
94 =head2 Import packages
95  
96 =cut
97  
98 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
99  
100 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
101 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
102  
103  
104 =head2 instantiation of packages
105  
106 =cut
107  
108 my $get = L_SU_global_constants->new();
109 my $Project = Project_config->new();
110 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
111 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
112 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
113  
114 my $var = $get->var();
115 my $on = $var->{_on};
116 my $off = $var->{_off};
117 my $true = $var->{_true};
118 my $false = $var->{_false};
119 my $empty_string = $var->{_empty_string};
120  
121 =head2 Encapsulated
122 hash of private variables
123  
124 =cut
125  
126 my $wpccompress = {
127 _error => '',
128 _n1 => '',
129 _n2 => '',
130 _Step => '',
131 _note => '',
132  
133 };
134  
135 =head2 sub Step
136  
137 collects switches and assembles bash instructions
138 by adding the program name
139  
140 =cut
141  
142 sub Step {
143  
144 $wpccompress->{_Step} = 'wpccompress'.$wpccompress->{_Step};
145 return ( $wpccompress->{_Step} );
146  
147 }
148  
149  
150 =head2 sub note
151  
152 collects switches and assembles bash instructions
153 by adding the program name
154  
155 =cut
156  
157 sub note {
158  
159 $wpccompress->{_note} = 'wpccompress'.$wpccompress->{_note};
160 return ( $wpccompress->{_note} );
161  
162 }
163  
164  
165  
166 =head2 sub clear
167  
168 =cut
169  
170 sub clear {
171  
172 $wpccompress->{_error} = '';
173 $wpccompress->{_n1} = '';
174 $wpccompress->{_n2} = '';
175 $wpccompress->{_Step} = '';
176 $wpccompress->{_note} = '';
177 }
178  
179  
180 =head2 sub error
181  
182  
183 =cut
184  
185 sub error {
186  
187 my ( $self,$error ) = @_;
188 if ( $error ne $empty_string ) {
189  
190 $wpccompress->{_error} = $error;
191 $wpccompress->{_note} = $wpccompress->{_note}.' error='.$wpccompress->{_error};
192 $wpccompress->{_Step} = $wpccompress->{_Step}.' error='.$wpccompress->{_error};
193  
194 } else {
195 print("wpccompress, error, missing error,\n");
196 }
197 }
198  
199  
200 =head2 sub n1
201  
202  
203 =cut
204  
205 sub n1 {
206  
207 my ( $self,$n1 ) = @_;
208 if ( $n1 ne $empty_string ) {
209  
210 $wpccompress->{_n1} = $n1;
211 $wpccompress->{_note} = $wpccompress->{_note}.' n1='.$wpccompress->{_n1};
212 $wpccompress->{_Step} = $wpccompress->{_Step}.' n1='.$wpccompress->{_n1};
213  
214 } else {
215 print("wpccompress, n1, missing n1,\n");
216 }
217 }
218  
219  
220 =head2 sub n2
221  
222  
223 =cut
224  
225 sub n2 {
226  
227 my ( $self,$n2 ) = @_;
228 if ( $n2 ne $empty_string ) {
229  
230 $wpccompress->{_n2} = $n2;
231 $wpccompress->{_note} = $wpccompress->{_note}.' n2='.$wpccompress->{_n2};
232 $wpccompress->{_Step} = $wpccompress->{_Step}.' n2='.$wpccompress->{_n2};
233  
234 } else {
235 print("wpccompress, n2, missing n2,\n");
236 }
237 }
238  
239  
240 =head2 sub get_max_index
241  
242 max index = number of input variables -1
243
244 =cut
245
246 sub get_max_index {
247 my ($self) = @_;
248 my $max_index = 2;
249  
250 return($max_index);
251 }
252
253
254 1;