iris client

Following up, just changing to the new base_url didn’t help:

client = Client(base_url=“http://service.iris.edu/irisws/timeseries/1”)

Comparing

http://service.iris.edu/irisws/timeseries/1/query?net=IU&sta=ANMO&loc=00&cha=BHZ&start=2010-02-27T06:30:00.000&end=2010-02-27T06:50:00.000&output=plot

and

from obspy.iris import Client
from obspy import UTCDateTime
client = Client(base_url=“http://service.iris.edu/irisws/timeseries/1”)
t = UTCDateTime(“2010-02-27T06:30:00.000”)
st = client.getWaveform(“IU”, “ANMO”, “00”, “BHZ”, t, t + 20)

st.plot()

which resulted in:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib64/python2.7/site-packages/obspy-0.8.4-py2.7-linux-x86_64.egg/obspy/iris/client.py”, line 217, in getWaveform
st = self.dataselect(**kwargs)
File “/usr/lib64/python2.7/site-packages/obspy-0.8.4-py2.7-linux-x86_64.egg/obspy/iris/client.py”, line 1050, in dataselect
raise Exception(msg)
Exception: No waveform data available (HTTPError: HTTP Error 404: Not Found)

Kasper

Hi Kasper,

there has been a massive restructuring of web services provided by IRIS.
If you need to request data from IRIS you will have to update your ObsPy
installation.

Currently you should use the release candidate version 0.9.0rc1, see
https://github.com/obspy/obspy/releases.

We are working hard on the final 0.9.0 release that will have all the
installer routines and Ubuntu/Debian packages and we hope to have it
ready within the next days/week.

Furthermore, obspy.iris.Client.getWaveform is not supported anymore
(although the low-level method obspy.iris.Client.timeseries is). See the
ObsPy developer snapshot documentation to see what methods should still
work
(http://docs.obspy.org/master/packages/autogen/obspy.iris.client.Client.html?highlight=shut%20down%20server%20side).

**In general, in the future, IRIS data should be requested using
obspy.fdsn.**

If you can install packages into your Python environment using pip
updating should be as easy as:
pip install https://github.com/obspy/obspy/archive/0.9.0rc1.tar.gz

In principle you could use the moved low-level "timeseries" service with
the "old" 0.8.4 obspy.iris client, but some changes to the URL structure
on the server side make this impossible. I do not recommend this, but if
updating is currently not an option you *could* make some minor
adaptions inside the code of your installed 0.8.4 obspy (I'll post
instructions at the end of the mail).

Long story short:
- update to 0.9.0rc1 if at all possible
- if this is not possible (or to bridge the time until the final 0.9.0
   release), for a quick and dirty fix, modify
   iris/client.py of your obspy installation and use "timeseries"
   method instead of "getWaveform".

hope it helps,
Tobias

P.S.: Here's how to modify an existing installation:
https://github.com/megies/obspy/commit/e826575cec461c98bc1b36765328893ad50f099e
The file, in your case, is in
/usr/lib64/python2.7/site-packages/obspy-0.8.4-py2.7-linux-x86_64.egg/obspy/iris/client.py

If you modify accordingly the following works to fetch data:
from obspy.iris import Client
dt = UTCDateTime("2005-01-01T00:00:00")
client = Client(debug=True)
st = client.timeseries("IU", "ANMO", "00", "BHZ", dt, dt+10)

It should print at some point:
Requesting
http://service.iris.edu/irisws/timeseries/1/query?network=IU&station=ANMO&location=00&starttime=2005-01-01T00%3A00%3A00.000&output=miniseed&endtime=2005-01-01T00%3A00%3A10.000&channel=BHZ