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

Fix trimming waveforms after fetching from FDSN Client #2298

Merged
merged 5 commits into from Feb 20, 2019
Merged
Diff settings

Always

Just for now

flake8

  • Loading branch information...
megies committed Feb 20, 2019
commit e2e5c431ae191bb4428715b21990676250fd4c42
Copy path View file
@@ -839,7 +839,7 @@ def get_waveforms(self, network, station, location, channel, starttime,
if attach_response:
self._attach_responses(st)
self._attach_dataselect_url_to_stream(st)
st.trim(starttime,endtime)
st.trim(starttime, endtime)
return st

def _attach_responses(self, st):
@@ -306,20 +306,21 @@ def test_set_credentials(self):

def test_trim_stream_after_get_waveform(self):
"""
Fixes #1887
Tests that stream is properly trimmed to user requested times after
fetching from datacenter, see #1887
"""
from obspy.clients import fdsn
c = fdsn.client.Client(
service_mappings={'dataselect': \
'http://eida.ipgp.fr/fdsnws/dataselect/1'}, debug=True)
starttime=UTCDateTime('2016-11-01T00:00:00')
endtime=UTCDateTime('2016-11-01T00:00:10')
stream = c.get_waveforms('G', 'PEL', '*', 'LHZ', starttime,endtime)
c = Client(
service_mappings={'dataselect':
'http://eida.ipgp.fr/fdsnws/dataselect/1'},
debug=True)
starttime = UTCDateTime('2016-11-01T00:00:00')
endtime = UTCDateTime('2016-11-01T00:00:10')
stream = c.get_waveforms('G', 'PEL', '*', 'LHZ', starttime, endtime)
trace = stream[0]
t1= trace.stats.starttime
t2= trace.stats.endtime
t1 = trace.stats.starttime
t2 = trace.stats.endtime
self.assertEqual(starttime, t1)
self.assertEqual(endtime,t2)
self.assertEqual(endtime, t2)

def test_service_discovery_iris(self):
"""
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.