from urllib.request import URLError except ImportError: # Py2 from urllib2 import URLError import logging import numpy as np # ugly but simple Python 2/3 compat if sys.version_info.major < 3: range_func = xrange input_func = raw_input else: range_func = range input_func = input OBSPY_VERSION = [int(x) for x in OBSPY_VERSION.split(".")[:2]] # check obspy version and warn if it's below 0.10.0, which means that a memory # leak is present in the used seedlink client (unless working on some master # branch version after obspy/obspy@5ce975c3710ca, which is impossible to check # reliably). see #7 and obspy/obspy#918. # imports depend of the obspy version if OBSPY_VERSION < [0, 10]: warning_msg = ( "ObsPy version < 0.10.0 has a memory leak in SeedLink Client. " "Please update your ObsPy installation to avoid being affected by " "the memory leak (see " "https://github.com/bonaime/seedlink_plotter/issues/7).") warnings.warn(warning_msg) # Check if OBSPY_VERSION < 0.11 if OBSPY_VERSION < [0, 11]: # 0.10.x
from matplotlib.dates import date2num import matplotlib.pyplot as plt from obspy.core import UTCDateTime from obspy.core.event import Catalog from obspy.fdsn import Client from argparse import ArgumentParser from math import sin import threading import time import warnings import sys from urllib2 import URLError import logging import numpy as np OBSPY_VERSION = map(int, OBSPY_VERSION.split(".")[:2]) # check obspy version and warn if it's below 0.10.0, which means that a memory # leak is present in the used seedlink client (unless working on some master # branch version after obspy/obspy@5ce975c3710ca, which is impossible to check # reliably). see #7 and obspy/obspy#918. if OBSPY_VERSION < [0, 10]: msg = ("ObsPy version < 0.10.0 has a memory leak in SeedLink Client. " "Please update your ObsPy installation to avoid being affected " "by the memory leak (see " "https://github.com/bonaime/seedlink_plotter/issues/7).") warnings.warn(msg) class SeedlinkPlotter(Tkinter.Tk): """ This module plots realtime seismic data from a Seedlink server
from obspy import __version__ as OBSPY_VERSION from obspy.core import UTCDateTime from obspy.core.event import Catalog from argparse import ArgumentParser,ArgumentDefaultsHelpFormatter from math import sin import threading import time import warnings import os import sys from urllib2 import URLError import logging import numpy as np OBSPY_VERSION = map(int, OBSPY_VERSION.split(".")[:2]) # check obspy version and warn if it's below 0.10.0, which means that a memory # leak is present in the used seedlink client (unless working on some master # branch version after obspy/obspy@5ce975c3710ca, which is impossible to check # reliably). see #7 and obspy/obspy#918. # imports depend of the obspy version if OBSPY_VERSION < [0, 10]: warning_msg = ( "ObsPy version < 0.10.0 has a memory leak in SeedLink Client. " "Please update your ObsPy installation to avoid being affected by " "the memory leak (see " "https://github.com/bonaime/seedlink_plotter/issues/7).") warnings.warn(warning_msg) # Check if OBSPY_VERSION < 0.11 if OBSPY_VERSION < [0, 11]: # 0.10.x
# Py2 from urllib2 import URLError import logging import numpy as np # ugly but simple Python 2/3 compat if sys.version_info.major < 3: range_func = xrange input_func = raw_input else: range_func = range input_func = input OBSPY_VERSION = [int(x) for x in OBSPY_VERSION.split(".")[:2]] # check obspy version and warn if it's below 0.10.0, which means that a memory # leak is present in the used seedlink client (unless working on some master # branch version after obspy/obspy@5ce975c3710ca, which is impossible to check # reliably). see #7 and obspy/obspy#918. # imports depend of the obspy version if OBSPY_VERSION < [0, 10]: warning_msg = ( "ObsPy version < 0.10.0 has a memory leak in SeedLink Client. " "Please update your ObsPy installation to avoid being affected by " "the memory leak (see " "https://github.com/bonaime/seedlink_plotter/issues/7).") warnings.warn(warning_msg) # Check if OBSPY_VERSION < 0.11 if OBSPY_VERSION < [0, 11]: # 0.10.x