event_processing.py 1.55 KB
Newer Older
doetschj's avatar
doetschj committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Processing module of DUG-Seis


# Copyright (c) 2018 by SCCER-SoE and SED at ETHZ

Version 0.0, 23.10.2018, Joseph Doetsch (doetschj)
             23.10.2018, Semih Demir
             23.10.2018, Linus Villiger


"""


import logging
from dug_seis.processing.event import Event
from dug_seis.processing.get_waveforms import get_waveforms


def event_processing(param, load_file, trig_time,  event_id, classification):
    logging.debug('Starting processing for event %d' % event_id)
    wf_stream = get_waveforms(param, load_file, trig_time)

    event = Event(param, wf_stream, event_id, classification)
    if classification == 'noise':
        event.event_plot(save_fig=True)
Semih Demir's avatar
Semih Demir committed
27
28
29
    elif classification == 'electronic':
        event.bandpass()
        event.event_plot(save_fig=True)
doetschj's avatar
doetschj committed
30
    else:
31
        # event.bandpass()
doetschj's avatar
doetschj committed
32
        event.pick()
Semih Demir's avatar
Semih Demir committed
33
        event.locate()
doetschj's avatar
doetschj committed
34
        event.est_magnitude()
35
        event.event_plot(save_fig=True)
doetschj's avatar
doetschj committed
36
37
38
39
40
41
42
        #event.prparam['Locate']['algorithm'] = 'hom_aniso'
        #event.locate()
        #event.est_magnitude()
        #event.est_magnitude(origin_number=1)
        #event.classification = 'active'
        #event.event_plot(save_fig=True)
        #classification = 'passive'
Semih Demir's avatar
Semih Demir committed
43

Semih Demir's avatar
Semih Demir committed
44
45
46
47
48
        if classification == 'passive':
            event.write('%s/event%s.xml' % (param['Processing']['Folders']['quakeml_folder'], event_id), 'quakeml', validate=True)
        elif classification == 'active':
            event.write('%s/hammer%s.xml' % (param['Processing']['Folders']['quakeml_folder'], event_id), 'quakeml',
                        validate=True)