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

Unable to open open Kahu 3-D SEGY file #517

Open
jcfaracco opened this issue Oct 19, 2021 · 3 comments
Open

Unable to open open Kahu 3-D SEGY file #517

jcfaracco opened this issue Oct 19, 2021 · 3 comments

Comments

@jcfaracco
Copy link

jcfaracco commented Oct 19, 2021

There are some datasets available on SEG Wiki. One of them is Kahu 3-D.

Kahu is not opening properly using segyio.

Here is the code I`m using:

filename = "KAHU-3D-PR3177-FM.3D.Final_Migration.sgy"
with segyio.open(filename) as fl:
    data = np.ascontiguousarray(np.array(segyio.tools.cube(fl)))

But I'm getting the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/rapids/lib/python3.7/site-packages/segyio/open.py", line 187, in open
    return infer_geometry(f, metrics, iline, xline, strict)
  File "/opt/conda/envs/rapids/lib/python3.7/site-packages/segyio/open.py", line 7, in infer_geometry
    cube_metrics = f.xfd.cube_metrics(iline, xline)
RuntimeError: unable to find sorting.Check iline, (189) and xline (193) in case you are sure the file is a 3D sorted volume

If I pass ignore_geometry=True, I get a different error like the one below:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/opt/conda/envs/rapids/lib/python3.7/site-packages/segyio/tools.py", line 242, in cube
    fast, slow, offs = len(fast), len(slow), len(f.offsets)
TypeError: object of type 'NoneType' has no len()

I'm still not sure if the Kahu 3-D data has any problem or it is a bug inside segyio.

@jcfaracco jcfaracco changed the title Unable to open open SEGY Kahu 3-D Unable to open open Kahu 3-D SEGY file Oct 19, 2021
@da-wad
Copy link

da-wad commented Oct 19, 2021

The Kahu-3D dataset has a problem. Or, actually, two.

  1. The iline and xline headers appear to be in positions 181 and 185 rather than the standard 189 and 193.
  2. The file is not regular.

The following snippet should help you figure out what's going on...

>>> f1 = segyio.open('KAHU-3D-PR3177-FM.3D.Final_Migration.sgy', strict=False)
>>> coords = np.array([(h[181], h[185]) for h in f1.header])
>>> len(np.unique(coords[:,0]))
599
>>> len(np.unique(coords[:,1]))
1697
>>> 599*1697
1016503
>>> len(coords)
994230

@TLarsen-ui
Copy link

I get the same error when running the code in the attached image.
The post stack cube I am reading have Undef traces/bins in it. When I use iosegy on a volume with no Undef traces it reads it without problems.

image

@ErlendHaa
Copy link
Contributor

Hi,

By default segyio tries to infer cube geometry from the trace headers. In your case it's not regular (the dimensions doesn't add up). You would have to explicitly set ignore_geometry=True or strict=False in open in order to open it. The documentation explains these options in more detail [1]. Note that operations on ilines and xlines are not available (as these need geometry to work properly). Hence you are limited to iterating the cube trace-by-trace in this case

[1] https://segyio.readthedocs.io/en/latest/segyio.html#segyio.open

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

4 participants