Skip to content

Fixed point with gain data format #605

@jcapriot

Description

@jcapriot

I've been writing a data reader in Cython for my own purposes and was trying to look for any examples of actually correctly reading in the fixed point with gain data type format (format 4). Looking through your code base it seems that it is incorrectly interpreted as a 4 byte IEEE float number, (you should probably switch this to an unsupported error within segyio if it encounters this data format...). To that end, do you have any example files that were written using this format?

For reference, according to the SEG specs, the 4 byte fixed point is essentially two 2byte pairs of numbers,

bytes 1 and 2 byte 3 and 4
Gain value

Where essentially value is an int16_t and gain could be interpreted as an uint16_t that is limited to UINT8MAX (it only uses 1 byte of the 2 byte uint16_t).

Even the SEG revision documents cannot agree on how to interpret this... from revisions 0 and 1 this is to be interpreted as $value * 2^{gain}$, but on revisions 2 and 2.1, it is said to be interpreted as $value * 2^{-gain}$. I suspect that the original revisions were correct and that revisions 2 and 2.1 were incorrect, but again I can't verify this without a known file being read correctly in the first place.

I do realize that this format is probably extremely unlikely to ever be encountered, but I was going for a completeness-sake on my own end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions