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

.. only:: html

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

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

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

.. _sphx_glr_source_auto_examples_get_stability_indices_example.py:


Example on how to retrieve stability indicies from a sounding
-------------------------------------------------------------

This example shows how to retrieve CAPE, CIN, and lifted index
from a sounding.

.. GENERATED FROM PYTHON SOURCE LINES 8-43

.. code-block:: default

    import act

    sonde_ds = act.io.armfiles.read_netcdf(
        act.tests.sample_files.EXAMPLE_SONDE1)

    sonde_ds = act.retrievals.calculate_stability_indicies(
        sonde_ds, temp_name="tdry", td_name="dp", p_name="pres")
    print("Lifted index = " +
          str(sonde_ds["lifted_index"].values) +
          " " + str(sonde_ds["lifted_index"].units))
    print("Surface based CAPE = " +
          str(sonde_ds["surface_based_cape"].values) +
          " " +
          str(sonde_ds["surface_based_cape"].units))
    print("Surface based CIN = " +
          str(sonde_ds["surface_based_cin"].values) +
          " " +
          str(sonde_ds["surface_based_cin"].units))
    print("Most unstable CAPE = " +
          str(sonde_ds["most_unstable_cape"].values) +
          " " +
          str(sonde_ds["most_unstable_cape"].units))
    print("Most unstable CIN = " +
          str(sonde_ds["most_unstable_cin"].values) +
          " " +
          str(sonde_ds["most_unstable_cin"].units))
    print("LCL temperature = " +
          str(sonde_ds["lifted_condensation_level_temperature"].values) +
          " " +
          str(sonde_ds["lifted_condensation_level_temperature"].units))
    print("LCL pressure = " +
          str(sonde_ds["lifted_condensation_level_pressure"].values) +
          " " +
          str(sonde_ds["lifted_condensation_level_pressure"].units))
    sonde_ds.close()


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

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


.. _sphx_glr_download_source_auto_examples_get_stability_indices_example.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: get_stability_indices_example.py <get_stability_indices_example.py>`



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

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


.. only:: html

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

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