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

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_gallery_sierra-negra-topography.py>`
        to download the full example code

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

.. _sphx_glr_gallery_sierra-negra-topography.py:


Topography of the 2018 lava flows of the Sierra Negra volcano, Ecuador
----------------------------------------------------------------------

This is a structure-from-motion point cloud of the 2018 lava flows of the
Sierra Negra volcano, located on the Galápagos islands, Ecuador. The survey
covers a small region at the flank of the volcano and shows different
structures and terrain roughness on the lava flows.

**Original source:** `Carr, B. (2020). Sierra Negra Volcano (TIR Flight 3):
Galápagos, Ecuador, October 22 2018. Distributed by OpenTopography.
<https://doi.org/10.5069/G957196P>`__

**Pre-processing:** `Source code for preparation of the original dataset for
redistribution in Ensaio
<https://github.com/fatiando-data/sierra-negra-topography>`__

.. GENERATED FROM PYTHON SOURCE LINES 25-31

.. code-block:: Python


    import pandas as pd
    import pygmt

    import ensaio








.. GENERATED FROM PYTHON SOURCE LINES 32-33

Download and cache the data and return the path to it on disk

.. GENERATED FROM PYTHON SOURCE LINES 33-36

.. code-block:: Python

    fname = ensaio.fetch_sierra_negra_topography(version=1)
    print(fname)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    /home/runner/work/_temp/cache/ensaio/v1/sierra-negra-topography.csv.xz




.. GENERATED FROM PYTHON SOURCE LINES 37-38

Load the CSV formatted data with pandas

.. GENERATED FROM PYTHON SOURCE LINES 38-41

.. code-block:: Python

    data = pd.read_csv(fname)
    data






.. raw:: html

    <div class="output_subarea output_html rendered_html output_result">
    <div>
    <style scoped>
        .dataframe tbody tr th:only-of-type {
            vertical-align: middle;
        }

        .dataframe tbody tr th {
            vertical-align: top;
        }

        .dataframe thead th {
            text-align: right;
        }
    </style>
    <table border="1" class="dataframe">
      <thead>
        <tr style="text-align: right;">
          <th></th>
          <th>longitude</th>
          <th>latitude</th>
          <th>elevation_m</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>0</th>
          <td>-91.115651</td>
          <td>-0.783062</td>
          <td>930.1</td>
        </tr>
        <tr>
          <th>1</th>
          <td>-91.115658</td>
          <td>-0.783056</td>
          <td>930.7</td>
        </tr>
        <tr>
          <th>2</th>
          <td>-91.115649</td>
          <td>-0.783060</td>
          <td>930.3</td>
        </tr>
        <tr>
          <th>3</th>
          <td>-91.115656</td>
          <td>-0.783063</td>
          <td>929.7</td>
        </tr>
        <tr>
          <th>4</th>
          <td>-91.115655</td>
          <td>-0.783068</td>
          <td>929.2</td>
        </tr>
        <tr>
          <th>...</th>
          <td>...</td>
          <td>...</td>
          <td>...</td>
        </tr>
        <tr>
          <th>1731379</th>
          <td>-91.118421</td>
          <td>-0.781943</td>
          <td>990.7</td>
        </tr>
        <tr>
          <th>1731380</th>
          <td>-91.118303</td>
          <td>-0.781933</td>
          <td>990.2</td>
        </tr>
        <tr>
          <th>1731381</th>
          <td>-91.118357</td>
          <td>-0.781971</td>
          <td>992.4</td>
        </tr>
        <tr>
          <th>1731382</th>
          <td>-91.118354</td>
          <td>-0.781940</td>
          <td>991.2</td>
        </tr>
        <tr>
          <th>1731383</th>
          <td>-91.118374</td>
          <td>-0.781945</td>
          <td>991.4</td>
        </tr>
      </tbody>
    </table>
    <p>1731384 rows × 3 columns</p>
    </div>
    </div>
    <br />
    <br />

.. GENERATED FROM PYTHON SOURCE LINES 42-43

Make a PyGMT map with the data points colored by the elevation.

.. GENERATED FROM PYTHON SOURCE LINES 43-60

.. code-block:: Python

    fig = pygmt.Figure()
    fig.basemap(
        region=[
            data.longitude.min(),
            data.longitude.max(),
            data.latitude.min(),
            data.latitude.max(),
        ],
        projection="M15c",
        frame=True,
    )
    pygmt.makecpt(cmap="viridis", series=[data.elevation_m.min(), data.elevation_m.max()])
    fig.plot(
        x=data.longitude, y=data.latitude, fill=data.elevation_m, cmap=True, style="c0.01c"
    )
    fig.colorbar(frame='af+l"elevation [m]"')
    fig.show()



.. image-sg:: /gallery/images/sphx_glr_sierra-negra-topography_001.png
   :alt: sierra negra topography
   :srcset: /gallery/images/sphx_glr_sierra-negra-topography_001.png
   :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 19.886 seconds)


.. _sphx_glr_download_gallery_sierra-negra-topography.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: sierra-negra-topography.ipynb <sierra-negra-topography.ipynb>`

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

      :download:`Download Python source code: sierra-negra-topography.py <sierra-negra-topography.py>`


.. only:: html

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

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