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

fixes issue #103 #104

Merged
merged 10 commits into from
Aug 10, 2017
Merged

fixes issue #103 #104

merged 10 commits into from
Aug 10, 2017

Conversation

derick-hess
Copy link
Contributor

added get_response function to combine responses and now uses read_inventory instead of xseed parser

@derick-hess
Copy link
Contributor Author

This can probably be squash and merged

@nick-falco
Copy link
Collaborator

nick-falco commented Aug 9, 2017

I'm going to setup the beta web services to use the new version of Lloyds ObsPy code. I'll then pull down this branch and test it before merging. Thanks for the fix.

@derick-hess
Copy link
Contributor Author

derick-hess commented Aug 9, 2017

Thanks. Lloyd is discussing with Lion and Meggies as to why the public facing functions for combining responses were removed. Currently the only way responses are combined is within the NRL client so for now I just copied LLoyds function for that from the NRL client and modified it to work with RESP files as strings.

So the generalized get_response function currently in ph5tostationxml could get added into the obspy code again if Lion and Meggies agree that there should be public functions fro combining responses.

@derick-hess
Copy link
Contributor Author

So, the RESP code has no been merged into the obspy master branch without adding the general combine response function.

This code should be good to go then.

@derick-hess
Copy link
Contributor Author

I'll also update the install instructions and README to reflect that you now just clone the master branch of obspy

@nick-falco
Copy link
Collaborator

Wait don't we need a general combine response function? I thought Lloyd was going to add it back in.

@derick-hess
Copy link
Contributor Author

Going to add a tiny bit of code to this though based on a few small changes in the final version of the RESP pr that was merged. I'll push this change in about an hour

@nick-falco
Copy link
Collaborator

Do you know if there is a reason that they didn't add it back into the ObsPy code?

It would be better to have it in their code.

@derick-hess
Copy link
Contributor Author

derick-hess commented Aug 10, 2017

Lion decided that it is too specific to the NRL to be added in to the response module and that doesn't make sense in the NRL client either since you would be feeding it RESP files not from the NRL.

He said the response combining has to make too many possible NRL use case only assumptions about the semantics of each stage of the response so it could break if someone were to use non standard RESP files. A little odd to me since RESP was created by IRIS specifically for this use case

@nick-falco
Copy link
Collaborator

Oh man that really stinks. Now we have to maintain that code. I might ask them again on the PR.

@derick-hess
Copy link
Contributor Author

I think Lion wasn't 100% adverse to adding it to the nrl client even though it didn't really have anything to do with the nrl but didn't want it in the main response module

@nick-falco
Copy link
Collaborator

Yeah we really don't want to maintain that code unless we absolutely have to. I know they also mentioned the possibility of adding it to a utils.py module. Perhaps you can go talk to Lloyd in person and ask him.

@nick-falco
Copy link
Collaborator

According to Lion we can do this in three lines:

dl_resp.response_stages.pop(0)
dl_resp.response_stages.insert(0, sensor_resp.response_stages[0])
dl_resp.recalculate_overall_sensitivity()

@derick-hess
Copy link
Contributor Author

derick-hess commented Aug 10, 2017

made those changes and testing. Looks to come out the same as the code from LLoyds nrl client. Looks like the recalculate_overall_sensitivity() function Lion added was built based on the nrl client combine_response function. Looks like the nrl client get_response function could be shortened a ton since a lot of what it does is recalculating the sensitivity but they can fix that later if they want.

@nick-falco
Copy link
Collaborator

It should be the same. You can view that method here https://github.com/obspy/obspy/blob/master/obspy/core/inventory/response.py#L770-L843. Currently we are doing this work twice.

dl_resp._get_overall_sensitivity_and_gain(
output=unit, frequency=frequency)
dl_resp.instrument_sensitivity.value = gain
dl_resp.instrument_sensitivity.frequency = freq
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the code between lines 247-304 can be removed. This is already being done in recalculate_overall_sensitivity.

The following is all that is required:

dl_resp.response_stages.pop(0)
dl_resp.response_stages.insert(0, sensor_resp.response_stages[0])
dl_resp.recalculate_overall_sensitivity()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I completely removed this function in the latest commit. It's all contained and cleaned up in get_response_inv now

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool I'm setting up the PH5WS Beta Web Services to use this version of the code. If everything still works I think it is safe to merge.

@derick-hess
Copy link
Contributor Author

It should be good to go now and hopefully that code in obspy is now done with any major modifications

@nick-falco
Copy link
Collaborator

The beta web services are running on this version and are working. I think we can merge.

Copy link
Collaborator

@nick-falco nick-falco left a comment

Choose a reason for hiding this comment

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

Looks good

@derick-hess derick-hess merged commit b43509c into master Aug 10, 2017
@derick-hess derick-hess deleted the fix_#103 branch August 10, 2017 17:22
@nick-falco
Copy link
Collaborator

The live PH5 Web Services are now using this version in anticipation of the upcoming ObsPy 1.1.0 release.

Can we tag this current PH5 version as v4.0.1?

@derick-hess
Copy link
Contributor Author

Yeah I htink we can tag this v4.0.1 and update the change log. I'm still investigating the memory usage in pph5toms and hope to have something for that early next week

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.

2 participants