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

Added check for response function #1829

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@s-schneider
Copy link
Member

commented Jun 28, 2017

What does this PR do?

Adds write support for AH (Ad Hoc) format to stream.write(), It is an addition to PR #1757

Why was it initiated? Any relevant Issues?

related to issue #1754

PR Checklist

  • This PR is not directly related to an existing issue (which has no PR yet).
  • 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 .
packer.pack_float(0)
packer.pack_float(0)
if hasattr(tr.stats, 'response'):
poles, zeros = tr.stats.response.get_paz()

This comment has been minimized.

Copy link
@megies

megies Jun 28, 2017

Member

In general we nowadays don't encourage "magic uses" of additional items in Trace.stats anymore.. but if it's important for you we might still accept this change I guess..

This comment has been minimized.

Copy link
@s-schneider

s-schneider Jun 28, 2017

Author Member

Would there be a better way to check if there is a response attached?

@krischer

This comment has been minimized.

Copy link
Member

commented Jun 28, 2017

I'd personally either like to see this as tr.stats.ah.response or Stream.write(..., format="AH", response=response). Adding important things to tr.stats is a hack in any case and we should not keep doing this - there are already enough places in our code base that do that.

@s-schneider

This comment has been minimized.

Copy link
Member Author

commented Jun 28, 2017

I use the information provided for instance by the get_waveforms(attach_response=True) of obspy.clients.fdsn. I didn't add that information manually.

@krischer

This comment has been minimized.

Copy link
Member

commented Jun 30, 2017

Yea- this is one of the instances in our code base where it does already happen. I'd be fine with a construct like this which offers a cleaner interface but also falls back to using the existing tr.stats.response:

def _write_ah(..., response=None, ...):
    ...
    # First use passed response, otherwise look in trace.stats.
    if response is None and "response" in tr.stats:
        response = tr.stats.response

    if response:
        ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.