|
|
|
|
|
/**
|
|
|
|
|
|
* @file SegdReader.h
|
|
|
|
|
|
* @brief SegD<EFBFBD><EFBFBD>ʽ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>
|
|
|
|
|
|
* @author
|
|
|
|
|
|
* @date 2011-11-15
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "SegDHeader.h"
|
|
|
|
|
|
#include "SeisLineData.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace NSegD
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct stuSegDFileHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
unsigned short ver; //<2F>汾<EFBFBD>ţ<EFBFBD>1=<3D>汾1.0<EFBFBD><EFBFBD>2=<3D>汾2.0<EFBFBD><EFBFBD>3=<3D>汾3.0(Ŀǰ<C4BF><C7B0>֧<EFBFBD><D6A7>3.0<EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
|
|
int fileNumber; //<2F>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short formatCode; //<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>
|
|
|
|
|
|
//ʱ<><CAB1>
|
|
|
|
|
|
//0x0015 20 bit binary multiplexed
|
|
|
|
|
|
//0x0022 8 bit quaternary multiplexed
|
|
|
|
|
|
//0x0024 16 bit quaternary multiplexed
|
|
|
|
|
|
//0x0036 24 bit 2's compliment integer multiplexed
|
|
|
|
|
|
//0x0038 32 bit 2's compliment integer multiplexed
|
|
|
|
|
|
//0x0042 8 bit hexadecimal multiplexed
|
|
|
|
|
|
//0x0044 16 bit hexadecimal multiplexed
|
|
|
|
|
|
//0x0048 32 bit hexadecimal multiplexed
|
|
|
|
|
|
//0x0058 32 bit IEEE multiplexed
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
//0x8015 20 bit binary demultiplexed
|
|
|
|
|
|
//0x8022 8 bit quaternary demultiplexed
|
|
|
|
|
|
//0x8024 16 bit quaternary demultiplexed
|
|
|
|
|
|
//0x8036 24 bit 2's compliment integer demultiplexed
|
|
|
|
|
|
//0x8038 32 bit 2's compliment integer demultiplexed
|
|
|
|
|
|
//0x8042 8 bit hexadecimal demultiplexed
|
|
|
|
|
|
//0x8044 16 bit hexadecimal demultiplexed
|
|
|
|
|
|
//0x8048 32 bit hexadecimal demultiplexed
|
|
|
|
|
|
//0x8058 32 bit IEEE demultiplexed
|
|
|
|
|
|
//<2F><>Ч
|
|
|
|
|
|
//0200 Illegal, do not use
|
|
|
|
|
|
//0000 Illegal, do not use
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short scanInterval; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int recordLength; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
//ͨ<><CDA8>һ<EFBFBD>μ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>еļ<D0B5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Ͳɼ<CDB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2>仯<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
unsigned short scanTypesNum; //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD>
|
|
|
|
|
|
unsigned short channelNumPerScanType; //һ<><D2BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int totalChannelsNumber; /* total number of channels */
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short sampleSkewNum; //<2F><><EFBFBD><EFBFBD>ʱƫͷ<C6AB>θ<EFBFBD><CEB8><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short trailerNum; /* 13-14 General trailer number */
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short generalHeaderNum; /* 12 Number blocks in general header ͷ<>ο<EFBFBD><CEBF>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ͨ<EFBFBD><CDA8>ͷ<EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>*/
|
|
|
|
|
|
unsigned short extendedHeaderNum; //<2F><>չͷ<D5B9>θ<EFBFBD><CEB8><EFBFBD>
|
|
|
|
|
|
int externalHeaderNum; //<2F>ⲿͷ<E2B2BF><CDB7><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
//ͷ<>鳤<EFBFBD><E9B3A4>
|
|
|
|
|
|
//( generalHeaderNum + scanTypesNum*(channelNumPerScanType+sampleSkewNum) + extendedHeaderNum + externalHeaderNum + 1 ) * 32
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short year; //Year (0-99)
|
|
|
|
|
|
unsigned short day; //Day (1-366)
|
|
|
|
|
|
unsigned short hour; /* 14 Hour of day(0-23) */
|
|
|
|
|
|
unsigned short minute; /* 15 Minute of hour(0-59) */
|
|
|
|
|
|
unsigned short second; /* 16 Second of minute(0-59) */
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>淽ʽ<E6B7BD><CABD>Ч////////////////////////////////////////////////
|
|
|
|
|
|
//ÿ<><C3BF><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊsb + 2^sbx
|
|
|
|
|
|
unsigned short sb; /* 25 Number of scans per block */
|
|
|
|
|
|
unsigned short sbx; /* 24 sb<73><62>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ0-15 */
|
|
|
|
|
|
int scanBytes; //ÿ<><C3BF>ɨ<EFBFBD><C9A8><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
} SEGD_FILE_HEADER;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct stuSegDTraceHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
int fileNumber; //<2F>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
|
unsigned short scanType; //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
unsigned short channelSetNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
unsigned short traceNumber; /* 05-06 trace number <09><><EFBFBD><EFBFBD> */
|
|
|
|
|
|
unsigned short extendHeaderNum; /* 10 trace header extensions <20><>չ<EFBFBD><D5B9>ͷ<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD> */
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short sampleSkew; /* 11 sample skew of the first sample of the trace.
|
|
|
|
|
|
It is a part of the fractional part of the base scan interval.
|
|
|
|
|
|
Res :1/256 scan interval */
|
|
|
|
|
|
|
|
|
|
|
|
int samplesNumber; /* ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
|
|
|
|
|
|
|
} SEGD_TRACE_HEADER;
|
|
|
|
|
|
|
|
|
|
|
|
class AFX_EXT_CLASS CSegdReader
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CSegdReader(void);
|
|
|
|
|
|
~CSegdReader(void);
|
|
|
|
|
|
|
|
|
|
|
|
bool Read(LPCTSTR lpszFileName);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CSegdFileHeader<65><72><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool ReadFileHeader(CFileSegy& fr); //<2F><>ȡ<EFBFBD>ļ<EFBFBD>ͷ<EFBFBD><CDB7>Ϣ
|
|
|
|
|
|
|
|
|
|
|
|
bool ReadOneRecordBlock(CFileSegy& fr); //<2F><>ȡһ<C8A1><D2BB><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>
|
|
|
|
|
|
bool ReadTapeLabel(CFileSegy& fr); //<2F><>ȡ<EFBFBD>汾2<E6B1BE>ĴŴ<C4B4>ͷ<EFBFBD><CDB7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ð汾<C3B0><E6B1BE>
|
|
|
|
|
|
bool ReadTraceHeader(CFileSegy& fr); //<2F><>ȡ<EFBFBD><C8A1>ͷ
|
|
|
|
|
|
bool ReadDataTrace(CFileSegy& fr, CSeisTraceData& td); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
SEGD_FILE_HEADER& GetFileHeader() { return m_fileHeader; }
|
|
|
|
|
|
SEGD_TRACE_HEADER& GetTraceHeader() { return m_traceHeader; }
|
|
|
|
|
|
bool IsGain() { return m_bGain; }
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool InitializeTraceHeader(SEGD_DEMUX_TRACE_HEADER& traceHeader);
|
|
|
|
|
|
bool InitializeFileHeader(SEGD_GENERAL_HEADER_1& header1, SEGD_GENERAL_HEADER_2& header2);
|
|
|
|
|
|
bool InitializeFileHeader(SEGD_GENERAL_HEADER_1& header1);
|
|
|
|
|
|
|
|
|
|
|
|
CSeisLineData m_tracesData; //<2F><><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SEGD_FILE_HEADER m_fileHeader;
|
|
|
|
|
|
SEGD_TRACE_HEADER m_traceHeader;
|
|
|
|
|
|
bool m_bGain; /* flag for applying gain <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
|
|
|
|
|
|
|
void ClearChannelHeader(void);
|
|
|
|
|
|
SEGD_CHANNEL_SET_HEADER* GetChannelSetHeader(int i, int j);
|
|
|
|
|
|
float* GetGain(int i, int j);
|
|
|
|
|
|
|
|
|
|
|
|
int GetBytesLength(int nSampleNum, int code);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
//<2F>ļ<EFBFBD>ͷ
|
|
|
|
|
|
SEGD_TAPE_LABEL m_stuTapeLabel; //<2F>汾2 <20><>ʽ<EFBFBD>ĴŴ<C4B4><C5B4><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
|
|
|
|
|
SEGD_GENERAL_HEADER_1 m_stuGHeader1; //ͷ<>ο<EFBFBD>1
|
|
|
|
|
|
SEGD_GENERAL_HEADER_2 m_stuGHeader2; //ͷ<>ο<EFBFBD>2
|
|
|
|
|
|
SEGD_GEN_HEAD_SN358 m_stuGHeaderSN358;
|
|
|
|
|
|
SEGD_GENERAL_HEADER_N m_stuGHeaderN; //<2F><>չͷ<D5B9><CDB7>
|
|
|
|
|
|
SEGD_SAMPLE_SKEW m_stuSampleSkew; //<2F><><EFBFBD><EFBFBD>ʱƫ
|
|
|
|
|
|
SEGD_EXTENDED_HEADER m_stuExtendedHeader;//<2F><>չͷ<D5B9><CDB7>
|
|
|
|
|
|
SEGD_EXTERNAL_HEADER m_stuExternalHeader;//<2F>ⲿͷ<E2B2BF><CDB7>
|
|
|
|
|
|
|
|
|
|
|
|
SEGD_CHANNEL_SET_HEADER* m_pChannelHeader; //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>,array[scanTypesNum][channelNumPerScanType]
|
|
|
|
|
|
float* m_pGain; //<2F><><EFBFBD><EFBFBD>,array[scanTypesNum][channelNumPerScanType] for escaling exponent
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ͷ
|
|
|
|
|
|
SEGD_DEMUX_TRACE_HEADER m_stuTraceHeader; //<2F><>ͷ
|
|
|
|
|
|
SEGD_TRACE_HEADER_EXT m_stuTraceHeaderExt; //<2F><>ͷ<EFBFBD><CDB7>չ
|
|
|
|
|
|
|
|
|
|
|
|
/* repair byte swap of MP gain */
|
|
|
|
|
|
int imp0;
|
|
|
|
|
|
int imp1;
|
|
|
|
|
|
int icvt2s; /* Sercel glitch flag */
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool Read(CFileSegy& fr, SEGD_GENERAL_HEADER_1& header1);
|
|
|
|
|
|
|
|
|
|
|
|
void F8015_to_float (char *from, float* to, int len, int cvt2s);
|
|
|
|
|
|
void F8022_to_float (char *from, float* to, int len, int cvt2s);
|
|
|
|
|
|
void F8024_to_float (char *from, float* to, int len, int cvt2s);
|
|
|
|
|
|
void F8036_to_float (unsigned char *from, float* to, int len);
|
|
|
|
|
|
void F8038_to_float (char *from, float* to, int len);
|
|
|
|
|
|
void F8042_to_float (char *from, float* to, int len);
|
|
|
|
|
|
void F8044_to_float (char *from, float* to, int len);
|
|
|
|
|
|
void F8048_to_float (char *from, float* to, int len);
|
|
|
|
|
|
void F8058_to_float (char *from, float* to, int len);
|
|
|
|
|
|
|
|
|
|
|
|
int BCD(unsigned char * ptr , int begin , int n);
|
|
|
|
|
|
short GET_S(char* from);
|
|
|
|
|
|
char GET_C(char *f);
|
|
|
|
|
|
unsigned int GET_UC(unsigned char *f) { return f[0]; }
|
|
|
|
|
|
unsigned short GET_US(unsigned char *f);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}//namespace
|