obspy.arclink

Hi,

I deploy an ArcLink server and it works when I use telnet. But it doesn’t work if I access ArcLink server by using obspy.arclink client class. There is no any message to display when I run the obspy.arclink.

Any idea?

Thanksm

Xiao

  1. Following is the procedures of using telnet. It works.

xiaowang@linux-5sog:~> telnet dh113045.esc.liv.ac.uk 18001

Trying 138.253.113.45…

Connected to dh113045.esc.liv.ac.uk.

Escape character is ‘^]’.

user xiao

OK

request waveform format=MSEED

OK

2010,04,06,00,00,00 2010,04,06,00,05,00 YF AGUA HHE

end

21

status 21

<?xml version="1.0"?>

END

bye

Connection closed by foreign host.

  1. Following is the file using obspy.arclink, but it doesn’t work:

from obspy.core import UTCDateTime

from obspy.arclink.client import Client

client = Client(“dh113045.esc.liv.ac.uk”, 18001)

start = UTCDateTime(“2010-04-06 00:03:00”)

st = client.getWaveform(‘YF’, ‘AGUA’, ‘’, ‘HHE’, start - 3, start + 15)

st.plot()

just dig log message from ArcLink server side and find a interesting thing:

I used st = client.getWaveform('YF', 'AGUA', '', 'HHE', start - 3, start + 15) to request waveform, but why the log message says "REQUEST ROUTING"?

Following is the log message from ArcLink server:

Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63707 : opening connection
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63708 : opening connection
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63707 : closing connection
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63708 : HELLO
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63708 : USER ObsPy client
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63708 : INSTITUTION Anonymous
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : opening connection
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63708 : closing connection
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : HELLO
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : USER ObsPy client
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : INSTITUTION Anonymous
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : REQUEST ROUTING
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : END
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : invalid request: STATUS
Mar 31 16:13:49 dh113045 arclink: 138.253.113.204:63709 : STATUS requires 1 argument
Mar 31 16:13:49 dh113045 arclink: [8073] STATUS LINE 0 PROCESSING routing
Mar 31 16:13:49 dh113045 arclink: [8073] STATUS LINE 0 OK
Mar 31 16:13:49 dh113045 arclink: [8073] STATUS VOLUME routing SIZE 392
Mar 31 16:13:49 dh113045 arclink: [8073] STATUS VOLUME routing OK
Mar 31 16:13:49 dh113045 arclink: [8073] END

Regards,

Xiao

Hi Xiao,

unfortunately I'm not able to run the example given below because the
ArcLink note dh113045.esc.liv.ac.uk:18001 is not public.

However, could you please initialize the obspy.arclink client with the
debug=True flag and send me the client output, the corresponding server
logs and the used ArcLink server version number - I will see what I can
do ...

Also, please make sure to use the latest developer version of the
ArcLink client - I fixed a few things in the last days but didn't had
time to create a new package yet.

Thanks + best,
Robert

Wang, Xiao schrieb:

Hi Xiao,

I have the feeling that it is a trivial problem:
Could you please try the Client initialization with "http://" in front
of the server name (like in the default for the kwarg "base_url")?

I.e.:
client = Client("http://dh113045.esc.liv.ac.uk", 18001)

best,
Tobias

Robert Barsch wrote:

Oh sorry, I mixed up the seishub and arclink clients. Please ignore the
previous mail.

best,
Tobias

Tobias Megies wrote:

Hi Robert,

unfortunately I'm not able to run the example given below because the
ArcLink note dh113045.esc.liv.ac.uk:18001 is not public.

Sorry, the dh113045.esc.liv.ac.uk is within the firewall.

However, could you please initialize the obspy.arclink client with the
debug=True flag and send me the client output, the corresponding server
logs and the used ArcLink server version number - I will see what I can
do ...

1. Please see the obspy.client file:

xiaowang@linux-5sog:~/Develop-Code/code-test/obspy-test> more obspy-liv-arclink.py
from obspy.core import UTCDateTime
from obspy.arclink.client import Client
client = Client(host="dh113045.esc.liv.ac.uk", port=18001, debug=True)
start = UTCDateTime("2010-04-06 00:03:00")
st = client.getWaveform('YF', 'AGUA', '', 'HHE', start - 3, start + 15)
st.plot()

2. please see the debug message:

