obspy.core.event.catalog.Catalog

class Catalog(events=None, **kwargs)[source]

Bases: object

This class serves as a container for Event objects.

Parameters:
  • events (list of Event, optional) – List of events

  • resource_id (ResourceIdentifier) – Resource identifier of the catalog.

  • description (str, optional) – Description string that can be assigned to the earthquake catalog, or collection of events.

  • comments (list of Comment, optional) – Additional comments.

  • creation_info (CreationInfo, optional) – Creation information used to describe author, version, and creation time.

Note

For handling additional information not covered by the QuakeML standard and how to output it to QuakeML see the ObsPy Tutorial.

Attributes

creation_info

resource_id

Public Methods

append

Appends a single Event object to the current Catalog object.

clear

Clears event list (convenient method).

copy

Returns a deepcopy of the Catalog object.

count

Returns the number of Events in the Catalog object.

extend

Extends the current Catalog object with a list of Event objects.

filter

Returns a new Catalog object only containing Events which match the specified filter rules.

plot

Creates preview map of all events in current Catalog object.

write

Saves catalog into a file.

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

Catalog._get_creation_info()[source]
Catalog._get_resource_id()[source]
Catalog._repr_pretty_(p, cycle)[source]
Catalog._set_creation_info(value)[source]
Catalog._set_resource_id(value)[source]

Special Methods

Catalog.__add__(other)[source]

Method to add two catalogs.

Catalog.__delattr__(name, /)

Implement delattr(self, name).

Catalog.__delitem__(index)[source]

Passes on the __delitem__ method to the underlying list of traces.

Catalog.__dir__()

Default dir() implementation.

Catalog.__eq__(other)[source]

__eq__ method of the Catalog object.

Parameters:

other (Catalog) – Catalog object for comparison.

Return type:

bool

Returns:

True if both Catalogs contain the same events.

Example

>>> from obspy.core.event import read_events
>>> cat = read_events()
>>> cat2 = cat.copy()
>>> cat is cat2
False
>>> cat == cat2
True
Catalog.__format__(format_spec, /)

Default object formatter.

Catalog.__ge__(value, /)

Return self>=value.

Catalog.__getattribute__(name, /)

Return getattr(self, name).

Catalog.__getitem__(index)[source]

__getitem__ method of the Catalog object.

Returns:

Event objects

Catalog.__getslice__(i, j, k=1)[source]

__getslice__ method of the Catalog object.

Returns:

Catalog object

Catalog.__gt__(value, /)

Return self>value.

Catalog.__iadd__(other)[source]

Method to add two catalog with self += other.

It will extend the current Catalog object with the events of the given Catalog. Events will not be copied but references to the original events will be appended.

Parameters:

other (Catalog or Event) – Catalog or Event object to add.

Catalog.__init__(events=None, **kwargs)[source]
Catalog.__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

Catalog.__iter__()[source]

Return a robust iterator for Events of current Catalog.

Doing this it is safe to remove events from catalogs inside of for-loops using catalog’s remove() method. Actually this creates a new iterator every time a event is removed inside the for-loop.

Catalog.__le__(value, /)

Return self<=value.

Catalog.__len__()[source]

Returns the number of Events in the Catalog object.

Catalog.__lt__(value, /)

Return self<value.

Catalog.__ne__(other)[source]
Catalog.__new__(**kwargs)
Catalog.__reduce__()

Helper for pickle.

Catalog.__reduce_ex__(protocol, /)

Helper for pickle.

Catalog.__repr__()

Return repr(self).

Catalog.__setattr__(name, value, /)

Implement setattr(self, name, value).

Catalog.__setitem__(index, event)[source]

__setitem__ method of the Catalog object.

Catalog.__setstate__(state)[source]

Reset the resource id after being unpickled to ensure they are bound to the correct object.

Catalog.__sizeof__()

Size of object in memory, in bytes.

Catalog.__str__(print_all=False)[source]

Returns short summary string of the current catalog.

It will contain the number of Events in the Catalog and the return value of each Event’s __str__() method.

Parameters:

print_all (bool, optional) – If True, all events will be printed, otherwise a maximum of ten event will be printed. Defaults to False.

Catalog.__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).