calcs package

calcs

Calculate the entraining CAPE (ECAPE) of a parcel

src.ecape.calc.calc_ecape(height: ndarray[Quantity], pressure: ndarray[Quantity], temperature: ndarray[Quantity], specific_humidity: ndarray[Quantity], u_wind: ndarray[Quantity], v_wind: ndarray[Quantity], cape_type: str = 'most_unstable') Quantity

Calculate the entraining CAPE (ECAPE) of a parcel

Parameters:

height: np.ndarray[pint.Quantity]

Atmospheric heights at the levels given by ‘pressure’.

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: np.ndarray[pint.Quantity]

Variation of CAPE desired. ‘most_unstable’ (default), ‘surface_based’, or ‘mixed_layer’

Returns:

ecape‘pint.Quantity’

Entraining CAPE

src.ecape.calc.calc_ecape_a(sr_wind: ndarray[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[Quantity], height: ndarray[Quantity], temperature: ndarray[Quantity], dew_point_temperature: ndarray[Quantity], parcel_func: Callable) Tuple[int, Quantity]

Retrieve a parcel’s equilibrium level (el).

Parameters:
  • pressure – Total atmospheric pressure

  • height – 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[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[Quantity], height: ndarray[Quantity], temperature: ndarray[Quantity], dew_point_temperature: ndarray[Quantity], parcel_func: Callable) Tuple[int, Quantity]

Retrieve a parcel’s level of free convection (lfc).

Parameters:
  • pressure – Total atmospheric pressure

  • height – 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[Quantity], height: ndarray[Quantity], temperature: ndarray[Quantity], specific_humidity: ndarray[Quantity]) Tuple[ndarray[Quantity], ndarray[Quantity]]

Calculate the moist static energy terms of interest.

Parameters:
  • pressure – Total atmospheric pressure

  • height – 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[Quantity], height: ndarray[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 – 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[Quantity], u_wind: ndarray[Quantity], v_wind: ndarray[Quantity], height: ndarray[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 – Atmospheric heights at the levels given by ‘pressure’.

Returns:

0-1 km AGL average storm relative wind magnitude

Return type:

sr_wind