.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "source/auto_examples/retrievals/plot_get_stability_indices_example.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_source_auto_examples_retrievals_plot_get_stability_indices_example.py: 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-42 .. rst-class:: sphx-glr-script-out .. code-block:: none lifted_index: 28.475911738044147 units=kelvin surface_based_cape: 0.9631748579887774 units=J/kg surface_based_cin: 0 units=J/kg most_unstable_cape: 0 units=J/kg most_unstable_cin: 0 units=J/kg lifted_condensation_level_temperature: -8.078216552734375 units=degree_Celsius lifted_condensation_level_pressure: 927.1637573242188 units=hectopascal | .. code-block:: Python import warnings from arm_test_data import DATASETS import act warnings.filterwarnings('ignore') def print_summary(ds, variables): for var_name in variables: print(f'{var_name}: {ds[var_name].values} ' f"units={ds[var_name].attrs['units']}") print() filename_sonde = DATASETS.fetch('sgpsondewnpnC1.b1.20190101.053200.cdf') sonde_ds = act.io.arm.read_arm_netcdf(filename_sonde) sonde_ds = act.retrievals.calculate_stability_indicies( sonde_ds, temp_name='tdry', td_name='dp', p_name='pres' ) variables = [ 'lifted_index', 'surface_based_cape', 'surface_based_cin', 'most_unstable_cape', 'most_unstable_cin', 'lifted_condensation_level_temperature', 'lifted_condensation_level_pressure', ] print_summary(sonde_ds, variables) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.125 seconds) .. _sphx_glr_download_source_auto_examples_retrievals_plot_get_stability_indices_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_get_stability_indices_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_get_stability_indices_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_get_stability_indices_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_