public void readTraceData(Byte[] buffer, IList <Trace> traceList, BinaryFileHeader binTemp) { //for loop that runs the amount of channels in the file for (int i = 0; i < binTemp.numDataTraces; i++) { Trace temp = new Trace(); //instantiates a new class every time there's a new channel if (i == 0) { //240 is the size of a trace header, only read one trace header then skip over the rest start = (binTemp.extendedTextualFileHeaderEnd + (240)); stop = ((binTemp.extendedTextualFileHeaderEnd + (240)) + (binTemp.numSampsPerTrace * 4)); //Debug.WriteLine("START INDEX: " + start); //Debug.WriteLine("END INDEX: " + stop); temp.determineTraceData(buffer, start, stop, binTemp); traceList.Add(temp); } else { start = stop + 240; stop = start + ((binTemp.numSampsPerTrace * 4)); //Debug.WriteLine("START INDEX: " + start); //Debug.WriteLine("END INDEX: " + stop); temp.determineTraceData(buffer, start, stop, binTemp); traceList.Add(temp); } } }
public void determineTraceData(Byte[] buffer, int start, int stop, BinaryFileHeader binTemp) { Amplitudes amplitudeReader = null; switch (binTemp.measurementUnit) { case 0x1: amplitudeReader = new Amp4ByteIBMFloating(); break; case 0x2: amplitudeReader = new Amp4Byte2sComp(); break; case 0x3: amplitudeReader = new Amp2Byte2sComp(); break; case 0x4: Debug.WriteLine("OBSOLETE FIXED POINT WITH GAIN FORMAT. NOT SUPPORTED"); break; case 0x5: amplitudeReader = new Amp4ByteIEEEFloating(); break; case 0x6: Debug.WriteLine("NOT CURRENTLY USED"); break; case 0x7: Debug.WriteLine("NOT CURRENTLY USED"); break; case 0x8: amplitudeReader = new Amp1Byte2sComp(); break; } amplitudes = amplitudeReader.ReadData(buffer, start, stop); //calls the Abstract class Amplitudes() that will determine how to read the Trace amplitudes Debug.WriteLine("List Size: " + amplitudes.Count()); }
} // end of flipBits() public void readTraceHeaders(Byte[] buffer, BinaryFileHeader temp) { if (buffer.Count() <= 0) { Debug.WriteLine("Buffer is empty."); return; } //Debug.WriteLine("Beginning Bit Location of Trace Header 1: " + temp.extendedTextualFileHeaderEnd); this.traceSeqNumLine = BitConverter.ToUInt32(buffer, temp.extendedTextualFileHeaderEnd); this.ogFieldRecordNum = BitConverter.ToUInt32(buffer, temp.extendedTextualFileHeaderEnd + 9); this.traceNumOGField = BitConverter.ToUInt32(buffer, temp.extendedTextualFileHeaderEnd + 13); this.traceIDCode = BitConverter.ToUInt16(buffer, temp.extendedTextualFileHeaderEnd + 29); this.numSampsTrace = BitConverter.ToUInt16(buffer, temp.extendedTextualFileHeaderEnd + 115); this.sampIntMicro = BitConverter.ToUInt16(buffer, temp.extendedTextualFileHeaderEnd + 117); Debug.WriteLine("*--------------------START OF ANALYSIS OF TRACE HEADER--------------------*"); Debug.WriteLine("Trace sequence number within line: " + traceSeqNumLine); Debug.WriteLine("Original field record number: " + ogFieldRecordNum); Debug.WriteLine("Trace number within the original field record: " + traceNumOGField); Debug.WriteLine("Trace ID Code: " + traceIDCode); if (traceIDCode == 1) { Debug.WriteLine("Trace ID says that this file contains seismic data"); } else { Debug.WriteLine("This file doesn't contain seismic data according to the trace ID code."); } Debug.WriteLine("*--------------------END OF ANALYSIS OF TRACE HEADER--------------------*"); }
public SEGYU() { binaryFileHeader = new BinaryFileHeader(); trace = new Trace(); }