Retrieve stability indicies from a sounding#

This example shows how to retrieve CAPE, CIN, and lifted index from a sounding.

lifted_index: 28.47592110608585 units=kelvin
surface_based_cape: 0.6242085963918388 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.078224529338513 units=degree_Celsius
lifted_condensation_level_pressure: 927.1638157194121 units=hectopascal

import warnings

import act

warnings.filterwarnings('ignore')


def print_summary(obj, variables):
    for var_name in variables:
        print(f'{var_name}: {obj[var_name].values} ' f"units={obj[var_name].attrs['units']}")
    print()


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

sonde_ds = act.retrievals.calculate_stability_indicies(
    sonde_ds, temp_name='tdry', td_name='dp', p_name='pres', rh_name='rh'
)

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.177 seconds)

Gallery generated by Sphinx-Gallery