Event

class mss_dataserver.event.core.Event(start_time, end_time, db_id=None, public_id=None, event_type=None, event_type_certainty=None, description=None, comment=None, tags=[], agency_uri=None, author_uri=None, creation_time=None, parent=None, changed=True, detections=None)[source]

Bases: object

A seismic event.

Parameters
  • start_time (str or obspy.UTCDateTime) – The start time of the event. A string that can be parsed by obspy.UTCDateTime or a obspy.UTCDateTime instance.

  • end_time (str or obspy.UTCDateTime) – The end time of the event. A string that can be parsed by obspy.UTCDateTime or a obspy.UTCDateTime instance.

  • db_id (int) – The database id of the event.

  • public_id (str) – The public id of the event.

  • event_type (str) – The type of the event.

  • event_type_certainty (str) – The certainty of the event type.

  • description (str) – The description of the event.

  • comment (str) – The comment to the event.

  • tags (list of str) – The tags of the event.

  • agency_uri (str) – The Uniform Resource Identifier of the author agency.

  • author_uri (str) – The Uniform Resource Identifier of the author.

  • creation_time (str or obspy.UTCDateTime) – The creation time of the event. A string that can be parsed by obspy.UTCDateTime or a obspy.UTCDateTime instance.

  • parent (object) – The parent object containing the event.

  • changed (bool) – Flag indicating if one of the event attributes has changes.

  • detection (list of mss_dataserver.detection.Detection) – The detections associated to the event.

Variables
  • detection_state (str) – The state of the event detection [new, updated, closed].

  • pgv_stream (obspy.Stream) – The PGV stream of the event.

  • detection_data (dict) – A dictionary holding the detection data related to the event. The detection data is created during the detection process using mss_dataserver.event.delaunay_detection.DelaunayDetector.

Properties

end_time_string

str: The string representation of the end time.

length

float: The length of the event in seconds.

max_pgv

float: The maximum PGV of all detections.

public_id

str: The public ID of the event.

rid

str: The resource ID of the event.

start_time_string

str: The string representation of the start time.

triggered_stations

list of tuple of str: The nsl codes of the stations that contributed to a detection.

Methods

__init__(start_time, end_time[, db_id, …])

Instance initialization

add_detection(detection)

Add a detection to the event.

assign_channel_to_detections(inventory)

Set the channels according to the rec_stream_ids.

from_orm(db_event, inventory)

Convert a database orm mapper event to a event.

get_db_orm(project)

Get an orm representation to use it for bulk insertion into the database.

get_detection(stations)

Get a detection with the provided stations.

get_detection_limits_per_station()

Compute the detection start and end times for each station.

get_max_pgv_per_station()

Compute the maximum PGV of the individual stations that have

has_detection(stations)

Check if a detection is available for a set of stations.

station_has_triggered(station)

Check if a detection has been triggered at a station.

write_to_database(project)

Write the event to the database.

Inheritence diagram

Inheritance diagram of mss_dataserver.event.core.Event