Problems reading from local earthworm server

Hi folks
I’m running into problems when trying to access data from a local earthworm server. The code I’m trying to execute is:

client = Client(“isdp01.wr.usgs.gov”,16022)

ew_resp = client.availability(network=‘GS’,station=‘DEC01’,channel=‘DP*’)

t1 = UTCDateTime(2014,1,22,0,0)

t2 = UTCDateTime(2014,1,23,0,0)

st = client.getWaveform(network=‘GS’,station=‘DEC01’,location=‘02’,

channel=‘DP*’, starttime=t1, endtime=t2 )

I get the following error:

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/client.py”, line 105, in getWaveform

cleanup=cleanup)

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/client.py”, line 112, in getWaveform

timeout=self.timeout)

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/waveserver.py”, line 256, in readWaveServerV

print(msg % (flag, RETURNFLAG_KEY[flag]))

KeyError: ‘02’

waverserver.py seems to have problems getting the location code right. Not sure why this is a problem, but any help would be greatly appreciated. I’m running python 3.4 with obey 10.2 on mac installed using home-brew/pip3.

Thanks in advance,
Ole

Hi Ole,

the server you're using is intranet it seems, so it's not possible to
check your actual request. I suspect that your request is beyond the
timespan served by the server (18 months).
The error message is wrong, of course. That it shows the location code
is wrong, it should show the error flag returned by the server, see
#1109 (https://github.com/obspy/obspy/issues/1109).

Can you try the same request with e.g. 1 day old data?

best,
Tobias

Hi Tobias
Thanks for the quick response. I ran the same request with one day of more recent data and added available data/location code rather than prescribing it:

client = Client(“isdp01.wr.usgs.gov”,16022)

ew_resp = client.availability(network=‘GS’,station=‘DEC01’,channel=‘DP*’)

t1 = UTCDateTime(2015,7,22,0,0)

t2 = UTCDateTime(2015,7,23,0,0)

#try:

st = client.getWaveform(network=‘GS’,station=‘DEC01’,location=ew_resp[0][2],

channel=‘DP*’, starttime=t1, endtime=t2 )

I get the same error,

Traceback (most recent call last):

File “/Users/okaven/research/relocation/python/decatur_stack_spec_v01.py”, line 25, in

channel=‘DP*’, starttime=t1, endtime=t2 )

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/client.py”, line 105, in getWaveform

cleanup=cleanup)

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/client.py”, line 112, in getWaveform

timeout=self.timeout)

File “/usr/local/lib/python3.4/site-packages/obspy/earthworm/waveserver.py”, line 256, in readWaveServerV

print(msg % (flag, RETURNFLAG_KEY[flag]))

KeyError: ‘02’

and the strange part is that it returns the right location code (‘02’) but won’t accept it when requesting the waveforms. As you said, something may mess up the return of the correct flags in earthworm proper (as described in #1109).

I hope @seismopaul knows a fix and I’ll inquire with colleagues here also.

Thanks again,
Ole

Hi all
I inquired with Victor Kress who initially wrote the obspy-specific wrapper to read from earthworm. He pointed out that wildcards aren’t handled properly. The earthworm.getWaveform function works for the same commands as before with a specified channel:

st = client.getWaveform(network=‘GS’,station=‘DEC01’,location=ew_resp[0][2],

channel=‘DP1’, starttime=t1, endtime=t2 )

instead of:

st = client.getWaveform(network=‘GS’,station=‘DEC01’,location=ew_resp[0][2],

channel=‘DP*’, starttime=t1, endtime=t2 )

It’s easy enough to get around this complication, but nevertheless good to know what works and what doesn’t.

Best,
Ole

Hi,

Small clarification: I wrote the core waveserver reader but not the wrapper that streamlines and standardizes the interface with obspy (including wildcard handling). I did look at this a while ago and concluded that the wildcard handling was specific to E, H, Z and wouldn't handle 1,2,3 etc. I think I remember some other issues with the wildcard, but that is a discussion for the dev group. For now be suspicious of wildcards but they should work fine for E, H Z stations.

-Victor