obsplus.events.merge module

functions for merging catalogs together

obsplus.events.merge.associate_merge(event, new_catalog, median_tolerance=1.0, reject_old=False)[source]

Merge the “closest” event in a catalog into an existing event.

Finds the closest event in new_catalog to event using median pick times, then calls obsplus.events.merge.merge_events() to merge the events together.

Parameters:
  • event (Event) – The base event which will be modified in place.

  • new_catalog (Union[Catalog, Event]) – A new catalog or event which contains picks.

  • median_tolerance (float) – The tolerance, in seconds, of the median pick for associating events in new_catalog into event.

  • reject_old (bool) – Reject any picks/amplitudes in old event if not found in new event.

Return type:

Event

obsplus.events.merge.attach_new_origin(old_event, new_event, new_origin, preferred, index=None)[source]

Attach a new origin to an existing events object.

Parameters:
  • old_event (obspy.core.event.Event) – The old event that will receive the new origin

  • new_event (obspy.core.event.Event) – The new event that contains the origin, needed for merging picks that may not exist in old_event

  • new_origin (obspy.core.event.Origin) – The new origin that will be attached to old_event

  • preferred (bool) – If True mark the new origin as the preferred_origin

  • index (int or None) – The origin index of old_cat that new_origin will overwrite, if None append the new_origin to old_cat.origins

Returns:

modifies old_cat in-place, returns old_catalog

Return type:

obspy.Catalog

obsplus.events.merge.merge_events(eve1, eve2, reject_old=True)[source]

Merge picks and amplitudes of two events together.

This function attempts to merge picks and amplitudes of two events together that may have different resource_ids in some attributes. The second event is imposed on the first which is modified in place.

Parameters:
  • eve1 (Catalog) – The first (former) event

  • eve2 (Catalog) – The second (new) event

  • reject_old (bool) – If True, reject anything in eve1 not in eve2

Returns:

The merged events

Return type:

Event