Catalog.from_openquake#
- classmethod Catalog.from_openquake(oq_catalogue: OQCatalogue, keep_time_cols=False) Catalog#
Create a (seismostats) Catalog from an openquake Catalogue. The optional dependency group openquake is required for this method.
- Parameters:
oq_catalogue – The openquake catalogue.
keep_time_cols – Whether the time columns: ‘year’, ‘month’, ‘day’, ‘hour’, ‘minute’, ‘second’ should be kept (they are converted to ‘time’).
- Returns:
Catalog
Examples
>>> from openquake.hmtk.seismicity.catalogue import ... Catalogue as OQCatalog >>> from seismostats import Catalog >>> oq_cat = OQCatalog.make_from_dict({ ... 'eventID': ["event0", "event1", "event2"], ... 'longitude': np.array([42.35, 1.35, 2.35], dtype=float), ... 'latitude': np.array([3.34444, 5.135, 2.134], ... dtype=float), ... 'depth': np.array([5.5, 10.52, 50.4], dtype=float), ... 'year': np.array([1900, 1982, 2020], dtype=int), ... 'month': np.array([1, 4, 11], dtype=int), ... 'day': np.array([1, 7, 30], dtype=int), ... 'hour': np.array([5, 7, 12], dtype=int), ... 'minute': np.array([5, 7, 30], dtype=int), ... 'second': np.array([13.1234, 15.0, 59.9999], ... dtype=float), ... 'magnitude': np.array([1.0, 2.5, 3.9], dtype=float) ... }) >>> cat = Catalog.from_openquake(oq_cat) >>> cat longitude latitude depth time magnitude 0 42.35 3.34444 5.50 1900-01-01 05:05:13 1.0 1 1.35 5.13500 10.52 1982-04-07 07:07:15 2.5 2 2.35 2.13400 50.40 2020-11-30 12:30:59 3.9