According to https://pubs.usgs.gov/of/2001/of01-326/HTML/FILEFORM.HTM (unsure of its official-ness), the text header of a SEG-Y file can either be encoded as EBCDIC or as ASCII. Most of the files we've used seem to have EBCDIC encoding, and segyio correctly handles these files. However, the other day we were greeted by a file with an ASCII header, and we were a bit stumped, as the header text suddenly seemed completely jumbled.
Looking quickly into segyio code, it seems that it always converts EBCDIC to ASCII, without checking that the contents are actually EBCDIC.
Now, the first character of the SEG-Y text header should be C (as in C 1, C 2 etc.), so looking up the numeric value and deciding whether it is EBCDIC or ASCII should be simple enough, it just has to be done.
Hope this is something we can get fixed in the library!
According to https://pubs.usgs.gov/of/2001/of01-326/HTML/FILEFORM.HTM (unsure of its official-ness), the text header of a SEG-Y file can either be encoded as EBCDIC or as ASCII. Most of the files we've used seem to have EBCDIC encoding, and
segyiocorrectly handles these files. However, the other day we were greeted by a file with an ASCII header, and we were a bit stumped, as the header text suddenly seemed completely jumbled.Looking quickly into
segyiocode, it seems that it always converts EBCDIC to ASCII, without checking that the contents are actually EBCDIC.Now, the first character of the SEG-Y text header should be
C(as inC 1,C 2etc.), so looking up the numeric value and deciding whether it is EBCDIC or ASCII should be simple enough, it just has to be done.Hope this is something we can get fixed in the library!