示例#1
0
文件: data.py 项目: chaoshunh/pinky
    def iter_chunked(self, tinc):
        tr_len = self.n_samples * self.deltat_want
        nslc_to_index = self.nslc_to_index

        tpad = self.config.effective_tpad

        tstart = util.stt(self.tstart) if self.tstart else None
        tstop = util.stt(self.tstop) if self.tstop else None

        logger.debug('START')
        for trs in self.data_pile.chopper(
                tinc=tinc, tmin=tstart, tmax=tstop, tpad=tpad,
                keep_current_files_open=True, want_incomplete=False,
                trace_selector=self.reject_blacklisted):

            chunk = self.get_raw_data_chunk(self.tensor_shape)

            if not trs:
                yield chunk, UNLABELED
                continue

            for tr in trs:
                self.preprocess(tr)

            indices = [nslc_to_index[tr.nslc_id] for tr in trs]
            self.fit_data_into_chunk(trs, chunk=chunk, indices=indices,
                    tref=trs[0].tmin)

            if all_NAN(chunk):
                logger.debug('all NAN. skipping...')
                continue

            yield chunk, UNLABELED
示例#2
0
 def lessThan(self, left, right):
     if left.column() == _column_mapping['Time']:
         return util.stt(str(left.data().toString())) > \
             util.stt(str(right.data().toString()))
     elif left.column() == _column_mapping['Label']:
         return left > right
     else:
         return left.data().toDouble()[0] > right.data().toDouble()[0]
示例#3
0
 def lessThan(self, left, right):
     if left.column() == _column_mapping['Time']:
         return util.stt(str(left.data().toString())) > \
             util.stt(str(right.data().toString()))
     elif left.column() == _column_mapping['Label']:
         return left > right
     else:
         return left.data().toDouble()[0] > right.data().toDouble()[0]
    def benchmark_stt_tts(self):
        for x in range(2):
            if x == 1:
                util.util_ext = None
            t = util.str_to_time('1999-03-20 20:10:10')
            tt1 = time.time()
            for i in range(10000):
                s = util.tts(t)
                util.stt(s)

            tt2 = time.time()
            print(tt2 - tt1)
示例#5
0
    def benchmark_stt_tts(self):
        for x in xrange(2):
            if x == 1:
                util.util_ext = None
            t = util.str_to_time('1999-03-20 20:10:10')
            tt1 = time.time()
            for i in xrange(10000):
                s = util.tts(t)
                util.stt(s)

            tt2 = time.time()
            print tt2 - tt1
示例#6
0
    def testISC(self):
        cat = catalog.ISC()
        tmin = util.stt('2009-02-22 05:00:00')
        tmax = util.stt('2009-02-22 19:00:00')
        cat.get_events((tmin, tmax), magmin=5)

        markers = cat.get_phase_markers(
            (tmin, tmax), phases=['XXX'], station_codes=['XXXXX', 'YYYYY'])

        self.assertEqual(len(markers), 0)

        markers = cat.get_phase_markers(
            (tmin, tmax), phases=['P', 'PcP'], station_codes=['WRA'])

        self.assertEqual(len(markers), 75)
示例#7
0
    def testISC(self):
        cat = catalog.ISC()
        tmin = util.stt('2009-02-22 05:00:00')
        tmax = util.stt('2009-02-22 19:00:00')
        cat.get_events((tmin, tmax), magmin=5)

        markers = cat.get_phase_markers(
            (tmin, tmax), phases=['XXX'], station_codes=['XXXXX', 'YYYYY'])

        self.assertEqual(len(markers), 0)

        markers = cat.get_phase_markers(
            (tmin, tmax), phases=['P', 'PcP'], station_codes=['WRA'])

        self.assertEqual(len(markers), 76)
