sbonaime / seedlink_plotter

Seedlink_plotter A python script to plot real time seismic data from a seedlink server
GNU Lesser General Public License v3.0
36 stars 19 forks source link

Plot events from seismicportal.eu #3

Closed megies closed 11 years ago

megies commented 11 years ago

adds an option to start another thread that fetches and updates event information fetched using obspy.neries to include in the plot

sbonaime commented 11 years ago

After few minutes of testing with two seedlink plotter on the same PC with --events 5 option, I see that on one of the plots, not all the events are visible. Behind the windows, I get this bug trace:

SLClient comes with ABSOLUTELY NO WARRANTY
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 530, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 483, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./seedlink_plotter.py", line 185, in run
    events = self.get_events()
  File "./seedlink_plotter.py", line 199, in get_events
    min_magnitude=self.args.events)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 82, in wrapper
    v = f(*args, **new_kwargs)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 280, in getEvents
    data = self._fetch("/services/event/search", **kwargs)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 162, in _fetch
    doc = response.read()
  File "/usr/lib64/python2.7/socket.py", line 349, in read
    data = self._sock.recv(rbufsize)
  File "/usr/lib64/python2.7/httplib.py", line 532, in read
    return self._read_chunked(amt)
  File "/usr/lib64/python2.7/httplib.py", line 590, in _read_chunked
    value.append(self._safe_read(chunk_left))
  File "/usr/lib64/python2.7/httplib.py", line 634, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/usr/lib64/python2.7/socket.py", line 378, in read
    data = self._sock.recv(left)
timeout: timed out

Do you have any idea ?

megies commented 11 years ago

My guess is that the request to seismicportal at one try timed out and due to the exception raised, the thread gets terminated. I'll make a pull request (#4) that tries to avoid this..