.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/declustering.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_declustering.py: Declustering of earthquake catalog ================================== This example shows how to decluster a catalog using the method :meth:`bruces.Catalog.decluster`. This example starts by downloading a ComCat catalog with :mod:`pycsep`. .. GENERATED FROM PYTHON SOURCE LINES 10-54 .. image-sg:: /examples/images/sphx_glr_declustering_001.png :alt: declustering :srcset: /examples/images/sphx_glr_declustering_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Fetched ComCat catalog in 5.349629640579224 seconds. Downloaded catalog from ComCat with following parameters Start Date: 2008-06-09 22:59:47.120000+00:00 End Date: 2017-12-31 19:09:31.700000+00:00 Min Latitude: 35.0083 and Max Latitude: 36.9963 Min Longitude: -99.3909 and Max Longitude: -96.1792 Min Magnitude: 3.0 Found 2612 events in the ComCat catalog. | .. code-block:: default from datetime import datetime, timedelta import bruces import csep import numpy as np import matplotlib.pyplot as plt # Download catalog start_time = datetime(2008, 1, 1) end_time = datetime(2018, 1, 1) catalog = csep.query_comcat( start_time=start_time, end_time=end_time, min_magnitude=3.0, min_latitude=35.0, max_latitude=37.0, min_longitude=-99.5, max_longitude=-96.0, ) # Plot full catalog's seismicity rate cat = bruces.from_csep(catalog) dt = timedelta(days=30) tbins = np.arange(start_time, end_time, dt) rates, dates = cat.seismicity_rate(tbins) plt.figure() plt.bar(dates, rates / 12.0, width=dt, label="full") # Decluster and plot declustered catalogs' seismicity rates algorithms = { "reasenberg": {}, "gardner-knopoff": {"window": "uhrhammer"}, "nearest-neighbor": {"use_depth": True, "seed": 0}, } for algorithm, kwargs in algorithms.items(): catd = cat.decluster(algorithm=algorithm, **kwargs) rates, dates = catd.seismicity_rate(tbins) plt.bar(dates, rates / 12.0, width=dt, label=algorithm) plt.xlim(start_time, end_time) plt.xlabel("Time (year)") plt.ylabel("Number of events") plt.legend(frameon=False) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 10.211 seconds) .. _sphx_glr_download_examples_declustering.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: declustering.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: declustering.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_