Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C#
public void ReadBinaryHeader()
        {
                        SeismicLog.WriteLog(DateTime.Now + "Reading Binary Header.");

            int sampleInterval = 0; //sample interval in microseconds 


            int dataSampleFormat = 0;

                              if (countNoOfBytes < 3600)
            {
                               inputSegyFileStream.Seek(16, SeekOrigin.Current);
                countNoOfBytes = countNoOfBytes + (16);


                byteOutputOfReader = segyReader.ReadByte();
                sampleInterval = sampleInterval + (byteOutputOfReader * 256);
                countNoOfBytes++;
                byteOutputOfReader = segyReader.ReadByte();
                sampleInterval = sampleInterval + (byteOutputOfReader);
                countNoOfBytes++;


              
                inputSegyFileStream.Seek(2, SeekOrigin.Current);
                countNoOfBytes = countNoOfBytes + (2);



                byteOutputOfReader = segyReader.ReadByte();
                noOfsamplesperDataTrace = noOfsamplesperDataTrace + (byteOutputOfReader * 256);
                countNoOfBytes++;
                byteOutputOfReader = segyReader.ReadByte();
                noOfsamplesperDataTrace = noOfsamplesperDataTrace + byteOutputOfReader;
                countNoOfBytes++;


                
                inputSegyFileStream.Seek(2, SeekOrigin.Current);
                countNoOfBytes = countNoOfBytes + (2);


                byteOutputOfReader = segyReader.ReadByte();
                dataSampleFormat = dataSampleFormat + (byteOutputOfReader * 256);
                countNoOfBytes++;
                byteOutputOfReader = segyReader.ReadByte();
                dataSampleFormat = dataSampleFormat + byteOutputOfReader;
                countNoOfBytes++;


                if (dataSampleFormat == 1 | dataSampleFormat == 2 | dataSampleFormat == 4 | dataSampleFormat == 5)
                {
                    multiplierTrace = 4;
                }
                else if (dataSampleFormat == 3)
                {
                    multiplierTrace = 2;
                }
                else if (dataSampleFormat == 8)
                {
                    multiplierTrace = 1;
                }

                inputSegyFileStream.Seek(278, SeekOrigin.Current);
                countNoOfBytes = countNoOfBytes + (278);



                byteOutputOfReader = segyReader.ReadByte();
                noOfExtendedTexHeaders = noOfExtendedTexHeaders + (byteOutputOfReader * 256);
                countNoOfBytes++;
                byteOutputOfReader = segyReader.ReadByte();
                noOfExtendedTexHeaders = noOfExtendedTexHeaders + byteOutputOfReader;
                countNoOfBytes--;
                inputSegyFileStream.Seek(94, SeekOrigin.Current);
                countNoOfBytes = countNoOfBytes + (94);

                SeismicLog.WriteLog(DateTime.Now + "End of Binary Header.");

                //This is a loop where we are skipping Extended Textual Headers if present in SEGY
                if (noOfExtendedTexHeaders > 0)
                {
                    for (int NoOfExtTextHeader = 0; NoOfExtTextHeader < noOfExtendedTexHeaders; NoOfExtTextHeader++)
                    {
                        inputSegyFileStream.Seek(3200, SeekOrigin.Current);
                        countNoOfBytes = countNoOfBytes + (3200);
                    }
                }
            }
          
           }


        }
Posted
Updated 15-Mar-15 19:33pm
v3
Comments
[no name] 16-Mar-15 0:39am    
Problems with your question:
- If have no clue what segy files are. Probably nobody else here does. You don't give any information about it.
- You don't tell why you can't read it. What's the problem?
Member 11527624 16-Mar-15 2:28am    
While debugging the code this method is getting skipped.I cant understand.Help me with some sample code if possible for reading the binary header data in segy files
[no name] 16-Mar-15 2:31am    
The method ReadBinaryHeader() gets skipped?
Member 11527624 16-Mar-15 4:42am    
I mean like that particular method is not executing.If you have some code or anything on this pls do forward..
[no name] 16-Mar-15 0:40am    
This statement has no relevance to anyone but you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900