5.2.4.1.3. eqcorrscan.utils.clustering.catalog_cluster

eqcorrscan.utils.clustering.catalog_cluster(catalog, thresh, metric='distance', show=True)[source]

Cluster a catalog by distance only.

Will compute the matrix of physical distances between events and utilize the scipy.clustering.hierarchy module to perform the clustering.

Parameters:
  • catalog (obspy.core.event.Catalog) – Catalog of events to clustered

  • thresh (float) – Maximum separation, either in km (metric=”distance”) or in seconds (metric=”time”)

  • metric (str) – Either “distance” or “time”

Returns:

list of obspy.core.event.Catalog objects

Return type:

list

>>> from eqcorrscan.utils.clustering import catalog_cluster
>>> from obspy.clients.fdsn import Client
>>> from obspy import UTCDateTime
>>> client = Client("NCEDC")
>>> starttime = UTCDateTime("2002-01-01")
>>> endtime = UTCDateTime("2002-02-01")
>>> cat = client.get_events(starttime=starttime, endtime=endtime,
...                         minmagnitude=2)
>>> groups = catalog_cluster(catalog=cat, thresh=2, show=False)
>>> from eqcorrscan.utils.clustering import catalog_cluster
>>> from obspy.clients.fdsn import Client
>>> from obspy import UTCDateTime
>>> client = Client("https://earthquake.usgs.gov")
>>> starttime = UTCDateTime("2002-01-01")
>>> endtime = UTCDateTime("2002-02-01")
>>> cat = client.get_events(starttime=starttime, endtime=endtime,
...                         minmagnitude=6)
>>> groups = catalog_cluster(catalog=cat, thresh=1000, metric="time",
...     show=False)