示例#8
0
    def test_leapsecond(self):
        fns = map(common.test_data_file, ['leapsecond_dec.cube',
                                          'leapsecond_jan.cube'])

        trs = defaultdict(list)
        for fn in fns:
            for tr in datacube.iload(fn):
                trs[tr.channel].append(tr)

        for cha in trs.keys():
            tra, trb, trc = trs[cha]
            assert abs(
                tra.tmax - (util.stt('2017-01-01 00:00:01') - tra.deltat)) \
                < tra.deltat * 0.001
            assert abs(
                trb.tmin - util.stt('2017-01-01 00:00:00')) \
                < trb.deltat * 0.001
示例#9
0
def gen_real_stations(tmin=util.stt('2014-01-01 16:10:00.000'),
                      tmax=util.stt('2014-01-01 16:39:59.000')):

    stations = []
    selection = [
        ('*', '*', '*', 'BH*', tmin, tmax),
    ]
    request_response = ws.station(site='iris',
                                  selection=selection,
                                  level='response')

    request_response.dump_xml(filename='stations.xml')
    sx = fs.load_xml(filename='stations.xml')

    for station in sx.get_pyrocko_stations():
        stations.append(station)

    return stations
示例#10
0
    def test_read(self):

        fpath = common.test_data_file('test.quakeml')
        qml = quakeml.QuakeML.load_xml(filename=fpath)
        events = qml.get_pyrocko_events()
        assert len(events) == 1
        e = events[0]
        assert e.lon == -116.9945
        assert e.lat == 33.986
        assert e.depth == 17300
        assert e.time == util.stt("1999-04-02 17:05:10.500")
示例#11
0
def supply(watch_folder,
           tmin,
           tmax,
           seiger=True,
           selection=None,
           duration=3,
           package_length=86400,
           providers=["bgr", "http://ws.gpi.kit.edu"],
           clean=True):

    try:
        tmin = util.stt(tmin)
        tmax = util.stt(tmax)
    except:
        pass
    iter = 0
    vorhalten = True
    while vorhalten is True:
        timemod.sleep(5)
        totalDir = 0
        for base, dirs, files in os.walk(watch_folder):
            for directories in dirs:
                totalDir += 1

        if totalDir < duration:
            twin_start = tmin + iter * package_length
            twin_end = tmin + package_length + iter * package_length
            download_raw(watch_folder,
                         twin_start,
                         twin_end,
                         seiger=seiger,
                         selection=selection,
                         providers=providers,
                         clean=clean)
            iter = iter + 1

        if twin_start > tmax:
            vorhalten = False
示例#12
0
def find_station(name, tmin=None, tmax=None):
    if tmin and tmax is None:
        tmin = util.stt('2013-10-23 21:06:54.400')
        tmax = util.stt('2013-10-23 21:11:59.000')

    selection = [('*', name, '*', '*', tmin, tmax)]

    sites = [
        "bgr", "http://192.168.11.220:8080", "http://gpiseisgate.gpi.kit.edu",
        "geofon", "iris", "orfeus", "koeri", "ethz", "lmu", "resif", "geonet",
        "ingv"
    ]
    for site in sites:
        try:
            request_response = fdsn.station(site='%s' % site,
                                            selection=selection,
                                            level='response')
            pyrocko_stations = request_response.get_pyrocko_stations()
            stations_hyposat.append(pyrocko_stations[0])
            stations_inversion.append(pyrocko_stations[0])
            st = pyrocko_stations[0]
            return st.lat, st.lon
        except Exception:
            return False
示例#13
0
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
示例#14
0
文件: data.py 项目: chaoshunh/pinky
 def tstart_data(self):
     '''Returns start point of data returned by generator.'''
     return util.stt(self.tstart) if self.tstart else self.data_pile.tmin
