Equivalent Potential Temperature#
Use functions from
metpy.calc as well as pint’s unit support to perform calculations.
The code below uses example data from our test suite to calculate the equivalent potential temperature over the provided sounding data and plots the values up to 300-hPa.
import matplotlib.pyplot as plt import pandas as pd from metpy.calc import equivalent_potential_temperature from metpy.cbook import get_test_data from metpy.units import units
Upper air data can be obtained using the siphon package, but for this example we will use some of MetPy’s sample data.
Drop any rows with all NaN values for T, Td, winds
Isolate pressure, temperature, dewpoint, and height and add units
Calculate the equivalent potential temperature for the whole sounding
Define a layer with pressure greater than 300 hPa
Use the layer defined above and plot the equivalent potential temperature
Total running time of the script: ( 0 minutes 0.141 seconds)