pyrocko.model.event

Simple representation of a seismic event.

Functions

dump_events(events[, filename, stream, format])

Write events file.

load_events(filename[, format])

Read events file.

Classes

Event([lat, lon, north_shift, east_shift, ...])

Representation of a seismic event.

Tag(...)

Any str matching pattern '^([A-Za-z][A-Za-z0-9._]{0,128})(:([A-Za-z0-9._-]*))?$'.

class Tag(...) str[source]

Bases: StringPattern

Any str matching pattern '^([A-Za-z][A-Za-z0-9._]{0,128})(:([A-Za-z0-9._-]*))?$'.

class Event(lat=0.0, lon=0.0, north_shift=0.0, east_shift=0.0, time=0.0, name='', depth=None, elevation=None, magnitude=None, magnitude_type=None, region=None, load=None, loadf=None, catalog=None, moment_tensor=None, duration=None, tags=None, extras=None)[source]

Bases: Location

Representation of a seismic event.

time

pyrocko.util.get_time_float (pyrocko.guts.Timestamp), default: str_to_time('1970-01-01 00:00:00')

Origin time (UTC system timestamp) [s].

depth

float, optional

Depth below surface [m].

name

str, optional, default: ''

Event identifier.

magnitude

float, optional

Magnitude of the event.

magnitude_type

str, optional

Magnitude type magnitude is given in.

region

str, optional

Source region.

catalog

str, optional

Name of catalog that lists this event.

moment_tensor

pyrocko.moment_tensor.MomentTensor, optional

Moment tensor of the event.

duration

float, optional

Source duration [s].

tags

list of str (Tag) objects, default: []

Auxiliary tags.

extras

dict of pyrocko.guts.Any objects, default: {}

Additional user defined event attributes. The given values must be YAML-serializable.

get_hash()[source]

Get a pseudo-unique hash over the main attributes of the event.

The following attributes are hashed: time, lat, lon, depth, magnitude, catalog, name, region.

Returns:

URL-safe base64 encoded SHA1 hash.

load_events(filename, format='detect')[source]

Read events file.

Parameters:
  • filename – name of file as str

  • format – file format: 'detect', 'basic', or 'yaml'

Returns:

list of Event objects

dump_events(events, filename=None, stream=None, format='basic')[source]

Write events file.

Parameters:
  • events – list of Event objects

  • filename – name of file as str

  • format – file format: 'basic', or 'yaml'