Closed davidfee5 closed 4 years ago
I like your suggestion. My intuition at first was to do it something like that and I should have followed it! Cleaner and hopefully robust. Tested on a few variants of our regional and local example and seems to work.
I'm pretty sure how I have it will force st.trim to pad out the start and end time, so your addition isn't needed. For your commit you only add the "extra stability" for the start time, but why not the end time? I think it's either neither or both.
Since we've forced the sampling_rate
to be the same for all traces in an earlier step, equalizing the starttime
and then requesting a specific amount of time (which is what trim()
is doing) guarantees an identical endtime
.
My reason for equalizing the starttime
is out of an abundance of caution for edge cases where st.trim()
might "round" up or down. I don't think that will happen anyway since we're using min_starttime
and max_endtime
and padding, etc., but I can't prove that it won't. We could probably read the docs for st.trim()
, especially the nearest_sample
parameter, to assure ourselves. But with this addition, I can't imagine failure in any situation, regardless of have st.trim()
behaves.
This checks the stream in process_waveforms and adds in any extra samples to ensure all traces in the stream have the same number of samples. It seems like the interpolation will occasionally leave a trace short a sample, which then messes up the grid search. Addresses #29. Not elegant, but I couldn't find an easy way to accomplish this.