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
Select traces in Stream based on an Inventory #2531
Conversation
Select traces in Stream based on the content of an Inventory object: trace will be selected if the inventory contains a matching channel active at the trace start time.
obspy/core/stream.py
Outdated
traces.append(trace) | ||
except ValueError: | ||
break | ||
return self.__class__(traces=traces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly any other options specified to select()
will be ignored if an Inventory is provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. It seems to me a strange use case to mix the two criteria. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with the current approach of chaining all checks with logical AND, i.e. any filter criteria specified by the user should actually also be applied. I don't think it's good practice to have one kwarg completely override others too much, it'd be hell for a user to check which combination of kwargs together actually do what.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shared @megies opinion. This would be really confusing to me and one passes multiple criteria I would intuitively expect them all to be applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll modify that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to get it done ASAP so I can bundle the RC thanks! :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it myself. Tests aren't comprehensive, btw, no fails popping up after my change it seems
restirctions as well
@megies Thanks for taking care of this: I have been sick and unable to work during the last few days. |
What does this PR do?
Select traces in
Stream
based on the content of anInventory
object:trace will be selected if the inventory contains a matching channel
active at the trace start time.
Why was it initiated? Any relevant Issues?
This is a follow-up of #2515.
Sometimes datacenter provides preassembled datasets with data and metadata for all the stations in the network (ex.: http://cnt.rm.ingv.it/event/23558121 --> Download).
Using #2515, inventory can be filtered based on geographic parameters.
With the present PR, data in stream can be selected based on the inventory content.
PR Checklist
master
for new features,maintenance_...
for bug fixesJust remove the space in the following string after the + sign: "+DOCS"
CHANGELOG.txt
.