xiaowang@linux-5sog:~/Develop-Code/code-test/obspy-test> python obspy-liv-arclink.py

HELLO

... ArcLink v1.2 (2010.256)
... SeisLiv

USER ObsPy client

... OK

INSTITUTION Anonymous

... OK

REQUEST ROUTING
2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA
END

... OK

STATUS

... ERROR
...
...
...
^Z
[3]+ Stopped python obspy-liv-arclink.py

3. please see the ArcLink server log message:

Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60052 : opening connection
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60053 : opening connection
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60052 : closing connection
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60053 : HELLO
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60053 : USER ObsPy client
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60053 : INSTITUTION Anonymous
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : opening connection
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60053 : closing connection
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : HELLO
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : USER ObsPy client
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : INSTITUTION Anonymous
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : REQUEST ROUTING
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : END
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : invalid request: STATUS
Apr 1 10:48:44 dh113045 arclink: 138.253.113.204:60054 : STATUS requires 1 argument
Apr 1 10:48:44 dh113045 arclink: [7860] STATUS LINE 0 PROCESSING routing
Apr 1 10:48:44 dh113045 arclink: [7860] STATUS LINE 0 OK
Apr 1 10:48:44 dh113045 arclink: [7860] STATUS VOLUME routing SIZE 392
Apr 1 10:48:44 dh113045 arclink: [7860] STATUS VOLUME routing OK
Apr 1 10:48:44 dh113045 arclink: [7860] END
Apr 1 10:48:58 dh113045 dhclient: XMT: Solicit on eth0, interval 120220ms.

4. please see the ArcLink server version:

xiao@dh113045:~/seiscomp3/arclink/bin> ./arclink -V
ArcLink v1.2 (2010.256)

Thanks + best,

Regards,

Xiao

Hi Xiao,

seems like you use a very recent version of the ArcLink server which is
a bit more restrictive using a STATUS request without a status id - old
notes such as our version 1.1 note in Munich return on a plain STATUS
request the status id - version 1.2 quits with an error.

I'm going to fix that and report back to you.

Cheers,
Robert

- --

Dr. Robert Barsch
Department of Earth and Environmental Sciences, Geophysics
LMU Munich
Theresienstr. 41/IV
D-80333 Munich
Germany

Tel: +49 (0) 89 2180 4201
Fax: +49 (0) 89 2180 9942010
Mail: barsch@lmu.de

Dear Xiao,

the issue should be fixed within the latest obspy.arclink revision -
please report back of there are still problems.

Thanks + best,
Robert

- --

Dr. Robert Barsch
Department of Earth and Environmental Sciences, Geophysics
LMU Munich
Theresienstr. 41/IV
D-80333 Munich
Germany

Tel: +49 (0) 89 2180 4201
Fax: +49 (0) 89 2180 9942010
Mail: barsch@lmu.de

Hi Robert,

Thanks to fix it.

Can the updated code be checked out from https://svn.obspy.org?

I checked out from the above link, but failed to install. Please see the following message when I install it:

linux-5sog:/home/xiao/updated-obspy/obspy # /usr/lib/python/site-packages/easy_install -N -d /usr/lib/python/site-packages/ obspy.arclink
Searching for obspy.arclink
Best match: obspy.arclink 0.4.5.dev-r2079
Processing obspy.arclink-0.4.5.dev_r2079-py2.6.egg
obspy.arclink 0.4.5.dev-r2079 is already the active version in easy-install.pth

Using /usr/lib/python2.6/site-packages/obspy.arclink-0.4.5.dev_r2079-py2.6.egg

Regards,

Xiao

Hi Xiao,

add option "-U" to update an already installed package and you also have
to specify version "==dev" to get the latest developer revision.
See http://obspy.org/wiki/InstallationInstructions:

easy_install -N -U obspy.arclink==dev -d ...

..should do the trick.

best,
Tobias

Wang, Xiao wrote:

I did a try, but it still request routing, not request waveform.

Any idea?

Xiao

Here is my obspy.client file:

xiao@linux-5sog:~/Develop-Code/code-test/obspy-test> more obspy-liv-arclink.py
from obspy.core import UTCDateTime
from obspy.arclink.client import Client

client = Client(host="dh113045.esc.liv.ac.uk", port=18001, debug=True)
start = UTCDateTime("2010-04-06 00:03:00")
st = client.getWaveform('YF', 'AGUA', '', 'HHE', start - 3, start + 15)
st.plot()