示例#15
0
def download_raw(path,
                 tmint,
                 tmaxt,
                 seiger=True,
                 selection=None,
                 providers=["bgr", "http://ws.gpi.kit.edu"],
                 clean=True,
                 detector=False,
                 common_f=80,
                 tinc=None):
    try:
        tmin = util.stt(tmint)
        tmax = util.stt(tmaxt)
    except:
        tmin = tmint
        tmax = tmaxt
    util.ensuredir(path + "/downloads")
    for provider in providers:
        if clean is True and detector is True:
            subprocess.run(['rm -r %s*' % (path + '/downloads/')], shell=True)
        if seiger is True:
            selection = get_seiger_stations(tmin, tmax)

        request_waveform = fdsn.dataselect(site=provider, selection=selection)
        # write the incoming data stream to 'traces.mseed'
        if provider == "http://ws.gpi.kit.edu":
            provider = "kit"
        if provider == "http://192.168.11.220:8080":
            provider = "bgr"
        download_basepath = os.path.join(path, "traces_%s.mseed" % provider)

        with open(download_basepath, 'wb') as file:
            file.write(request_waveform.read())

        traces = io.load(download_basepath)
        if common_f is not None:
            for tr in traces:
                if tr.deltat != common_f:
                    tr.downsample_to(1 / common_f)
                    tr.ydata = tr.ydata.astype(num.int32)
        if detector is True:
            for tr in traces:
                tr.chop(tmin, tmax)
                date_min = get_time_format_eq(tr.tmin)
                date_max = get_time_format_eq(tr.tmax)
                io.save(
                    tr, "%sdownloads/%s/%s.%s..%s__%s__%s.mseed" %
                    (path, tr.station, tr.network, tr.station, tr.channel,
                     date_min, date_max))
        else:
            util.ensuredir("%s/downloads/" % path)
            window_start = traces[0].tmin
            window_end = traces[0].tmax
            timestring = util.time_to_str(window_start, format='%Y-%m')
            io.save(
                traces, "%s/%s/%s_%s_%s.mseed" %
                (path, timestring, provider, tmin, tmax))
    if clean is True:
        for provider in providers:
            if provider == "http://192.168.11.220:8080":
                provider = "bgr"
            if provider == "http://ws.gpi.kit.edu":
                provider = "kit"
            subprocess.run(
                ['rm -r %s*' % (path + '/traces_%s.mseed' % provider)],
                shell=True,
                stdout=DEVNULL,
                stderr=STDOUT)
示例#16
0
def load_data_archieve(validation_data,
                       gf_freq,
                       duration=4,
                       wanted_start=None,
                       wanted_end=None):
    folder = validation_data
    pathlist = Path(folder).glob('day*')
    waveforms = []
    stations = []
    if wanted_start is not None:
        try:
            wanted_start = util.stt(wanted_start)
            wanted_end = util.stt(wanted_end)
        except:
            pass

    from pyrocko import pile
    paths = []
    safecon = 0
    for path in sorted(pathlist):
        path = str(path)
        d2 = float(str(path)[-12:])
        d1 = float(str(path)[-25:-13])
        if wanted_start is not None:
            do_safety_files = False
            if (d1 >= wanted_start
                    and d2 <= wanted_end) or (d2 - wanted_end < 86400.
                                              and d2 - wanted_end > 0.
                                              and safecon == 0):
                st = model.load_stations(path + "/waveforms/stations.raw.txt")

                d_diff = d2 - d1
                tr_packages = int(d_diff / duration)
                #for tr in traces:
                #    tr.downsample_to(gf_freq)
                #        if safecon == 0:

                pathlist_waveform_files = Path(path + "/waveforms/rest/").glob(
                    '*.mseed')
                wanted_start_str = util.tts(wanted_start)[14:16]
                diff_to_full = float(wanted_start_str)
                max_diff = 55.
                min_diff = 5.
                if diff_to_full > max_diff or diff_to_full < min_diff:
                    do_safety_files = True
                for path_wave in sorted(pathlist_waveform_files):
                    path_wave = str(path_wave)
                    p1 = path_wave[-25:-15]
                    p2 = path_wave[-14:-12]
                    p3 = path_wave[-11:-9]
                    p4 = path_wave[-8:-6]
                    try:
                        file_time = util.stt(p1 + " " + p2 + ":" + p3 + ":" +
                                             p4)
                        tdiff = file_time - wanted_start
                        if do_safety_files is True:
                            if float(p2) - float(
                                    util.tts(wanted_start)[11:13]) == 0:
                                paths.append(str(path_wave))
                            if diff_to_full > max_diff and float(p2) - float(
                                    util.tts(wanted_start)[11:13]) == 1.:
                                paths.append(str(path_wave))
                            if diff_to_full < min_diff and float(p2) - float(
                                    util.tts(wanted_start)[11:13]) == -1.:
                                paths.append(str(path_wave))

                        else:
                            if float(p2) - float(
                                    util.tts(wanted_start)[11:13]) == 0:
                                paths.append(str(path_wave))
                    except:
                        pass

                safecon += 1

    p = pile.make_pile(paths)
    for traces in p.chopper(tmin=wanted_start, tinc=duration):
        if traces:
            if traces[0].tmax < wanted_end:
                #    for i in range(0, tr_packages):
                #        traces = traces
                #for tr in traces:
                #    tr.chop(tr.tmin+i*duration,
                #            tr.tmin+i*duration+duration)
                #tr.downsample_to(gf_freq)
                waveforms.append(traces)
                stations.append(st)
    #    else:
    #        traces = io.load(path+"/waveforms/rest/traces.mseed")
    #        st = model.load_stations(path+"/waveforms/stations.raw.txt")
    #        for tr in traces:
    #            tr.downsample_to(gf_freq)
    #        waveforms.append(traces)
    #        stations.append(st)
    return waveforms, stations
