ValueError: The current client does not have a dataselect service

I’m a new beginner in learning Obspy, and recently I’ve faced some troubles.
I try to download data from IRIS, but the error shows that the current client does not have a dataselect service. And I don’t know what to do next, is there any solution to solve this problem?


my code:
from obspy.clients.fdsn import Client
client = Client(‘IRIS’)
from obspy import UTCDateTime
starttime = UTCDateTime(‘2016-07-01T00:00:00’)
endtime = UTCDateTime(‘2016-07-15T00:00:00’)
net = “OO”
sta = ‘HYS11’
loc = ‘–’
chan = ‘SHZ’
st = client.get_waveforms(net, sta, loc, chan, starttime, endtime)
print(st)
st.plot()

result:
Traceback (most recent call last):
File “/Users/kuyie/test1.py”, line 21, in
st = client.get_waveforms(net, sta, loc, chan, starttime, endtime)
File “/Users/kuyie/opt/anaconda3/lib/python3.8/site-packages/obspy/clients/fdsn/client.py”, line 830, in get_waveforms
raise ValueError(msg)
ValueError: The current client does not have a dataselect service.

Your prompt and favorable attention to my question would be highly appreciated.

Managed to download a 1-minute sample of the data with the following code:

from obspy.clients.fdsn import Client
client = Client('IRIS')
from obspy import UTCDateTime
starttime = UTCDateTime('2016-07-01T00:00:00')
endtime = UTCDateTime('2016-07-01T00:01:00')
net = 'OO'
sta = 'HYS11'
loc = ''
chan = 'SHZ'
st = client.get_waveforms(net, sta, loc, chan, starttime, endtime)
print(st)
st.plot()

Changes to your initial script include:

  1. Swapped the and quotes with ' ones - however this might be a problem only on my end.
  2. Changed the endtime value to a minute after starttime (this was done purely for running the code faster).
  3. Corrected the value of loc - from my experience, you either specify a 2-digit location code (e.g. 00, 01) or leave it blank (i.e. ''). Using either - or -- won’t work (even though you might see the latter used instead of blanks in some metadata files). In your case, the location code is blank!

However, I could not replicate your initial issue (and IRIS most certainly has a dataselect service!). The error I was getting from your initial script (aside from the strange quotes) was due to the wrong location code (i.e. I was getting the following error: FDSNNoDataException: No data available for request.).

As a tip, I’d suggest to not try and download such long periods of data (15 days) with get_waveforms from any service, as there are data size restrictions. You might want to split the requests to shorter periods (e.g. daily) or use the get_waveforms_bulk function (see here).

Thanks for your reply! Actually the problem was solved after I had restarted my computer.

If you get this from a FDSN server you know has the respective service, then it’s usually a transient network issue.
Related is also this github ticket, in future releases service discovery will use a proper default or user set timeout, not a hardcoded value of 10 seconds.

@LyuZinan actually, that PR is already in ObsPy version 1.2.2. Which version are you running? With that fix merged such errors should really be very rare and only happen with significant network problems.