In this example, we will demonstrate how to change the change the binary header when writing a Segy file. We will be modifying the code from Creating a virtual seismic dataset and writing it to disk as a Segy file.
The binary header created from the unmodified code can be seen below.
We are going to use the binary header from another Segy file (jobNumber21.sgy) and use that binary header when writing the output file.
In the LogSeismicData class, a BinaryLineHeader needs to be added to the list in getLookupObjects().
First, the binary header is extracted from the jobNumber21.sgy file. Then a BinaryLineHeader is created based on the data from the retrieved binary header.
if a BinaryLineHeader object is found when writing seismic data, it will be used to write the binary header.
With the new changes added, the resulting binary header looks like the following:
Note: if the Sample Format (Data Format) is different between the two files, then all the sample values need to be re-sampled.
By modifying the code mentioned above, the data format can be changed. The sample format is changed from IBM float to 1-byte int.
The target range values are -127 to 127 to ensure that 0 sample value doesn't change.
A clip range value of -10, 10 is used to ensure that all previous sample range is used.