equinor / segyio

Fast Python library for SEGY files.
Other
480 stars 215 forks source link

Read sample interval as unsigned in python #494

Closed gsakkis closed 8 months ago

gsakkis commented 3 years ago

We have found in some SEG-Y files the sample interval field to be negative:

In [1]: import numpy as np

In [2]: import segyio

In [3]: s = segyio.open("Vint_Calibrated_1km-1km-40ms_exppet.segy")

In [4]: s.bin[segyio.BinField.Interval]
Out[4]: -25536

In [5]: np.unique(s.attributes(segyio.TraceField.TRACE_SAMPLE_INTERVAL)[:])
Out[5]: array([-25536], dtype=int32)

In [6]: np.uint16(-25536)
Out[6]: 40000

This is the same issue as the one fixed in https://github.com/equinor/segyio/pull/413 for the sample count.