def locsat2pyrocko(fname):
    f = open(fname, "r")
    file = f.readlines()
    events = []
    events_data = []
    events_list = []
    phase_markers = []
    events = []
    events_data = []
    phase_markers_all_events = []
    phase = None
    depth = None
    component = None
    for line in file:
        component = None
        idx = line.find("Event ID               :")
        if idx != -1:
            idx = line.find(":")
            event_id = line[idx + 1:]
            if event_id in events:
                idx_event = events.index(event_id)
                phase_markers = phase_markers_all_events[idx_event]
            else:
                phase_markers = []
                events.append(event_id)

        idx = line.find("Station code           :")
        if idx != -1:
            idx = line.find(":")

            station = line[idx + 1:]
        idx = line.find("Phase name             :")
        if idx != -1:
            idx = line.find(":")
            phase = line[idx + 1:]
        idx = line.find("Component              :")
        if idx != -1:
            idx = line.find(":")
            component = line[idx + 1:]
        idx = line.find("Magnitude ml           :")
        if idx != -1:
            idx = line.find(":")
            ml = line[idx + 1:]
        idx = line.find("Onset time             :")
        if idx != -1:
            idx = line.find(":")
            time_full = str(line[idx + 1:])
            idx = time_full.find("_")
            time = time_full[idx + 1:]
            idxs = time_full.find("-")
            day = time_full[:idxs]
            month = time_full[idxs + 1:idxs + 4]
            month = monthToNum(month)
            year = time_full[idxs + 5:idxs + 9]
            t = year + "-" + str(month) + "-" + str(day) + " " + str(time)
            t = stt(t)

        idx = line.find("Latitude               :")
        if idx != -1:
            idx = line.find("+")
            lat = float(line[idx + 1:])
        idx = line.find("Longitude              :")
        if idx != -1:
            idx = line.find("+")
            lon = float(line[idx + 1:])
            events_data.append([lat, lon])

        idx = line.find("Depth (km)             :")
        if idx != -1:
            idx = line.find(":")
            depth = float(line[idx + 1:]) * 1000.

        if component is not None:
            phase_markers.append(
                PhaseMarker([("GR", station.strip(), "", component.strip())],
                            tmin=t,
                            tmax=t,
                            phasename=phase.strip()))
        if depth is not None:
            try:
                event = model.event.Event(lat=lat,
                                          lon=lon,
                                          time=t,
                                          depth=depth,
                                          tags=str(event_id))
                events_list.append(event)
            except:
                pass
        if event_id in events:
            idx_event = events.index(event_id)
            if len(phase_markers_all_events) > 0:
                phase_markers_all_events[idx_event] = phase_markers
            else:
                phase_markers_all_events.append(phase_markers)

        else:
            phase_markers_all_events.append(phase_markers)
    for phase_markers in phase_markers_all_events:
        PhaseMarker.save_markers(phase_markers, "%s.pym" % (str(t)), fdigits=3)
    return events, phase_markers_all_events
