
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "generated/gallery/scalar_data/earthquakes.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_generated_gallery_scalar_data_earthquakes.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_generated_gallery_scalar_data_earthquakes.py:


Earthquakes
-----------

This example demonstrates how to render scalar points-of-interest.

📋 Summary
^^^^^^^^^^

Creates a point cloud from a USGS earthquakes dataset.

The resulting render contains a point cloud of M2.5+ earthquakes along
with a Natural Earth base layer and Natural Earth coastlines.

The earthquakes dataset is sourced from the
`USGS Earthquake Hazards Program <https://www.usgs.gov/programs/earthquake-hazards>`_
and
`pre-processed <https://github.com/holoviz/holoviz/blob/main/examples/data/preprocessing/earthquake_data.py>`_
as part of this
`HoloViz Tutorial <https://holoviz.org/tutorial/Overview.html#the-holoviz-tutorial>`_.

=============  =============================================================  =========================
Magnitude      Earthquake Effects                                             Estimated Number per Year
=============  =============================================================  =========================
**<=2.5**      Usually not felt, but can be recorded by seismograph.          Millions
**2.5 - 5.4**  Often felt, but only causes minor damage.                      500,000
**5.5 - 6.0**  Slight damage to buildings and other structures.               350
**6.1 - 6.9**  May cause a lot of damage in very populated areas.             100
**7.0 - 7.9**  Major earthquake. Serious damage.                              10-15
**>=8.0**      Great earthquake. Can destroy communities near the epicenter.  One every year or two
=============  =============================================================  =========================

See `reference <https://www.mtu.edu/geo/community/seismology/learn/earthquake-measure/magnitude/>`_
for further details.

.. attention::

   Optional package dependencies `pandas <https://pandas.pydata.org/docs/>`_ and
   `fastparquet <https://fastparquet.readthedocs.io/en/stable>`_ are required.

.. tags:: Coastlines, Globe, Graticule, Points, Texture

----

.. GENERATED FROM PYTHON SOURCE LINES 52-102







.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /generated/gallery/scalar_data/images/sphx_glr_earthquakes_001.png
        :alt: earthquakes
        :srcset: /generated/gallery/scalar_data/images/sphx_glr_earthquakes_001.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/geovista/checkouts/v0.5.3/docs/src/generated/gallery/scalar_data/images/sphx_glr_earthquakes_001.vtksz






.. code-block:: Python


    from __future__ import annotations

    import geovista as gv
    from geovista.pantry.data import usgs_earthquakes
    import geovista.theme


    def main() -> None:
        """Plot points-of-interest for USGS earthquakes.

        Notes
        -----
        .. versionadded:: 0.4.0

        """
        # Load sample data, which requires the optional package
        # dependencies 'fastparquet' and 'pandas'.
        sample = usgs_earthquakes()

        # Plot the points.
        plotter = gv.GeoPlotter()
        sargs = {"title": "Magnitude", "shadow": True}
        plotter.add_points(
            xs=sample.lons,
            ys=sample.lats,
            cmap="fire_r",
            render_points_as_spheres=True,
            scalars=sample.data,
            point_size=5,
            scalar_bar_args=sargs,
        )
        # Force zlevel alignment of coastlines and base layer.
        plotter.add_base_layer(texture=gv.natural_earth_1(), zlevel=0)
        plotter.add_graticule()
        plotter.add_coastlines()
        plotter.add_axes()
        plotter.add_text(
            "USGS M2.5+ Earthquakes, 2000-2018",
            position="upper_left",
            font_size=10,
            shadow=True,
        )
        plotter.view_xz(negative=True)
        plotter.camera.zoom(1.3)
        plotter.show()


    if __name__ == "__main__":
        main()


.. _sphx_glr_download_generated_gallery_scalar_data_earthquakes.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: earthquakes.ipynb <earthquakes.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: earthquakes.py <earthquakes.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: earthquakes.zip <earthquakes.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
