Skip to content

Conversation

@d-chambers
Copy link
Contributor

Description

This PR removes segyio as a hard dependency. Segyio is great, but usually very slow to upgrade to newer python versions which, in tern, keeps DASCore from upgrading. This PR fixes this.

It also implements very simple support for writing segy files as requested in #428. This will probably require more work in the future to get right, but at least we have a start here.

@aaronjgirard, do you mind reviewing this PR?

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings or appropriate doc page.
  • included a test. See testing guidelines.
  • your name has been added to the contributors page (docs/contributors.md).
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

@d-chambers
Copy link
Contributor Author

I am particularly interested if you have ideas for improving the detection of segy files found here.

spec.samples = np.ones(len(time)) * len(channel)
spec.ilines = range(len(channel))
spec.xlines = [1]
# breakpoint()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Comment on lines 19 to 27
# Valid data format codes as specified in the SEGY rev1 manual.
VALID_FORMATS = [1, 2, 3, 4, 5, 8]

# This is the maximum possible interval between two samples due to the nature
# of the SEG Y format.
MAX_INTERVAL_IN_SECONDS = 0.065535

# largest number possible with int16
MAX_NUMBER_OF_SAMPLES = 32767
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we don't since they are edge cases. But for the writer, we may want to ensure we don't make a trace with more than max number of samples. Since DAS can be very small dt and very large time, this could become an issue.

@d-chambers
Copy link
Contributor Author

d-chambers commented Dec 19, 2024

This is failing. @aaronjgirard and I discussed spool(data_directory_with_segy).update() should issue a warning while spool(segy_file.segy) should raise an error. In both cases the message should indicate segyio needs to be installed.

Also, for now we are just going to support converting patches with a dimension of "channel" to segy. In the future we will figure out how to handle 'distance' or 'x', 'y' coords.

@d-chambers
Copy link
Contributor Author

We also need to add a test for standard patch conversion

@codecov
Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (3001b76) to head (9e53820).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master     #469    +/-   ##
========================================
  Coverage   99.85%   99.85%            
========================================
  Files         115      115            
  Lines        9374     9482   +108     
========================================
+ Hits         9360     9468   +108     
  Misses         14       14            
Flag Coverage Δ
unittests 99.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@d-chambers
Copy link
Contributor Author

Hey @aaronjgirard,

I am going to merge this. I think I implemented everything we planned on for the first pass at segy write, and we really need this fix to support python 3.13. No doubt, we will have improvements to make to segy in the future!

@d-chambers d-chambers merged commit df47d0e into master Dec 24, 2024
15 checks passed
@d-chambers d-chambers deleted the optional_segyio branch December 24, 2024 01:17
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

Successfully merging this pull request may close these issues.

3 participants