from pyrocko.client import fdsn
from pyrocko import util, io, trace

tmin = util.stt('2014-01-01 16:10:00.000')
tmax = util.stt('2014-01-01 16:39:59.000')

# select stations by their NSLC id and wildcards (asterisk)
selection = [
    ('*', 'HMDT', '*', '*', tmin, tmax),    # all available components
    ('GE', 'EIL', '*', '*Z', tmin, tmax),   # all vertical components
]


# Restricted access token
# token = open('token.asc', 'rb').read()
# request_waveform = fdsn.dataselect(site='geofon', selection=selection,
#                                    token=token)

# setup a waveform data request
request_waveform = fdsn.dataselect(site='geofon', selection=selection)

# write the incoming data stream to 'traces.mseed'
with open('traces.mseed', 'wb') as file:
    file.write(request_waveform.read())

# request meta data
request_response = fdsn.station(
    site='geofon', selection=selection, level='response')

# save the response in YAML and StationXML format
request_response.dump(filename='responses_geofon.yaml')
示例#19
0
def iter_chunked(tinc,
                 path,
                 data_pile,
                 tmin=None,
                 tmax=None,
                 minlat=49.1379,
                 maxlat=49.1879,
                 minlon=8.1223,
                 maxlon=8.1723,
                 channels=["EH" + "[ZNE]"],
                 client_list=["BGR"],
                 download=True,
                 seiger=True,
                 selection=None,
                 path_waveforms=None,
                 sds=None,
                 stream=False,
                 reject_blacklisted=None,
                 tpad=0,
                 tstart=None,
                 tstop=None,
                 hf=10,
                 lf=1,
                 deltat=None,
                 models=None):
    try:
        tstart = util.stt(tmin) if tmin else None
        tstop = util.stt(tmax) if tmax else None
    except:
        pass
    model_path = os.path.dirname(
        os.path.abspath(__file__)) + "/model/EqT_model.h5"
    deltat_cf = min(data_pile.deltats.keys())
    for i, trs in enumerate(
            data_pile.chopper(tinc=tinc,
                              tmin=tstart,
                              tmax=tstop,
                              tpad=tpad,
                              keep_current_files_open=False,
                              want_incomplete=True)):
        tminc = None
        tmaxc = None
        for tr in trs:
            if tminc is None:
                tminc = tr.tmin
                tmaxc = tr.tmax
            else:
                if tminc < tr.tmin:
                    tminc = tr.tmin
                if tmaxc > tr.tmax:
                    tmaxc = tr.tmax
        for tr in trs:
            tr.highpass(4, 5)
            #    try:
            try:
                tr.chop(tminc, tmaxc)
            except:
                pass
            date_min = download_raw.get_time_format_eq(tminc)
            date_max = download_raw.get_time_format_eq(tmaxc)
            io.save(
                tr, "%s/downloads/%s/%s.%s..%s__%s__%s.mseed" %
                (path, tr.station, tr.network, tr.station, tr.channel,
                 date_min, date_max))
        #    except:
        #        pass

        process(path,
                tmin=tminc,
                tmax=tmaxc,
                minlat=minlat,
                maxlat=maxlat,
                minlon=minlon,
                maxlon=maxlon,
                channels=channels,
                client_list=client_list,
                download=download,
                seiger=seiger,
                selection=selection,
                path_waveforms=path_waveforms,
                stream=stream,
                model=None,
                iter=i,
                models=models,
                sds=None)
        for tr in trs:
            subprocess.run([
                "rm -r %s/downloads/%s/%s.%s..%s__%s__%s.mseed" %
                (path, tr.station, tr.network, tr.station, tr.channel,
                 date_min, date_max)
            ],
                           shell=True)

    cat = Catalog()
    files = glob("%s/asociation*/associations.xml" % path)
    files.sort(key=os.path.getmtime)
    for file in files:
        cat_read = read_events(file)
        for event in cat_read:
            cat.append(event)
    cat.write("%s/events_eqt.qml" % path, format="QUAKEML")
