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

Trace/Stream: add methods to switch byteorder #3418

Merged
merged 5 commits into from May 16, 2024
Merged

Conversation

megies
Copy link
Member

@megies megies commented Mar 11, 2024

What does this PR do?

Show up some ways how to work around exceptions getting raised when trying to merge traces with different byteorder but otherwise being mergable.
Still not sure if we want to automatically adjust byteorder when needed as this might have side effects we don't think of right now maybe.. so maybe a more conservative option would be to show a meaningful error message if a merge is failing solely due to a byteorder mismatch that points at the option to manually force byteorder to a common one.

Kinda would like to hear thoughts.

Why was it initiated? Any relevant Issues?

fixes #3417

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).
  • While the PR is still work-in-progress, the no_ci label can be added to skip CI builds
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just add the build_docs tag to this PR.
    Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
    Please post a link to the relevant piece of documentation.
  • If all tests including network modules (e.g. clients.fdsn) should be tested for the PR,
    just add the test_network tag to this PR.
  • All tests still pass.
  • Any new features or fixed regressions are covered via new tests.
  • Any new or changed features are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .
  • If the changes affect any plotting functions you have checked that the plots
    from all the CI builds look correct. Add the "upload_plots" tag so that plotting
    outputs are attached as artifacts.
  • New modules, add the module to CODEOWNERS with your github handle
  • Add the yellow ready for review label when you are ready for the PR to be reviewed.

@megies megies added the .core issues affecting our functionality at the very core label Mar 11, 2024
@megies megies added this to the 1.5.0 milestone Mar 11, 2024
@megies megies added the build_docs Docs will be automatically built and deployed in github actions on pushes to the PR label Mar 11, 2024
Copy link
Member

@d-chambers d-chambers left a comment

Choose a reason for hiding this comment

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

This seems like a straight-forward solution and a simple implementation. The only thing I can think of that might go wrong could be in writing the stream/traces to some binary format that assumes a certain byte order. However, since this behavior is something the user has to opt in to use I don't see how it could affect any existing codes.

@megies megies added the ready for review PRs that are ready to be reviewed to get marked ready to merge label May 16, 2024
@megies megies marked this pull request as ready for review May 16, 2024 08:55
@megies megies requested a review from trichter as a code owner May 16, 2024 08:55
@megies
Copy link
Member Author

megies commented May 16, 2024

I added some improved error messages on failed merges (e.g. due to dtype mismatch) and also added tests. Should be good to go now

@megies megies merged commit 84d4ca4 into master May 16, 2024
30 checks passed
@megies megies deleted the merge_byteorder branch May 16, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build_docs Docs will be automatically built and deployed in github actions on pushes to the PR .core issues affecting our functionality at the very core ready for review PRs that are ready to be reviewed to get marked ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert byte order to native on reading data or merging traces?
3 participants