-1

I am writing C# classes to export Seg-Y files for educational purposes. Seg-Y files are basically files written in a predefined format to store big chunks of binary Seismic data. In these files we define the format of numeric data in the header (for example,IbmFloatingPoint4, TwosComplementInteger4, TwosComplementInteger2, FixedPointWithGain4, IeeeFloatingPoint4, etc.) so that the reader can read the file accordingly. Given one of these formats, how can I ensure that the data is being written properly?

Right now I am using BinaryWriter.Write(Value) to write data in the file, but I am not sure which numeric format is being used to write the data.

Thanks

Jake
  • 7,565
  • 6
  • 55
  • 68

1 Answers1

0

The Unplugged . Segy library supports reading these formats so you could look at how that works and adjust it for writing.

Matthew Strawbridge
  • 19,940
  • 10
  • 72
  • 93
  • I am using Unplugged.Segy libraries only, to read the files. In this library they are using the defaults methods of Binaryreader class such as ReadSingleIbm(for IbmFloatingPoint4), ReadInt32 (for TwosComplementInteger4), ReadInt16 (for TwosComplementInteger2) etc. to read specific data, but Binarywriter dont have any such methods. – Akhilesh Goyal Oct 27 '15 at 16:47
  • Things like `ReadSingleIbm` aren't part of the standard `BinaryReader` class. It looks like they come from a referenced `UnpluggedIbmBits` library. The good news for you is that this has both [`BinaryReaderExtensionMethods.cs`](https://github.com/jfoshee/UnpluggedIbmBits/blob/master/Unplugged.IbmBits.Shared/BinaryReaderExtensionMethods.cs) and [`BinaryWriterExtensionMethods`](https://github.com/jfoshee/UnpluggedIbmBits/blob/master/Unplugged.IbmBits.Shared/BinaryWriterExtensionMethods.cs). – Matthew Strawbridge Oct 27 '15 at 22:02