Note
Go to the end to download the full example code.
Retrieve stability indicies from a sounding#
This example shows how to retrieve CAPE, CIN, and lifted index from a sounding.
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
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)
Total running time of the script: (0 minutes 0.121 seconds)