Obspy.iris - issues with "sacpz" and "resp"

Hi all,

Using the obspy.iris Client I can get waveform data ok, and can also get
response info using client.saveResponse ( for both resp and sacpz formats ).

However if I use client.sacpz or client.resp then the same request fails - does anyone have any idea why ??

I think I’m using the latest available obspy.iris ( obspy.iris-0.5.0.dev_r3200 )

My code is as follows :

if name == ‘main’:

client = Client()

t1 = UTCDateTime(2002, 11, 3, 22, 20, 00, 000000)
t2 = UTCDateTime(2002, 11, 3, 22, 30, 00, 000000)
tr = client.getWaveform(“UW”,“LON”,’’,“BHZ”,t1,t2)

The above line works fine

t1 = UTCDateTime(“2002-11-01”)
t2 = UTCDateTime(“2003-01-01”)

available = client.availability(network=‘UW’,station=‘LON’,location=’’,channel=‘BHZ’,starttime=t1,endtime=t2)
print(available)

The above request works fine

outresp = ‘uw-lon.resp’
outsacpz = ‘uw-lon.sacpz’
client.saveResponse(outresp,network=‘UW’,station=‘LON’,location=’’,channel=‘BHZ’,starttime=t1,endtime=t2,format=“RESP”)
client.saveResponse(outsacpz,network=‘UW’,station=‘LON’,location=’’,channel=‘BHZ’,starttime=t1,endtime=t2,format=“SACPZ”)

The above two lines work fine

sacpz = client.sacpz(network=‘UW’,station=‘LON’,location=’’,channel=‘BHZ’,starttime=t1,endtime=t2)
print(sacpz)

The above client.sacpz fails, as does a similar client.resp request

Output & Error message from the ‘client.sacpz’ request is as follows :

UW LON – BHZ 2002-11-01T00:00:00 2003-01-01T00:00:00

Traceback (most recent call last):
File “get_LON_example.py”, line 86, in
sacpz = client.sacpz(network=‘UW’,station=‘LON’,location=’’,channel=‘BHZ’,starttime=t1,endtime=t2)
File “/sp/prj/tvz95/mypython/lib/python2.6/site-packages/obspy.iris-0.5.0.dev_r3200-py2.6.egg/obspy/iris/client.py”, line 931, in sacpz
data = self._fetch(url, **kwargs)
File “/sp/prj/tvz95/mypython/lib/python2.6/site-packages/obspy.iris-0.5.0.dev_r3200-py2.6.egg/obspy/iris/client.py”, line 114, in _fetch
response = urllib2.urlopen(req, timeout=self.timeout)
File “/usr/lib64/python2.6/urllib2.py”, line 124, in urlopen
return _opener.open(url, data, timeout)
File “/usr/lib64/python2.6/urllib2.py”, line 395, in open
response = meth(req, response)
File “/usr/lib64/python2.6/urllib2.py”, line 508, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib64/python2.6/urllib2.py”, line 433, in error
return self._call_chain(*args)
File “/usr/lib64/python2.6/urllib2.py”, line 367, in _call_chain
result = func(*args)
File “/usr/lib64/python2.6/urllib2.py”, line 516, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

thanks in advance,

Stephen

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.

Hi Stephen,

its a bug in the currently released version of obspy.iris - an empty
location code has to be replaced with a '--' to be understandable from
the IRIS Web service.

For now the following should work:

client = Client()
t1 = UTCDateTime("2002-11-01")
t2 = UTCDateTime("2003-01-01")
client.sacpz(network='UW',station='LON',location='--',channel='BHZ',starttime=t1,endtime=t2)

Thanks for reporting! I'll fix it later today. We hope to release
newer versions of most modules within the next days. The module
obspy.iris will be one of those.

Cheers,
Robert

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: admin@egu.eu