Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read specific, but seemingly valid SEG-Y file #577

Open
TheZappie opened this issue Aug 20, 2024 · 1 comment
Open

Can't read specific, but seemingly valid SEG-Y file #577

TheZappie opened this issue Aug 20, 2024 · 1 comment

Comments

@TheZappie
Copy link

I can't read specific, but seemingly valid SEG-Y file. What in segyio is triggering this (and is it an issue with the file or code)?

The file can be reached here: https://drive.google.com/file/d/1MXw_5dqoSYJlMoXWB7BJvqSY75GQnCsQ/view?usp=sharing

from pathlib import Path

path = r"/path/to/AN-A401.sgy"

a = Path(path).stat().st_size - 3600
trace_lenth = 2560 
b = trace_lenth * 4 + 240
assert (a % b == 0)
# asserting that the file length is exactly as it should be

import segyio

segyio.open(path, ignore_geometry=True, mode="r", endian='big')
# yields error: RuntimeError: trace count inconsistent with file size, trace lengths possibly of non-uniform
# Other programs do work, including seisee and obspy.
from obspy.io.segy.core import _read_segy
st = _read_segy(path, format="SEGY")

image

@TheZappie
Copy link
Author

TheZappie commented Sep 4, 2024

It is related to SEG-Y revision indicator in the binary header. Segyio does open it when I first do this:

with open(p, mode='rb+') as f:
    f.seek(3500)
    packed_data = struct.pack('>b', 1)
    f.write(packed_data)

    f.seek(3501)
    packed_data = struct.pack('>b', 0)
    f.write(packed_data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant