.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/atmosphere/plot_09_von_bezold_potential_temperature.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 or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_atmosphere_plot_09_von_bezold_potential_temperature.py: von Bezold's potential temperature (1888) ========================================= Wilhelm von Bezold named the temperature a sample of air would have if brought adiabatically to a standard pressure. Unlike temperature it does not change when dry air rises or sinks, so it labels air masses. In a sounding whose temperature falls more slowly than 9.8 K/km, potential temperature increases with height and the column is stable. The conversion back to temperature recovers the sounding exactly. .. GENERATED FROM PYTHON SOURCE LINES 12-33 .. image-sg:: /api/gallery/atmosphere/images/sphx_glr_plot_09_von_bezold_potential_temperature_001.png :alt: A stable sounding :srcset: /api/gallery/atmosphere/images/sphx_glr_plot_09_von_bezold_potential_temperature_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.atmosphere import barometric_pressure, potential_temperature, temperature_from_potential from earthsciencekit.constants import GRAVITY height = np.linspace(0, 10e3, 101) temperature = 288.15 - 0.0065 * height pressure = barometric_pressure(101325, height, 255, GRAVITY) theta = potential_temperature(temperature, pressure, 1e5) np.testing.assert_allclose(temperature_from_potential(theta, pressure, 1e5), temperature) assert np.all(np.diff(theta) > 0) fig, ax = plt.subplots() ax.plot(temperature, height / 1000, label="temperature") ax.plot(theta, height / 1000, ls="--", label="potential temperature (1000 hPa)") ax.set(xlabel="[K]", ylabel="height [km]", title="A stable sounding") ax.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.074 seconds) .. _sphx_glr_download_api_gallery_atmosphere_plot_09_von_bezold_potential_temperature.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/atmosphere/plot_09_von_bezold_potential_temperature.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_09_von_bezold_potential_temperature.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_09_von_bezold_potential_temperature.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_09_von_bezold_potential_temperature.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_