def testGlobalCMT(self): def is_the_haiti_event(ev): assert near(ev.magnitude, 7.0, 0.1) assert near(ev.lat, 18.61, 0.01) assert near(ev.lon, -72.62, 0.01) assert near(ev.depth, 12000., 1.) assert ev.region.lower() == 'haiti region' cat = catalog.GlobalCMT() tmin = util.ctimegm('2010-01-12 21:50:00') tmax = util.ctimegm('2010-01-13 03:17:00') names = cat.get_event_names(time_range=(tmin, tmax), magmin=5.) ident = None for name in names: ev = cat.get_event(name) if ev.magnitude > 7: is_the_haiti_event(ev) ident = ev.name assert ident is not None cat.flush() ev = cat.get_event(ident) is_the_haiti_event(ev)
def setup(self): self.catalogs = { 'Geofon': catalog.Geofon(), 'USGS/NEIC PDE': catalog.USGS('pde'), 'USGS/NEIC US': catalog.USGS('us'), 'Global-CMT': catalog.GlobalCMT(), 'Kinherd': catalog.Kinherd(), } catkeys = sorted(self.catalogs.keys()) self.set_name('Catalog Search') self.add_parameter(Choice('Catalog', 'catalog', catkeys[0], catkeys)) self.add_parameter(Param('Min Magnitude', 'magmin', 0, 0, 10)) self.set_live_update(False)
def search_catalog(date, min_magnitude, dayrange=1.): """ Search the gcmt catalog for the specified date (+- 1 day), filtering the events with given magnitude threshold. Parameters ---------- date : str 'YYYY-MM-DD', date of the event min_magnitude : float approximate minimum Mw of the event dayrange : float temporal search interval [days] around date Returns ------- event : :class:`pyrocko.model.Event` """ gcmt = catalog.GlobalCMT() time_s = util.stt(date + ' ' + seconds_str) d1 = time_s - (dayrange * (sphr * hrpd)) d2 = time_s + (dayrange * (sphr * hrpd)) logger.info('Getting relevant events from the gCMT catalog for the dates:' '%s - %s \n' % (util.tts(d1), util.tts(d2))) events = gcmt.get_events((d1, d2), magmin=min_magnitude) if len(events) < 1: logger.warn('Found no event information in the gCMT catalog.') event = None if len(events) > 1: logger.info( 'More than one event from that date with specified magnitude ' 'found! Please copy the relevant event information to the ' 'configuration file!') for event in events: print event event = events[0] elif len(events) == 1: event = events[0] return event
import numpy as num from pyrocko import trace, util, io, cake, catalog, automap, pile, model from pyrocko import orthodrome, weeding from pyrocko.client import fdsn from pyrocko.io import resp, enhanced_sacpz as epz, stationxml from beat import utility from beat import heart km = 1000. g_sites_available = sorted(fdsn.g_site_abbr.keys()) geofon = catalog.Geofon() usgs = catalog.USGS(catalog=None) gcmt = catalog.GlobalCMT() tfade_factor = 1.0 ffade_factors = 0.5, 1.5 fdsn.g_timeout = 60. class starfill(object): def __getitem__(self, k): return '*' def nice_seconds_floor(s): nice = [ 1., 10., 60., 600., 3600., 3. * 3600., 12 * 3600., 24 * 3600.,
def GCMT(searchparameter): cat = catalog.GlobalCMT() getevents(searchparameter, cat)