Code Monkey home page Code Monkey logo

Comments (12)

rob-smallshire avatar rob-smallshire commented on August 31, 2024

The error message at the bottom tells you what the problem is. The ensemble fold attribute in your SEG-Y binary reel header has a value of 51614, whereas the SEG-Y specification only allows for values in the range 0 to 32767.

From the SEG-Y revision 1 spec, page 3:

"All values in the Binary File Header and the Trace Header are two's complement integers, either two bytes or four bytes long."

At the bottom of page 6 you will see that Ensemble fold is a two-byte value occupying the one-based file offsets 3227 and 3228.

Signed (i.e. two's complement), two-byte integers can only represent positive values in the range 0-32767.

In other words, your SEG-Y data doesn't comply with the SEG-Y specification.

You can work around this with Segpy by providing a custom binary_reel_header_format specification to create_reader(). The easiest way to do that is to subclass segpy.binary_reel_header.BinaryReelHeader to override the definition of ensemble_fold, giving it a different type.

from segpy.

Tortoise17 avatar Tortoise17 commented on August 31, 2024

Dear Sir,

Thank you so much. Can you guide me how and where to write the line in the script? as I am very new in Python. and if you can guide what exactly I should write.?

from segpy.

Tortoise17 avatar Tortoise17 commented on August 31, 2024

what I understood from you is that

inline_number = field(
Int32, offset=189, default=0, documentation=
"""In-line number for 3-D poststack data. If one in-line per SEG Y file is
being recorded, this value should be the same for all traces in the
file and the same value will be recorded in bytes 3205-3208 of the
Binary File Header.""" # TODO: replace bytes with field name
)

here I can override..?? Please if you can guide me.. how and what?

from segpy.

rob-smallshire avatar rob-smallshire commented on August 31, 2024

The error you reported mentions nothing about inline_number being a problem. It is the ensemble_fold attribute in your binary reel header which is out of range. The custom_header.py example shows how to override a custom header definition. You should be able to apply the ideas from this to your own code.

from segpy.

Tortoise17 avatar Tortoise17 commented on August 31, 2024

Nice.. should I just put this file there? or replace with header.py?

The inline ranges form 400-3900
and xline 7100-5200

from segpy.

rob-smallshire avatar rob-smallshire commented on August 31, 2024

Neither. You need to read it, understand it, and then apply the same ideas to your own program.

If you need help to actually write your own software which uses Segpy, my consulting company Sixty North can help with that. I'm afraid I don't have the time to provide you with consulting for free through this channel.

from segpy.

Tortoise17 avatar Tortoise17 commented on August 31, 2024

from segpy.

rob-smallshire avatar rob-smallshire commented on August 31, 2024

By default, Segpy reads in big-endian, the same as the SEG-Y revision 1 standard.

You can override this to force little-endian behaviour by passing the argument endian='<' to the call to create_reader().

Segpy does not yet support SEG-Y revision 2. See #52.

from segpy.

Tortoise17 avatar Tortoise17 commented on August 31, 2024

from segpy.

rob-smallshire avatar rob-smallshire commented on August 31, 2024

I'm sorry. I'm very busy and I really don't have time to help you for free. I've pointed you at examples which use custom headers. The README.rst file shows how to set the endianness.

Please contact my consulting company Sixty North if you or your employer need further assistance and are in a position to pay for it, or to fund improved documentation.

In the meantime, if you need to improve your understanding of Python in general, I recommend taking some courses such as those from Pluralsight.

from segpy.

576dhunu avatar 576dhunu commented on August 31, 2024

Respected sir/Madam
I am getting the following error while trying to make 'create_reader' using segpy.reader.Please help me out in this regards

ValueError Traceback (most recent call last)
in ()
1 filename='/content/Seismic_data.sgy'
2 with open(filename,'rb') as segy:
----> 3 segy_reader=segpy.reader.create_reader(segy, )
4 data=np.zeros((segy_reader.num_inlines(),segy_reader.num_trace_samples(1),segy_reader.num_xlines()))
5 for inline_num,xline_num in segy_reader.inline_xline_numbers():

/usr/local/lib/python3.7/dist-packages/segpy/reader.py in create_reader(fh, encoding, binary_reel_header_format, trace_header_format, endian, progress, cache_directory, dimensionality)
126 "SEG Y file {!r} of {} bytes is too short".format(
127 filename_from_handle(fh),
--> 128 num_file_bytes))
129
130 if endian not in {'<', '>'}:

ValueError: SEG Y file '/content/Seismic_data.sgy' of 2220 bytes is too short

from segpy.

rob-smallshire avatar rob-smallshire commented on August 31, 2024

@576dhunu SEG-Y files should have a 3600 byte header before the trace data (3200 text header + 400 byte binary header). The file you're providing is apparently only 2220 bytes long, so isn't longer enough to contain the header, hence: "SEG Y file '/content/Seismic_data.sgy' of 2220 bytes is too short"

from segpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.