[obspy-users] Writing SEG-Y files with more than 32767 samples per trace

Lion Krischer krischer at geophysik.uni-muenchen.de
Mon Mar 27 10:28:57 CEST 2017


Hi Peter,

thanks for the clarification - this settles it then!

Cheers!

Lion



On 27/03/2017 08:55, Peter Schmidt wrote:
> Hi Lion,
>
> Well, the SEG Y rev 1
> (http://www.seg.org/Portals/0/SEG/News%20and%20Resources/Technical%20Standards/seg_y_rev1.pdf)
> states in section 3.3. (Number Formats) that:
>
> "All values in the Binary File Header and the
> Trace Header are two's complement
> integers, either two bytes or four bytes long."
>
> So signed it is
>
>
>
> regP
>
>
> On 26/03/17 21:51, Lion Krischer wrote:
>> Hi Peter,
>>
>> there has been some discussion on this in the past (cannot find it right
>> now). Some SEG-Y readers/writers also work with unsigned integers for
>> the number of samples which doubles the maximum allowed samples. In the
>> interest of maximum compatibility we did not do this back then and ObsPy
>> treats all integer values in SEG-Y as signed.
>>
>> In the SEG-Y spec there is (if I remember correctly) no mention if the
>> numbers should be signed/unsigned but some fields clearly require signed
>> integers so for ObsPy they now are all signed values.
>>
>> We should probably improve the SEG-Y error messages though...
>>
>> Cheers!
>>
>> Lion
>>
>>
>> On 26/03/2017 19:56, Peter Schmidt wrote:
>>> Ok, so forget about this question
>>>
>>> Reading up on the SEG-Y rev1 format I find that this is a limitation
>>> of the format as the number of samples are encoded using 2-byte two's
>>> complement (signed) integers.
>>>
>>>
>>> regP
>>>
>>>
>>> On 2017-03-25 14:06, Peter Schmidt wrote:
>>>> Hi
>>>>
>>>> I'm trying to use ObsPy to convert some GCF files into SEG-Y, however
>>>> I'm running into problems when the number of samples in a trace is
>>>> larger than 32767. It seems the problem occurs while trying to write
>>>> the header.
>>>>
>>>> The error output is:
>>>>>>> print stream
>>>> 1 Trace(s) in Stream:
>>>> Seq. No. in line:    1 | 2013-01-24T11:15:00.000000Z -
>>>> 2013-01-24T11:19:59.995000Z | 200.0 Hz, 60000 samples
>>>>
>>>>>>> stream.write(out, format='SEGY')
>>>> File "/usr/lib/python2.7/dist-packages/obspy/core/stream.py", line
>>>> 1418, in write
>>>>    writeFormat(self, filename, **kwargs)
>>>> File "/usr/lib/python2.7/dist-packages/obspy/segy/core.py", line 432,
>>>> in writeSEGY
>>>>    segy_file.write(filename, data_encoding=data_encoding,
>>>> endian=byteorder)
>>>> File "/usr/lib/python2.7/dist-packages/obspy/segy/segy.py", line 228,
>>>> in write
>>>>    self._write(file, data_encoding=data_encoding, endian=endian)
>>>> File "/usr/lib/python2.7/dist-packages/obspy/segy/segy.py", line 268,
>>>> in _write
>>>>    self.binary_file_header.write(file, endian=endian)
>>>> File "/usr/lib/python2.7/dist-packages/obspy/segy/segy.py", line 411,
>>>> in write
>>>>    file.write(pack(format, getattr(self, name)))
>>>> struct.error: 'h' format requires -32768 <= number <= 32767
>>>>
>>>> So the question is, can I specify the header to be written with some
>>>> other format than 'h' and how do I do this
>>>>
>>>>
>>>> regards Peter
>>>>
>>>
>>
>> _______________________________________________
>> obspy-users mailing list
>> obspy-users at lists.swapbytes.de
>> http://lists.swapbytes.de/mailman/listinfo/obspy-users
>




More information about the obspy-users mailing list