calcs package
calcs
Calculate the entraining CAPE (ECAPE) of a parcel
- src.ecape.calc.calc_ecape(height_msl: ndarray[Any, dtype[Quantity]], pressure: ndarray[Any, dtype[Quantity]], temperature: ndarray[Any, dtype[Quantity]], specific_humidity: ndarray[Any, dtype[Quantity]], u_wind: ndarray[Any, dtype[Quantity]], v_wind: ndarray[Any, dtype[Quantity]], cape_type: str = 'most_unstable', undiluted_cape: Quantity = None) Quantity
Calculate the entraining CAPE (ECAPE) of a parcel
Parameters:
- height_msl: np.ndarray[pint.Quantity]
Atmospheric heights at the levels given by ‘pressure’ (MSL)
- pressure: np.ndarray[pint.Quantity]
Total atmospheric pressure
- temperature: np.ndarray[pint.Quantity]
Air temperature
- specific humidity: np.ndarray[pint.Quantity]
Specific humidity
- u_wind: np.ndarray[pint.Quantity]
X component of the wind
- v_wind np.ndarray[pint.Quantity]
Y component of the wind
- cape_type: str
Variation of CAPE desired. ‘most_unstable’ (default), ‘surface_based’, or ‘mixed_layer’
- undiluted_cape: pint.Quantity
User-provided undiluted CAPE value
Returns:
- ecape‘pint.Quantity’
Entraining CAPE
- src.ecape.calc.calc_ecape_a(sr_wind: ndarray[Any, dtype[Quantity]], psi: Quantity, ncape: Quantity, cape: Quantity) Quantity
Calculate the entraining cape of a parcel
- Parameters:
sr_wind – 0-1 km AGL average storm relative wind magnitude
psi – Parameter defined in eqn. 52, constant for a given equilibrium level
ncape – Buoyancy dilution potential of the free troposphere (eqn. 54)
cape – Convective available potential energy (CAPE, user-defined type)
- Returns:
Entraining CAPE (eqn. 55)
- Return type:
ecape
- src.ecape.calc.calc_el_height(pressure: ndarray[Any, dtype[Quantity]], height_msl: ndarray[Any, dtype[Quantity]], temperature: ndarray[Any, dtype[Quantity]], dew_point_temperature: ndarray[Any, dtype[Quantity]], parcel_func: Callable) Tuple[int, Quantity]
Retrieve a parcel’s equilibrium level (el).
- Parameters:
pressure – Total atmospheric pressure
height_msl – Atmospheric heights at the levels given by ‘pressure’.
temperature – Air temperature
dew_point_temperature – Dew point temperature
parcel_func – parcel profile retrieval callable via MetPy
- Returns:
index of the last instance of positive buoyancy below the el el_z:
height of the last instance of positive buoyancy below the el
- Return type:
el_idx
- src.ecape.calc.calc_integral_arg(moist_static_energy_bar, moist_static_energy_star, temperature) ndarray[Any, dtype[Quantity]]
Calculate the contents of the integral defined in the NCAPE equation (54).
- Parameters:
moist_static_energy_bar – Mean moist static energy from the surface to a layer
moist_static_energy_star – Saturated moist static energy
temperature – Air temperature
- Returns:
Contents of integral defined in NCAPE eqn. 54
- Return type:
integral_arg
- src.ecape.calc.calc_lfc_height(pressure: ndarray[Any, dtype[Quantity]], height_msl: ndarray[Any, dtype[Quantity]], temperature: ndarray[Any, dtype[Quantity]], dew_point_temperature: ndarray[Any, dtype[Quantity]], parcel_func: Callable) Tuple[int, Quantity]
Retrieve a parcel’s level of free convection (lfc).
- Parameters:
pressure – Total atmospheric pressure
height_msl – Atmospheric heights at the levels given by ‘pressure’.
temperature – Air temperature
dew_point_temperature – Dew point temperature
parcel_func – parcel profile retrieval callable via MetPy
- Returns:
index of the last instance of negative buoyancy below the lfc lfc_z:
height of the last instance of negative buoyancy below the lfc
- Return type:
lfc
- src.ecape.calc.calc_mse(pressure: ndarray[Any, dtype[Quantity]], height_msl: ndarray[Any, dtype[Quantity]], temperature: ndarray[Any, dtype[Quantity]], specific_humidity: ndarray[Any, dtype[Quantity]]) Tuple[ndarray[Any, dtype[Quantity]], ndarray[Any, dtype[Quantity]]]
Calculate the moist static energy terms of interest.
- Parameters:
pressure – Total atmospheric pressure
height_msl – Atmospheric heights at the levels given by ‘pressure’.
temperature – Air temperature
specific_humidity – Specific humidity
- Returns:
Mean moist static energy from the surface to a layer moist_static_energy_star:
Saturated moist static energy
- Return type:
moist_static_energy_bar
- src.ecape.calc.calc_ncape(integral_arg: ndarray[Any, dtype[Quantity]], height_msl: ndarray[Any, dtype[Quantity]], lfc_idx: int, el_idx: int) Quantity
Calculate the buoyancy dilution potential (NCAPE)
- Parameters:
integral_arg – Contents of integral defined in NCAPE eqn. 54
height_msl – Atmospheric heights at the levels given by ‘pressure’.
lfc_idx – Index of the last instance of negative buoyancy below the lfc
el_idx – Index of the last instance of positive buoyancy below the el
- Returns:
Buoyancy dilution potential of the free troposphere (eqn. 54)
- Return type:
ncape
- src.ecape.calc.calc_psi(el_z: Quantity) Quantity
Calculate the constant psi as denoted in eqn. 52
- Parameters:
el_z – height of the last instance of positive buoyancy below the el
- Returns:
Parameter defined in eqn. 52, constant for a given equilibrium level, see COMPUTE_ECAPE.m L88 (pitchfork)
- Return type:
psi
- src.ecape.calc.calc_sr_wind(pressure: ndarray[Any, dtype[Quantity]], u_wind: ndarray[Any, dtype[Quantity]], v_wind: ndarray[Any, dtype[Quantity]], height_msl: ndarray[Any, dtype[Quantity]]) Quantity
Calculate the mean storm relative (as compared to Bunkers right motion) wind magnitude in the 0-1 km AGL layer
- Parameters:
pressure – Total atmospheric pressure
u_wind – X component of the wind
v_wind – Y component of the wind
height_msl – Atmospheric heights at the levels given by ‘pressure’.
- Returns:
0-1 km AGL average storm relative wind magnitude
- Return type:
sr_wind