Skew-T plot of a sounding#

This example shows how to make a Skew-T plot from a sounding and calculate stability indicies.

sgpsondewnpnC1.b1 on 20190101
['base_time', 'time_offset', 'qc_time', 'pres', 'qc_pres', 'tdry', 'qc_tdry', 'dp', 'qc_dp', 'wspd', 'qc_wspd', 'deg', 'qc_deg', 'rh', 'qc_rh', 'u_wind', 'qc_u_wind', 'v_wind', 'qc_v_wind', 'wstat', 'asc', 'qc_asc', 'lat', 'lon', 'alt']
/usr/share/miniconda3/envs/act-docs/lib/python3.10/site-packages/metpy/interpolate/one_dimension.py:147: UserWarning: Interpolation point out of data bounds encountered
  warnings.warn('Interpolation point out of data bounds encountered')
<xarray.DataArray 'lifted_index' ()>
array(28.47592111)
Attributes:
    units:      kelvin
    long_name:  Lifted index

from matplotlib import pyplot as plt
import metpy
import xarray as xr

import act

# Make sure attributes are retained
xr.set_options(keep_attrs=True)

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

print(list(sonde_ds))
# Calculate stability indicies
sonde_ds = act.retrievals.calculate_stability_indicies(
    sonde_ds, temp_name='tdry', td_name='dp', p_name='pres', rh_name='rh'
)
print(sonde_ds['lifted_index'])

# Set up plot
skewt = act.plotting.SkewTDisplay(sonde_ds, figsize=(15, 10))

# Add data
skewt.plot_from_u_and_v('u_wind', 'v_wind', 'pres', 'tdry', 'dp')
sonde_ds.close()
plt.show()

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

Gallery generated by Sphinx-Gallery