lib/App/SeismicUnixGui/sunix/header/segyhdrmod.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 82 CC 4 SCAR 13.1
CC
4
Cov
0%
data
6.0
if
6.0
text
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::header::segyhdrmod;
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 SEGYHDRMOD - replace the text header on a SEGY file
25  
26  
27  
28 segyhdrmod text=file data=file
29  
30  
31  
32 Required parameters:
33  
34  
35  
36 text= name of file containing new 3200 byte text header
37  
38 data= name of file containing SEGY data set
39  
40  
41  
42 Notes:
43  
44 This program simply does a replacement of the content of the first
45  
46 3200 bytes of the SEGY file with the contents of the file specified
47  
48 by the text= parameter. If the text header in the SEGY standard
49  
50 ebcdic format, the user will need to supply an ebcdic format file
51  
52 as the text= as input file. A text file may be converted from
53  
54 ascii to ebcdic via:
55  
56 dd if=ascii_filename of=ebcdic_filename conv=ebcdic ibs=3200 count=1
57  
58 or from ebcdic to ascii via:
59  
60 dd if=ebcdic_filename of=ascii_filename ibs=3200 conv=ascii count=1
61  
62  
63  
64  
65  
66  
67  
68 ====================================================================*\
69  
70  
71  
72 sgyhdrmod - replace the text header on a SEGY data file in place
73  
74  
75  
76 This program only reads and writes 3200 bytes
77  
78  
79  
80 Reginald H. Beardsley rhb@acm.org
81  
82  
83  
84 \*====================================================================*/
85  
86 =head2 User's notes (Juan Lorenzo)
87 untested
88  
89 =cut
90  
91  
92 =head2 CHANGES and their DATES
93  
94 =cut
95  
96 use Moose;
97 our $VERSION = '0.0.1';
98  
99  
100 =head2 Import packages
101  
102 =cut
103  
104 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
105  
106 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
107 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
108  
109  
110 =head2 instantiation of packages
111  
112 =cut
113  
114 my $get = L_SU_global_constants->new();
115 my $Project = Project_config->new();
116 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
117 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
118 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
119  
120 my $PS_SEISMIC = $Project->PS_SEISMIC();
121  
122 my $var = $get->var();
123 my $on = $var->{_on};
124 my $off = $var->{_off};
125 my $true = $var->{_true};
126 my $false = $var->{_false};
127 my $empty_string = $var->{_empty_string};
128  
129 =head2 Encapsulated
130 hash of private variables
131  
132 =cut
133  
134 my $segyhdrmod = {
135 _data => '',
136 _if => '',
137 _text => '',
138 _Step => '',
139 _note => '',
140  
141 };
142  
143 =head2 sub Step
144  
145 collects switches and assembles bash instructions
146 by adding the program name
147  
148 =cut
149  
150 sub Step {
151  
152 $segyhdrmod->{_Step} = 'segyhdrmod'.$segyhdrmod->{_Step};
153 return ( $segyhdrmod->{_Step} );
154  
155 }
156  
157  
158 =head2 sub note
159  
160 collects switches and assembles bash instructions
161 by adding the program name
162  
163 =cut
164  
165 sub note {
166  
167 $segyhdrmod->{_note} = 'segyhdrmod'.$segyhdrmod->{_note};
168 return ( $segyhdrmod->{_note} );
169  
170 }
171  
172  
173  
174 =head2 sub clear
175  
176 =cut
177  
178 sub clear {
179  
180 $segyhdrmod->{_data} = '';
181 $segyhdrmod->{_if} = '';
182 $segyhdrmod->{_text} = '';
183 $segyhdrmod->{_Step} = '';
184 $segyhdrmod->{_note} = '';
185 }
186  
187  
188 =head2 sub data
189  
190  
191 =cut
192  
193 sub data {
194  
195 my ( $self,$data ) = @_;
196 if ( $data ne $empty_string ) {
197  
198 $segyhdrmod->{_data} = $data;
199 $segyhdrmod->{_note} = $segyhdrmod->{_note}.' data='.$segyhdrmod->{_data};
200 $segyhdrmod->{_Step} = $segyhdrmod->{_Step}.' data='.$segyhdrmod->{_data};
201  
202 } else {
203 print("segyhdrmod, data, missing data,\n");
204 }
205 }
206  
207  
208 =head2 sub if
209  
210  
211 =cut
212  
213 sub if {
214  
215 my ( $self,$if ) = @_;
216 if ( $if ne $empty_string ) {
217  
218 $segyhdrmod->{_if} = $if;
219 $segyhdrmod->{_note} = $segyhdrmod->{_note}.' if='.$segyhdrmod->{_if};
220 $segyhdrmod->{_Step} = $segyhdrmod->{_Step}.' if='.$segyhdrmod->{_if};
221  
222 } else {
223 print("segyhdrmod, if, missing if,\n");
224 }
225 }
226  
227  
228 =head2 sub text
229  
230  
231 =cut
232  
233 sub text {
234  
235 my ( $self,$text ) = @_;
236 if ( $text ne $empty_string ) {
237  
238 $segyhdrmod->{_text} = $text;
239 $segyhdrmod->{_note} = $segyhdrmod->{_note}.' text='.$segyhdrmod->{_text};
240 $segyhdrmod->{_Step} = $segyhdrmod->{_Step}.' text='.$segyhdrmod->{_text};
241  
242 } else {
243 print("segyhdrmod, text, missing text,\n");
244 }
245 }
246  
247  
248 =head2 sub get_max_index
249  
250 max index = number of input variables -1
251
252 =cut
253
254 sub get_max_index {
255 my ($self) = @_;
256 my $max_index = 1;
257  
258 return($max_index);
259 }
260
261
262 1;