示例#20
0
def main(path,
         tmin="2021-05-26 06:20:03.800",
         tmax="2016-02-12 06:20:03.800",
         minlat=49.1379,
         maxlat=49.1879,
         minlon=8.1223,
         maxlon=8.1723,
         channels=["EH" + "[ZNE]"],
         client_list=["BGR", "http://ws.gpi.kit.edu/"],
         download=True,
         seiger=True,
         selection=None,
         clean=False,
         stream=False,
         path_waveforms=None,
         tinc=None,
         lf=5,
         hf=40,
         freq=None,
         models=None,
         sds=None):

    if download is True:
        if tinc is None:
            download_raw.download_raw(path,
                                      tmin,
                                      tmax,
                                      seiger=seiger,
                                      selection=selection,
                                      providers=client_list,
                                      clean=True,
                                      detector=True,
                                      common_f=freq)
        else:
            tmin = util.stt(tmin)
            tmax = util.stt(tmax)
            iter = 0
            vorhalten = True
            tinc = float(tinc)
            if int(int(tmax - tmin) / int(tinc)) == 0:
                nwin = 1
            else:
                nwin = int(int(tmax - tmin) / int(tinc))
            for i in range(nwin):
                twin_start = tmin + iter * tinc
                twin_end = tmin + tinc + iter * tinc
                download_raw.download_raw(path,
                                          twin_start,
                                          twin_end,
                                          seiger=seiger,
                                          selection=selection,
                                          providers=client_list,
                                          clean=clean,
                                          detector=True,
                                          common_f=freq)

                load_eqt_folder(path,
                                tinc,
                                path,
                                tmin=twin_start,
                                tmax=twin_end,
                                minlat=minlat,
                                maxlat=maxlat,
                                minlon=minlon,
                                maxlon=maxlon,
                                channels=channels,
                                client_list=client_list,
                                download=download,
                                seiger=seiger,
                                selection=selection,
                                stream=stream,
                                hf=hf,
                                lf=lf,
                                models=models)

                subprocess.run(['rm -r %s*' % (path + '/downloads*')],
                               shell=True)

                iter = +1

    if path_waveforms is not None or sds is not None:
        load_eqt_folder(path_waveforms,
                        tinc,
                        path,
                        tmin=tmin,
                        tmax=tmax,
                        minlat=minlat,
                        maxlat=maxlat,
                        minlon=minlon,
                        maxlon=maxlon,
                        channels=channels,
                        client_list=client_list,
                        download=download,
                        seiger=seiger,
                        selection=selection,
                        stream=stream,
                        hf=hf,
                        lf=lf,
                        models=models,
                        sds=sds)
    else:
        process(path,
                tmin=tmin,
                tmax=tmax,
                minlat=minlat,
                maxlat=maxlat,
                minlon=minlon,
                maxlon=maxlon,
                channels=channels,
                client_list=client_list,
                download=download,
                seiger=seiger,
                selection=selection,
                path_waveforms=path_waveforms,
                stream=stream,
                models=models)
