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

.. only:: html

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

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

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

.. _sphx_glr_examples_datasets_plot_surface_contours.py:


Surface contours
================

Plot a composite map including bedrock altitude, a half-transparent ice mask,
a surface altitude contour, and geographic elements.

.. GENERATED FROM PYTHON SOURCE LINES 12-32



.. image-sg:: /examples/datasets/images/sphx_glr_plot_surface_contours_001.png
   :alt: Surface elevation contours
   :srcset: /examples/datasets/images/sphx_glr_plot_surface_contours_001.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

    downloading https://raw.githubusercontent.com/juseg/hyoga-data/main/pism/pism.alps.out.2d.nc...
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/hyoga/open/example.py:29: FutureWarning: In a future version, xarray will not decode timedelta values based on the presence of a timedelta-like units attribute by default. Instead it will rely on the presence of a timedelta64 dtype attribute, which is now xarray's default way of encoding timedelta64 values. To continue decoding timedeltas based on the presence of a timedelta-like units attribute, users will need to explicitly opt-in by passing True or CFTimedeltaCoder(decode_via_units=True) to decode_timedelta. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.
      return xr.open_dataset(path)
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_coastline.zip...
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_rivers_lake_centerlines.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_rivers_australia.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_rivers_europe.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_rivers_north_america.zip...
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_lakes.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_lakes_australia.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_lakes_europe.zip...
    downloading https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_lakes_north_america.zip...






|

.. code-block:: Python


    import matplotlib.pyplot as plt
    import hyoga

    # open demo data
    with hyoga.open.example('pism.alps.out.2d.nc') as ds:

        # plot model output
        ds.hyoga.plot.bedrock_altitude(center=False)
        ds.hyoga.plot.ice_margin(facecolor='w')
        ds.hyoga.plot.surface_altitude_contours(colors='tab:blue')

        # add coastline and rivers
        ax = ds.hyoga.plot.natural_earth()

    # set title
    ax.set_title(r'Surface elevation contours')

    # show
    plt.show()


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

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


.. _sphx_glr_download_examples_datasets_plot_surface_contours.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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