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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_sample_data_south_africa_topography.py>`
        to download the full example code

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

.. _sphx_glr_sample_data_south_africa_topography.py:


South Africa Topography
=======================

The topography and bathymetry of South Africa according to the ETOPO1 model
[AmanteEakins2009]_. The original model has 1 arc-minute grid spacing but here
we downsampled to 0.1 degree grid spacing to save space and download times.
Heights are referenced to sea level.

.. GENERATED FROM PYTHON SOURCE LINES 16-36



.. image:: /sample_data/images/sphx_glr_south_africa_topography_001.png
    :alt: Topography of South africa (ETOPO1)
    :class: sphx-glr-single-img


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

 Out:

 .. code-block:: none

    <xarray.Dataset>
    Dimensions:     (longitude: 211, latitude: 171)
    Coordinates:
      * longitude   (longitude) float64 12.0 12.1 12.2 12.3 ... 32.7 32.8 32.9 33.0
      * latitude    (latitude) float64 -35.0 -34.9 -34.8 -34.7 ... -18.2 -18.1 -18.0
    Data variables:
        topography  (latitude, longitude) float64 ...






|

.. code-block:: default

    import matplotlib.pyplot as plt
    import cartopy.crs as ccrs
    import harmonica as hm

    # Load the topography grid
    data = hm.datasets.fetch_south_africa_topography()
    print(data)

    # Make a plot of data using Cartopy
    plt.figure(figsize=(10, 10))
    ax = plt.axes(projection=ccrs.Mercator())
    pc = data.topography.plot.pcolormesh(
        ax=ax, transform=ccrs.PlateCarree(), add_colorbar=False, cmap="terrain"
    )
    plt.colorbar(
        pc, label="meters", orientation="horizontal", aspect=50, pad=0.01, shrink=0.6
    )
    ax.set_title("Topography of South africa (ETOPO1)")
    ax.coastlines()
    plt.show()


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

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


.. _sphx_glr_download_sample_data_south_africa_topography.py:


.. only :: html

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



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

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



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

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


.. only:: html

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

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