UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
segd_file.h
1 /* segd_file.h */
2 /* $Id: segd_file.h,v 1.2 2004/02/03 13:33:24 vlad Exp $ */
3 #ifndef __segd_file_h
4 #define __segd_file_h
5 
6 /***********************************************************************
7  *
8  * SEG-D digital tape standard (Revisions 0, 1, 2)
9  *
10  * (C) 2003,2004, Geovers, Ltd.
11  *
12  ***********************************************************************/
13 
15 #define SEGD_HdrSize 32
16 #define SEGD_GH1_Size SEGD_HdrSize /* general header #1 size (Rev.0) */
17 #define SEGD_GH2_Size SEGD_HdrSize /* general header #2 size (Rev.1,2) */
18 #define SEGD_GHN_Size SEGD_HdrSize /* general header #N size (Rev.1,2) */
19 #define SEGD_CS_Size SEGD_HdrSize /* channel set header size */
20 #define SEGD_SS_Size SEGD_HdrSize /* sample skew block size */
21 #define SEGD_XH_Size SEGD_HdrSize /* extended and external header size */
22 #define SEGD_SOS_Size 4 /* start of scan */
23 #define SEGD_TW_Size 4 /* timing word */
24 #define SEGD_DTH_Size 20 /* trace header size */
25 #define SEGD_ETH_Size SEGD_HdrSize /* extended trace header block size */
26 
27 /* Start of scan flags */
28 #define SEGD_SOS_TWI (1<<0)
29 #define SEGD_SOS_ITB (1<<1)
30 #define SEGD_SOS_DP (1<<2)
33 /* Build number from several decimal nibbles */
34 
36 #define DEC2n(x1,x2) ((x1)*10+(x2))
37 
39 #define DEC3n(x1,x2,x3) (DEC2n(x1,x2)*10+(x3))
40 
42 #define DEC4n(x1,x2,x3,x4) (DEC3n(x1,x2,x3)*10+(x4))
43 
44 
47 #define BCDn(x,d) (((x)&(0x0f<<(4*(d))))>>(4*(d)))
48 
51 #define BCDb(x) (DEC2n(BCDn(x,1),BCDn(x,0)))
52 
55 #define BCD3b(x1,x2,x3) (BCDb(x1)*10000+BCDb(x2)*100+BCDb(x3))
56 
57 
58 /***********************************************************************
59  * General header #1
60  ***********************************************************************/
61 
62 /* Field name Offset */
63 #define SEGD_GH1_FILE_NUMBER 0
64 #define SEGD_GH1_FORMAT_CODE 2
65 #define SEGD_GH1_GENERAL_CONSTANTS 4
66 #define SEGD_GH1_YEAR 10
67 #define SEGD_GH1_GHNUM_DAY 11
68 #define SEGD_GH1_DAY 12
69 #define SEGD_GH1_HOUR 13
70 #define SEGD_GH1_MINUTE 14
71 #define SEGD_GH1_SECOND 15
72 #define SEGD_GH1_MANUFACTURER_CODE 16
73 #define SEGD_GH1_MANUFACTURER_FORMAT 17
74 #define SEGD_GH1_BYTES_PER_SCAN 18
75 #define SEGD_GH1_BASE_SCAN_INTERVAL 22
76 #define SEGD_GH1_POLARITY_SB_EXP 23
77 #define SEGD_GH1_SCAN_BLOCK 24
78 #define SEGD_GH1_REC_TYPE_REC_LEN 25
79 #define SEGD_GH1_RECORD_LENGTH 26
80 #define SEGD_GH1_SCAN_TYPES 27
81 #define SEGD_GH1_CHANNEL_SETS 28
82 #define SEGD_GH1_SKEW_BLOCKS 29
83 #define SEGD_GH1_EXTENDED_HDR_BLOCKS 30
84 #define SEGD_GH1_EXTERNAL_HDR_BLOCKS 31
85 
86 
87 /***********************************************************************
88  * General header #2
89  ***********************************************************************/
90 
91 /* Field name Offset */
92 #define SEGD_GH2_FILE_NUMBER 0
93 #define SEGD_GH2_CHANNEL_SETS 3
94 #define SEGD_GH2_EXTENDED_HDR_BLOCKS 5
95 #define SEGD_GH2_EXTERNAL_HDR_BLOCKS 7
96 #define SEGD_GH2_REVISION_MAJOR 10
97 #define SEGD_GH2_REVISION_MINOR 11
98 #define SEGD_GH2_GENERAL_TRAILER_BLOCKS 12
99 #define SEGD_GH2_RECORD_LENGTH 14
100 #define SEGD_GH2_GH_BLOCK_NUMBER 18
101 
102 
103 /***********************************************************************
104  * General header #N
105  ***********************************************************************/
106 
107 /* Field name Offset */
108 #define SEGD_GHN_SRC_LINE_NUM_CARD 3
109 #define SEGD_GHN_SRC_LINE_NUM_FRAC 6
110 #define SEGD_GHN_SRC_POINT_NUM_CARD 8
111 #define SEGD_GHN_SRC_POINT_NUM_FRAC 11
112 #define SEGD_GHN_SRC_POINT_INDEX 13
113 #define SEGD_GHN_PHASE_CONTROL 14
114 #define SEGD_GHN_VIBRATOR_TYPE 15
115 #define SEGD_GHN_PHASE_ANGLE 16
116 #define SEGD_GHN_GH_BLOCK_NUMBER 18
117 #define SEGD_GHN_SRC_SET_NUMBER 19
118 
119 
120 /***********************************************************************
121  * Channel set description header
122  ***********************************************************************/
123 
124 /* Field name Offset */
125 #define SEGD_CS_SCAN_TYPE_NUMBER 0
126 #define SEGD_CS_CHANNEL_SET_NUMBER 1
127 #define SEGD_CS_CHANNEL_SET_START_TIME 2
128 #define SEGD_CS_CHANNEL_SET_END_TIME 4
129 #define SEGD_CS_DESCALE_MULTIPLIER 6
130 #define SEGD_CS_NUMBER_OF_CHANNELS 8
131 #define SEGD_CS_CHANNEL_TYPE 10
132 #define SEGD_CS_SAMPLES_PER_CHAN_GAIN 11
133 #define SEGD_CS_ALIAS_FILTER_FREQ 12
134 #define SEGD_CS_ALIAS_FILTER_SLOPE 14
135 #define SEGD_CS_LOW_CUT_FILTER 16
136 #define SEGD_CS_LOW_CUT_FILTER_SLOPE 18
137 #define SEGD_CS_1ST_NOTCH_FILTER 20
138 #define SEGD_CS_2ND_NOTCH_FILTER 22
139 #define SEGD_CS_3RD_NOTCH_FILTER 24
140 #define SEGD_CS_EXTENDED_CS_NUMBER 26
141 #define SEGD_CS_EXTENDED_HDR_FLAG 28
142 #define SEGD_CS_VERTICAL_STACK 29
143 #define SEGD_CS_STREAMER_CABLE_NUMBER 30
144 #define SEGD_CS_ARRAY_FORMING 31
145 
146 
147 /***********************************************************************
148  * Demux trace header
149  ***********************************************************************/
150 
151 /* Field name Offset */
152 #define SEGD_DTH_FILE_NUMBER 0
153 #define SEGD_DTH_SCAN_TYPE_NUMBER 2
154 #define SEGD_DTH_CHANNEL_SET_NUMBER 3
155 #define SEGD_DTH_TRACE_NUMBER 4
156 #define SEGD_DTH_FIRST_TIMING_WORD 6
157 #define SEGD_DTH_TRACE_HDR_EXTENSIONS 9
158 #define SEGD_DTH_SAMPLE_SKEW 10
159 #define SEGD_DTH_TRACE_EDIT 11
160 #define SEGD_DTH_TIME_BREAK_WINDOW 12
161 #define SEGD_DTH_EXT_CHANNEL_SET_NUMBER 15
162 #define SEGD_DTH_EXT_FILE_NUMBER 17
163 
164 /***********************************************************************
165  * Demux trace header extension
166  ***********************************************************************/
167 
168 /* Field name Offset */
169 #define SEGD_ETH_RECEIVER_LINE_NUMBER 0
170 #define SEGD_ETH_RECEIVER_POINT_NUMBER 3
171 #define SEGD_ETH_RECEIVER_POINT_INDEX 6
172 #define SEGD_ETH_NUMBER_OF_SAMPLES 7
173 
174 
175 /*
176  * Следующая условно-обрабатываемая часть действительна только если
177  * данный файл подключен НЕ из программы трансформации (смотри ft).
178  */
179 #ifndef _filetrans_
180 
181 #include <mix/Types.h>
182 
184 typedef enum
185 {
186  /* Multiplexed formats */
187  SEGD_FC_0015 = 0x0015, /* 20 bits, binary multiplexed */
188  SEGD_FC_0022 = 0x0022, /* 8 bits, quaternary */
189  SEGD_FC_0042 = 0x0042, /* 8 bits, hexadecimal */
190  SEGD_FC_0024 = 0x0024, /* 16 bits, quaternary */
191  SEGD_FC_0044 = 0x0044, /* 16 bits, hexadecimal */
192  SEGD_FC_0036 = 0x0036, /* 24 bits, 2's compliment integer */
193  SEGD_FC_0038 = 0x0038, /* 32 bits, 2's compliment integer */
194  SEGD_FC_0048 = 0x0048, /* 32 bits, hexadecimal */
195  SEGD_FC_0058 = 0x0058, /* 32 bits, IEEE */
196  /* Demultiplexed formats */
197  SEGD_FC_8015 = 0x8015, /* 20 bits, binary demultiplexed */
198  SEGD_FC_8022 = 0x8022, /* 8 bits, quaternary */
199  SEGD_FC_8042 = 0x8042, /* 8 bits, hexadecimal */
200  SEGD_FC_8024 = 0x8024, /* 16 bits, quaternary */
201  SEGD_FC_8044 = 0x8044, /* 16 bits, hexadecimal */
202  SEGD_FC_8036 = 0x8036, /* 24 bits, 2's compliment integer */
203  SEGD_FC_8038 = 0x8038, /* 32 bits, 2's compliment integer */
204  SEGD_FC_8048 = 0x8048, /* 32 bits, hexadecimal */
205  SEGD_FC_8058 = 0x8058 /* 32 bits, IEEE */
206 
207 } SEGD_FormatCode;
208 
210 typedef enum
211 {
212  SEGD_RT_TestRecord = 2,
213  SEGD_RT_ParallelChannelTest = 4,
214  SEGD_RT_DirectChannelTest = 6,
215  SEGD_RT_NormalRecord = 9,
216  SEGD_RT_Other = 1
217 
218 } SEGD_RecordType;
219 
221 typedef enum
222 {
223  SEGD_VT_NotRecorded = 0,
224  SEGD_VT_PWaveVibrator = 1,
225  SEGD_VT_SWaveVibrator = 2,
226  SEGD_VT_MarineVibrator = 3,
227 
228 } SEGD_VibratorType;
229 
231 typedef enum
232 {
233  SEGD_CT_Other = 7,
234  SEGD_CT_ExternalData = 6,
235  SEGD_CT_TimeCounter = 5,
236  SEGD_CT_WaterBreak = 4,
237  SEGD_CT_UpHole = 3,
238  SEGD_CT_TimeBreak = 2,
239  SEGD_CT_Seis = 1,
240  SEGD_CT_Unused = 0,
241  SEGD_CT_SignatureUnfiltered = 8,
242  SEGD_CT_SignatureFiltered = 9,
243  SEGD_CT_AuxiliaryDataTrailer = 12
244 
245 } SEGD_ChannelType;
246 
248 typedef enum
249 {
250  SEGD_GC_Undefined = 0,
251  SEGD_GC_IndividualAGC = 1,
252  SEGD_GC_GangedAGC = 2,
253  SEGD_GC_FixedGain = 3,
254  SEGD_GC_ProgrammedGain = 4,
255  SEGD_GC_BinaryGainControl = 8,
256  SEGD_GC_IFPGainControl = 9
257 
258 } SEGD_GainControl;
259 
261 typedef enum
262 {
263  SEGD_TE_NoEditApplied = 0,
264  SEGD_TE_DeadZeroChannels = 1,
267  SEGD_TE_ZeroedChannels = 2
269 } SEGD_TraceEdit;
270 
271 
272 /***********************************************************************
273  * SEG-D structures description
274  ***********************************************************************/
275 
277 typedef struct
278 {
279  int file_number;
280  SEGD_FormatCode format_code;
281  int general_constants[12];
282  int gh_number;
283  int year;
284  int day;
285  int hour;
286  int minute;
287  int second;
288  int manufacturer_code;
289  int manufacturer_format;
290  int bytes_per_scan;
292  int polarity;
296  SEGD_RecordType record_type;
307 
309 typedef struct
310 {
315  int revision_major;
316  int revision_minor;
322 
324 typedef struct
325 {
332  SEGD_VibratorType vibrator_type;
338 
340 typedef struct
341 {
343  int channel_set_number;
346  float descale_multiplier;
347  int number_of_channels;
348  SEGD_ChannelType channel_type;
351  SEGD_GainControl gain_control;
352  int alias_filter_freq;
353  int alias_filter_slope;
354  int low_cut_filter;
355  int low_cut_filter_slope;
356  int notch_filter_1st;
357  int notch_filter_2nd;
358  int notch_filter_3rd;
359  int extended_hdr_flag;
360  int vertical_stack;
361  int streamer_cable_number;
362  int array_forming;
363 
365 
366 
368 typedef struct
369 {
370  int cs_n;
372  int ss_n;
373  unsigned char *ss;
374  int samples;
376 } SEGD_ScanType;
377 
378 
380 typedef struct
381 {
382  int file_number;
383  int scan_type_number;
384  int channel_set_number;
385  int trace_number;
386  float time;
387  float time_break;
390  float skew;
391  SEGD_TraceEdit trace_edit;
394 
395 
397 typedef struct
398 {
399  int receiver_line_number;
400  int receiver_point_number;
401  int receiver_point_index;
402  int number_of_samples;
403 
405 
406 
407 /* Just for KeyLabelItem definition */
408 #include <mix/misc.h>
409 
410 #ifndef __segd_file_vars
411 
412 extern KeyLabelItem SEGD_FormatCode_Labels[];
413 extern unsigned SEGD_FormatCode_Labels_n;
414 extern KeyLabelItem SEGD_RecordType_Labels[];
415 extern unsigned SEGD_RecordType_Labels_n;
416 extern KeyLabelItem SEGD_VibratorType_Labels[];
417 extern unsigned SEGD_VibratorType_Labels_n;
418 extern KeyLabelItem SEGD_ChannelType_Labels[];
419 extern unsigned SEGD_ChannelType_Labels_n;
420 extern KeyLabelItem SEGD_GainControl_Labels[];
421 extern unsigned SEGD_GainControl_Labels_n;
422 extern KeyLabelItem SEGD_ManCodes[];
423 extern unsigned SEGD_ManCodes_n;
424 extern KeyLabelItem SEGD_TraceEdit_Labels[];
425 extern unsigned SEGD_TraceEdit_Labels_n;
426 
427 #endif /* __segd_file_vars */
428 
429 #endif
430 
431 
432 #endif /* segd_file.h */
int src_point_num_frac
Definition: segd_file.h:329
int phase_angle
Definition: segd_file.h:333
Definition: segd_file.h:380
int subscan_number
Definition: segd_file.h:349
int file_number
Definition: segd_file.h:311
int samples
Definition: segd_file.h:374
int src_line_num_frac
Definition: segd_file.h:327
float skew
Definition: segd_file.h:390
unsigned char * ss
Definition: segd_file.h:373
float record_length
Definition: segd_file.h:297
int polarity
Definition: segd_file.h:292
SEGD_TraceEdit trace_edit
Definition: segd_file.h:391
int channel_set_start_time
Definition: segd_file.h:344
int gh_number
Definition: segd_file.h:282
int src_line_num_card
Definition: segd_file.h:326
int src_point_index
Definition: segd_file.h:330
int gh_block_number
Definition: segd_file.h:319
Definition: segd_file.h:309
int channel_sets
Definition: segd_file.h:301
int scan_per_block
Definition: segd_file.h:293
int extended_hdr_blocks
Definition: segd_file.h:303
int ss_n
Definition: segd_file.h:372
Definition: segd_file.h:340
SEGD_ChannelSet * cs
Definition: segd_file.h:371
int scan_type_number
Definition: segd_file.h:342
int record_length
Definition: segd_file.h:318
Definition: misc.h:423
int phase_control
Definition: segd_file.h:331
SEGD_FormatCode format_code
Definition: segd_file.h:280
int year
Definition: segd_file.h:283
int skew_blocks
Definition: segd_file.h:302
Definition: segd_file.h:397
int channel_sets
Definition: segd_file.h:312
Definition: segd_file.h:277
Definition: segd_file.h:324
int channel_set_end_time
Definition: segd_file.h:345
SEGD_VibratorType vibrator_type
Definition: segd_file.h:332
float time
Definition: segd_file.h:386
float time_break
Definition: segd_file.h:387
int src_point_num_card
Definition: segd_file.h:328
int external_hdr_blocks
Definition: segd_file.h:304
int trace_hdr_ext
Definition: segd_file.h:388
int general_trailer_blocks
Definition: segd_file.h:317
int day
Definition: segd_file.h:284
int scan_types
Definition: segd_file.h:300
Definition: segd_file.h:368
int gh_block_number
Definition: segd_file.h:334
float base_scan_interval
Definition: segd_file.h:291
int src_set_number
Definition: segd_file.h:335
int extended_hdr_blocks
Definition: segd_file.h:313
int external_hdr_blocks
Definition: segd_file.h:314
int cs_n
Definition: segd_file.h:370