
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/datasets/plot_bedrock_erosion.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_bedrock_erosion.py>`
        to download the full example code.

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

.. _sphx_glr_examples_datasets_plot_bedrock_erosion.py:


Bedrock erosion
===============

Plot a composite map including bedrock altitude, surface altitude contours,
bedrock erosion computed from basal ice velocity, and geographic elements.

.. GENERATED FROM PYTHON SOURCE LINES 12-43



.. image-sg:: /examples/datasets/images/sphx_glr_plot_bedrock_erosion_001.png
   :alt: Glacier erosion rate (mm$\,$a$^{-1}$)
   :srcset: /examples/datasets/images/sphx_glr_plot_bedrock_erosion_001.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

    /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)
    /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)
    /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)






|

.. code-block:: Python


    import matplotlib.pyplot as plt
    import matplotlib.ticker
    import hyoga

    # initialize figure
    ax = plt.subplot()
    cax = plt.axes([0.15, 0.55, 0.025, 0.25])

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

        # plot model output
        ds.hyoga.plot.bedrock_altitude(ax=ax, center=False)
        ds.hyoga.plot.surface_altitude_contours(ax=ax)
        ds.hyoga.plot.bedrock_erosion(
            ax=ax, cbar_ax=cax, levels=[10**i for i in range(-9, 1)],
            cbar_kwargs=dict(
                format=matplotlib.ticker.LogFormatterMathtext(),
                ticks=[10**i for i in range(-9, 1, 3)]))
        ds.hyoga.plot.ice_margin(ax=ax)

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

    # set axes properties
    cax.set_ylabel('')
    ax.set_title(r'Glacier erosion rate (mm$\,$a$^{-1}$)')

    # show
    plt.show()


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

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


.. _sphx_glr_download_examples_datasets_plot_bedrock_erosion.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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