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

Revision 2 support for io.segy. #2846

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dbpodrasky
Copy link

@dbpodrasky dbpodrasky commented Jun 11, 2021

What does this PR do?

Updates to io.segy.header.py, io.segy.upack.py and io.segy.segy.py to enable reading SEG-Y revision 2.0 files. Some additional unpacking methods were added to io.segy.unpack.py as shell methods that contain commented, untested code for reading/converting the various new data format types defined by rev2. Currently these methods all call the not implemented error message. io.segy.header.py has had new parameters inserted into the BINARY_FILE_HEADER and TRACE_HEADER lists to handle extended acquisition parameter blocks defined by rev2. io.segy.segy.py has had some minor modifications to check for revision number and fixed trace lenght flag, in which case it attemps to read the extended acquisition parameter blocks in the binary file header. If the extended acquisition parameter blocks are set to zero, the behavior defaults to reading rev1 blocks from the binary file header and trace headers.

Why was it initiated? Any relevant Issues?

Adds support for revision 2 data files.

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just remove the space in the following string after the + sign: "+ DOCS"
  • If any network modules should be tested for the PR, add them as a comma separated list
    (e.g. clients.fdsn,clients.arclink) after the colon in the following magic string: "+TESTS:"
    (you can also add "ALL" to just simply run all tests across all modules)
  • All tests still pass.
  • Any new features or fixed regressions are be covered via new tests.
  • Any new or changed features have are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .

@dbpodrasky
Copy link
Author

Can someone offer some support for resolving these failed tests? reviewdog is flaging some whitespace pereferences that I will work through. But, how can I resolve failed tests on classes and methods I made changes to (see os tests)?

@flixha
Copy link
Contributor

flixha commented Jun 15, 2021

I know only a bit about the Segy-format, but I hope I can help you with some points to look into:

  • it seems like all errors in the code-tests are caused by the same line obspy/io/segy/segy.py#L536 (check test outputs here: https://tests.obspy.org/114157/#1 )
  • It looks like the write-function can only deal with header values that have a length of 2 or 4 bytes, or that start with unassigned_..., but some of the new header variables that you added do not fulfill these criteria and hence cause an error
  • If you are working in some Editor/IDE with debug support, it's often a bit difficult to use a normal debugger on the tests in obspy/io/segy/tests/test_segy.py. For VSCode, it becomes possible / quite simple to debug tests with the extension "Python Test Explorer for Visual Studio Code" installed.

@dbpodrasky
Copy link
Author

Ah, I see. Thank you. I will try to separate the header list objects into a write and read for SEG-Y rev2 support and tackle write support later.

@dbpodrasky
Copy link
Author

It turns out that I am not able to run the tests on my changes because I have two separate installs of obspy: one installed by macports and a copy that has my git fork with segyr2 branch. How can I run obspy-tests and point it to my test install?

@barsch
Copy link
Member

barsch commented Jun 15, 2021

obspy-runtests is just a shortcut for python -m obspy.scripts.runtests - see https://docs.obspy.org/packages/autogen/obspy.scripts.runtests.html for more info

@ThomasLecocq
Copy link
Contributor

@dbpodrasky could you rebase your PR on the lastest master channel?

davidsilixa@gmail.com added 2 commits May 14, 2024 13:18
… enable reading SEG-Y revision 2.0 files. Some additional unpacking methods were added to io.segy.unpack.py as shell methods that contain commented, untested code for reading/converting the various new data format types defined by rev2. Currently these methods all call the not implemented error message. io.segy.header.py has had new parameters inserted into the BINARY_FILE_HEADER and TRACE_HEADER lists to handle extended acquisition parameter blocks defined by rev2. io.segy.segy.py has had some minor modifications to check for revision number and fixed trace lenght flag, in which case it attemps to read the extended acquisition parameter blocks in the binary file header. If the extended acquisition parameter blocks are set to zero, the behavior defaults to reading rev1 blocks from the binary file header and trace headers.
@megies
Copy link
Member

megies commented May 14, 2024

@dbpodrasky could you rebase your PR on the lastest master channel?

Rebased on current master and force-pushed. I had some funky maxmem error during the rebase but from what I see it looks OK.

I'm confused about all the unpack routines though, that all raise NotImplementedError now.

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

Successfully merging this pull request may close these issues.

None yet

5 participants