Read segy and su header

Hi,

I have worked with the header.py to fit the trace header information in the seismic data i am trying to load into obspy, however it seems like obspy does not support trace headers with length of 1 or 3 bytes. Is there any plans to implement this or does it exist code for this somewhere? I currently find that only 2,4 and 8 byte headers are implemented.

brgds John

Hi John,

the actual unpacking happens in obspy.segy.util.unpack_header_values() so if you just add cases for 1 and 3 bytes it will work. The writing happens in obspy.core.segy.segy.SEGYTraceHeader.write(). You will also have to add your special cases there (this could use some refactoring…sorry).

I would be willing to merge the packing/unpacking for 1 and 3 bytes if you implement it and send us a pull request on github. Please include a little and big endian version for the 3 bytes/24 bit numbers. struct.unpack also has no support for 24bit numbers so you will need to implement the conversion yourself.

Cheers!

Lion