示例#21
0
def mts_paper_scedc():
    '''
    Hardcoded copy of the moment tensors from the scedc website.
    Retrieved: 23.12.2020
    '''
    mts = []
    times = []
    events = []

    #https://service.scedc.caltech.edu/MomentTensor/solutions/web_38460967/ci38460967_MT.html
    time = "2019-07-06 09:28:29"
    Mo = 2.69e+23
    Mxx = -1.803e+23
    Mxy = -1.840e+23
    Mxz = 2.476e+22
    Myy = 2.068e+23
    Myz = -1.784e+22
    Mzz = -2.650e+22
    lat = 35.8978
    lon = -117.7250
    depth = 3900
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38463551/ci38463551_MT.html
    time = "2019-07-06 13:06:55"
    Mo = 6.91e+22
    Mxx = -4.574e+22
    Mxy = 4.274e+21
    Mxz = 1.557e+22
    Myy = 7.768e+22
    Myz = -1.884e+22
    Mzz = -3.194e+22
    lat = 35.9280
    lon = -117.7063
    depth = 1500
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38466495/ci38466495_MT.html
    time = "2019-07-06 17:59:15"
    Mo = 8.70e+21
    Mxx = -4.447e+21
    Mxy = -6.931e+21
    Mxz = -1.326e+21
    Myy = 5.598e+21
    Myz = 9.049e+20
    Mzz = -1.151e+21
    lat = 35.8997
    lon = -117.7347
    depth = 3000
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38517119/ci38517119_MT.html
    time = "2019-07-10 12:00:05"
    Mo = 6.52e+21
    Mxx = -1.755e+21
    Mxy = -1.499e+21
    Mxz = 3.140e+21
    Myy = 6.118e+21
    Myz = -8.072e+20
    Mzz = -4.363e+21
    lat = 35.8765
    lon = -117.7068
    depth = 4400
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38538991/ci38538991_MT.html
    time = "2019-07-11 23:45:19"
    Mo = 1.97e+22
    Mxx = -8.999e+21
    Mxy = -1.598e+22
    Mxz = 6.197e+21
    Myy = 9.964e+21
    Myz = 2.233e+21
    Mzz = -9.657e+20
    lat = 35.9482
    lon = -117.7057
    depth = 1500
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    #https://service.scedc.caltech.edu/MomentTensor/solutions/web_38644943/ci38644943_MT.html
    time = "2019-07-26 00:42:48"
    Mo = 1.62e+23
    Mxx = -6.930e+22
    Mxy = 9.560e+21
    Mxz = 3.263e+22
    Myy = 1.860e+23
    Myz = -2.825e+22
    Mzz = -1.167e+23
    lat = 35.9237
    lon = -117.7115
    depth = 1900
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38996632/ci38996632_MT.html
    time = "2019-08-22 20:49:50"
    Mo = 2.72e+23
    Mxx = -8.042e+22
    Mxy = -2.026e+23
    Mxz = 1.983e+22
    Myy = 2.492e+23
    Myz = 1.635e+22
    Mzz = -1.688e+23
    lat = 35.9077
    lon = -117.7092
    depth = 4900
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    # https://service.scedc.caltech.edu/MomentTensor/solutions/web_38999296/ci38999296_MT.html
    time = "2019-08-23 05:34:10"
    Mo = 3.87e+22
    Mxx = -1.383e+22
    Mxy = -2.949e+22
    Mxz = 1.231e+22
    Myy = 2.220e+22
    Myz = 9.991e+21
    Mzz = -8.375e+21
    lat = 35.9078
    lon = -117.7047
    depth = 7200
    M = [Mxx, Myy, Mzz, Mxy, Mxz, Myz]
    mt = pmt.MomentTensor(mnn=M[0],
                          mee=M[1],
                          mdd=M[2],
                          mne=M[3],
                          mnd=M[4],
                          med=M[5])
    mts.append(mt)
    times.append(time)
    event = model.Event(time=util.stt(time),
                        moment_tensor=M,
                        lat=lat,
                        lon=lon,
                        depth=depth)
    events.append(event)

    return mts, times, events