here is the output message:

xiao@linux-5sog:~/Develop-Code/code-test/obspy-test> python obspy-liv-arclink.py

Connected to dh113045.esc.liv.ac.uk:18001

HELLO

... ArcLink v1.2 (2010.256)
... SeisLiv

USER ObsPy client

... OK

INSTITUTION Anonymous

... OK

REQUEST ROUTING

... OK

2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA
END

... 43

STATUS 43

... <?xml version="1.0"?>
<arclink>
  <request id="43" type="ROUTING" label="" args="" size="0" ready="false" error="false" message="">
    <volume id="UNSET" status="UNSET" size="0" message="">
      <line content="2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA" status="UNSET" size="0" message=""/>
    </volume>
  </request>
</arclink>
END

STATUS 43

... <?xml version="1.0"?>
<arclink>
  <request id="43" type="ROUTING" label="" args="" size="0" ready="false" error="false" message="">
    <volume id="routing" status="PROCESSING" size="0" message="">
      <line content="2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA" status="PROCESSING" size="0" message=""/>
    </volume>
  </request>
</arclink>
END

STATUS 43

... <?xml version="1.0"?>
<arclink>
  <request id="43" type="ROUTING" label="" args="" size="0" ready="false" error="false" message="">
    <volume id="routing" status="PROCESSING" size="0" message="">
      <line content="2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA" status="PROCESSING" size="0" message=""/>
    </volume>
  </request>
</arclink>
END

STATUS 43

... <?xml version="1.0"?>
<arclink>
  <request id="43" type="ROUTING" label="" args="" size="0" ready="false" error="false" message="">
    <volume id="routing" status="PROCESSING" size="0" message="">
      <line content="2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA" status="PROCESSING" size="0" message=""/>
    </volume>
  </request>
</arclink>
END

STATUS 43

... <?xml version="1.0"?>
<arclink>
  <request id="43" type="ROUTING" label="" args="" size="392" ready="true" error="false" message="">
    <volume id="routing" status="OK" size="392" message="">
      <line content="2010,4,6,0,2,56,0 2010,4,6,0,3,16,0 YF AGUA" status="OK" size="0" message=""/>
    </volume>
  </request>
</arclink>
END

DOWNLOAD 43

<?xml version="1.0" encoding="utf-8"?>
<ns0:routing xmlns:ns0="http://geofon.gfz-potsdam.de/ns/Routing/1.0/&quot;&gt;
        <ns0:route locationCode="" networkCode="YF" publicID="Route/YF///" stationCode="" streamCode="">
                <ns0:arclink address="localhost:18001" end="" priority="1" start="1980-01-01T00:00:00.0000Z" />
                <ns0:seedlink address="localhost:18000" priority="1" />
        </ns0:route>
</ns0:routing>

PURGE 43
BYE

Requesting localhost:18001
Traceback (most recent call last):
  File "obspy-liv-arclink.py", line 6, in <module>
    st = client.getWaveform('YF', 'AGUA', '', 'HHE', start - 3, start + 15)
  File "/usr/lib/python2.6/site-packages/obspy.core-0.4.5.dev_r2095-py2.6.egg/obspy/core/util.py", line 427, in echo_func
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/obspy.arclink-0.4.6.dev_r2311-py2.6.egg/obspy/arclink/client.py", line 321, in getWaveform
    endtime, format=format, compressed=compressed)
  File "/usr/lib/python2.6/site-packages/obspy.core-0.4.5.dev_r2095-py2.6.egg/obspy/core/util.py", line 427, in echo_func
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/obspy.arclink-0.4.6.dev_r2311-py2.6.egg/obspy/arclink/client.py", line 405, in saveWaveform
    data = self._fetch(rtype, rdata)
  File "/usr/lib/python2.6/site-packages/obspy.arclink-0.4.6.dev_r2311-py2.6.egg/obspy/arclink/client.py", line 177, in _fetch
    self.open(self.host, self.port, self.timeout)
  File "/usr/lib/python2.6/telnetlib.py", line 225, in open
    self.sock = socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.6/socket.py", line 514, in create_connection
    raise error, msg
socket.error: [Errno 111] Connection refused

figured out the problem: reconfigure arclink server from localhost to real hostname. So it looks working and I can display waveform.

Regards,

Xiao