# Read segy and su header

**URL:** <https://discourse.obspy.org/t/read-segy-and-su-header/196>\
**Category:** Users Mailing List Archive\
**Tags:** archive\
**Created:** [July 16, 2013, 12:16pm UTC](https://discourse.obspy.org/t/read-segy-and-su-header/196 "2013-07-16T12:16:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Even\_Lindgard](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/j/ecd19e/32.png) [@John\_Even\_Lindgard](https://discourse.obspy.org/u/John_Even_Lindgard)\
**Post date:** [July 16, 2013, 12:16pm UTC](https://discourse.obspy.org/t/read-segy-and-su-header/196/1 "2013-07-16T12:16:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LionKrischer](https://discourse.obspy.org/user_avatar/discourse.obspy.org/lionkrischer/32/219_2.png) [@LionKrischer](https://discourse.obspy.org/u/LionKrischer)\
**Post date:** [July 16, 2013, 3:54pm UTC](https://discourse.obspy.org/t/read-segy-and-su-header/196/2 "2013-07-16T15:54:54Z")

</div>

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
