sharppy.sharptab package¶
Submodules¶
Modules that perform data analysis and processing tasks in SHARPpy.
sharppy.sharptab.constants module¶
Contains constants used by the SHARPpy routines.
Frequently used meteorological constants
sharppy.sharptab.fire module¶
Contains routines that analyze the potential for fire weather using sounding profiles.
The Fosberg Fire Weather Index Adapted from code donated by Rich Thompson - NOAA Storm Prediction Center
Description: The FWI (Fire Weather Index) is defined by a quantitative model that provides a nonlinear filter of meteorological data which results in a linear relationship between the combined meteorological variables of relative humidity and wind speed, and the behavior of wildfires. Thus the index deals with only the weather conditions, not the fuels. Several sets of conditions have been defined by Fosberg (Fosberg, 1978) to apply this to fire weather management. The upper limits have been set to give an index value of 100 if the moisture content is zero and the wind is 30 mph.
Thus, the numbers range from 0 to 100 and if any number is larger than 100, it is set back to 100. The index can be used to measure changes in fire weather conditions. Over several years of use, Fosberg index values of 50 or greater generally appear significant on a national scale. The SPC fire weather verification scheme uses the Fosberg Index, but with a check for both temperature (60F) and adjective fire danger rating (3-High, 4-Very High, 5-Extreme).
Description Source - http://www.spc.noaa.gov/exper/firecomp/INFO/fosbinfo.html
WARNING: This function has not been fully tested.
- Parameters
prof (profile object) – Profile object
- Returns
param – Fosberg Fire Weather Index
- Return type
number
Haines Index Height calculation
Calculates the appropriate height category(Low/Mid/High) given the the lowest height in the sounding.
Adapted from S-591 course Added by Nickolai Reimer (NWS Billings, MT)
- Parameters
prof (profile object) – Profile object
- Returns
param – the Haines Index Height
- Return type
number
Haines Index High Elevation calculation
Calculates the Haines Index(Lower Atmosphere Severity Index) using the higher elevation parmeters, used above 3000ft or 914 m.
Pressure levels 700 mb and 500 mb Dewpoint depression at 700 mb
1 : < 18C 2 : 18C to 21C 3 : > 21C
1 : < 15C 2 : 15C to 20C 3 : > 20C
Adapted from S-591 course Added by Nickolai Reimer (NWS Billings, MT)
- Parameters
prof (profile object) – Profile object
- Returns
param – the Haines Index high
- Return type
number
Haines Index Low Elevation calculation
Calculates the Haines Index(Lower Atmosphere Severity Index) using the lower elevation parmeters, used below 1000ft or 305 m.
Pressure levels 950 mb and 850 mb Dewpoint depression at 850 mb
1 : < 4C 2 : 4C to 7C 3 : > 7C
1 : < 6C 2 : 6C to 9C 3 : > 9C
Adapted from S-591 course Added by Nickolai Reimer (NWS Billings, MT)
- Parameters
prof (profile object) – Profile object
- Returns
param – the Haines Index low
- Return type
number
Haines Index Mid Elevation calculation
Calculates the Haines Index(Lower Atmosphere Severity Index) using the middle elevation parmeters, used between 1000 ft or 305 m and 3000 ft or 914 m.
Pressure levels 850 mb and 700 mb Dewpoint depression at 850 mb
1 : < 6C 2 : 6C to 10C 3 : > 10C
1 : < 6C 2 : 6C to 12C 3 : > 12C
Adapted from S-591 course Added by Nickolai Reimer (NWS Billings, MT)
- Parameters
prof (profile object) – Profile object
- Returns
param – the Haines Index mid
- Return type
number
sharppy.sharptab.interp module¶
Contains routines that use the numpy interpolation routines to interpolate various variables in the sounding data.
Interpolation Routines
Interpolates the given data to calculate a pressure at a given height
- Parameters
prof (profile object) – Profile object
h (number, numpy array) – Height (m) of the level for which pressure is desired
- Returns
Pressure (hPa) at the given height
- Return type
number, numpy array
Interpolates the given data to calculate a height at a given pressure
- Parameters
prof (profile object) – Profile object
p (number, numpy array) – Pressure (hPa) of the level for which height is desired
- Returns
Height (m) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate a temperature at a given pressure
- Parameters
prof (profile object) – Profile object
p (number, numpy array) – Pressure (hPa) of the level for which temperature is desired
- Returns
Temperature (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate a dew point temperature at a given pressure
- Parameters
prof (profile object) – Profile object
p (number, numpy array) – Pressure (hPa) of the level for which dew point temperature is desired
- Returns
Dew point tmperature (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate a virtual temperature at a given pressure
- Parameters
prof (profile object) – Profile object
p (number, numpy array) – Pressure (hPa) of the level for which virtual temperature is desired
- Returns
Virtual tmperature (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate the U and V components at a given pressure
- Parameters
prof (profile object) – Profile object
p (number, numpy array) – Pressure (hPa) of a level
- Returns
U and V components at the given pressure (kts)
- Return type
number, numpy array
Interpolates the given data to calculate the wind direction and speed at a given pressure
- Parameters
p (number, numpy array) – Pressure (hPa) of a level
prof (profile object) – Profile object
- Returns
Wind direction (degrees) and magnitude (kts) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate theta-e at a given pressure
- Parameters
prof (profile object) –
object (Profile) –
p (number, numpy array) –
(hPa) of the level for which temperature is desired (Pressure) –
- Returns
Theta-E (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate a wetbulb temperature at a given pressure
- Parameters
prof (profile object) –
object (Profile) –
p (number, numpy array) –
(hPa) of the level for which wetbulb temperature is desired (Pressure) –
- Returns
Wetbulb temperature (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate theta at a given pressure
- Parameters
prof (profile object) –
object (Profile) –
p (number, numpy array) –
(hPa) of the level for which potential temperature is desired (Pressure) –
- Returns
Theta (C) at the given pressure
- Return type
number, numpy array
Interpolates the given data to calculate water vapor mixing ratio at a given pressure
- Parameters
prof (profile object) –
object (Profile) –
p (number, numpy array) –
(hPa) of the level for which mixing ratio is desired (Pressure) –
- Returns
Water vapor mixing ratio (g/kg) at the given pressure
- Return type
number, numpy array
Convert a height from mean sea-level (MSL) to above ground-level (AGL)
- Parameters
h (number, numpy array) – Height of a level
prof (profile object) – Profile object
- Returns
Converted height (m AGL)
- Return type
number, numpy array
Convert a height from above ground-level (AGL) to mean sea-level (MSL)
- Parameters
h (number, numpy array) – Height of a level
prof (profile object) – Profile object
- Returns
Converted height (m MSL)
- Return type
number, numpy array
sharppy.sharptab.params module¶
Contains a wide variety of routines that calculate convection indices.
Thermodynamic Parameter Routines
Bases:
object
Create a parcel from a supplied profile object.
- Parameters
prof (profile object) – Profile object
Keywords (Optional) – flag : int (default = 1) Parcel Selection
- Observed Surface Parcel (1) –
- Forecast Surface Parcel (2) –
- Most Unstable Parcel (3) –
- Mean Mixed Layer Parcel (4) –
- User Defined Parcel (5) –
- Mean Effective Layer Parcel (6) –
Keywords (Depending on Parcel Selected) (Optional) –
(flag) == 1 (Parcel) – None
(flag) == 2 (Parcel) –
pres (number (default = SFC - 100 hPa)) – Depth over which to mix the boundary layer; only changes temperature; does not affect moisture
(flag) == 3 (Parcel) –
pres – Depth over which to look for the the most unstable parcel
from the surface pressure (starting) – Parcel (flag) == 4: Mixed Layer Parcel
pres – Depth over which to mix the surface parcel
(flag) == 5 (Parcel) –
pres – Pressure of the parcel to lift
tmpc (number (default = Temperature at the provided pressure)) – Temperature of the parcel to lift
dwpc (number (default = Dew Point at the provided pressure)) – Dew Point of the parcel to lift
(flag) == 6 (Parcel) –
ecape (number (default = 100)) – The minimum amount of CAPE a parcel needs to be considered part of the inflow layer
ecinh (number (default = -250)) – The maximum amount of CINH allowed for a parcel to be considered as part of the inflow layer
Bases:
object
Initialize the parcel variables
- Parameters
pbot (number) – Lower-bound (pressure; hPa) that the parcel is lifted
ptop (number) – Upper-bound (pressure; hPa) that the parcel is lifted
pres (number) – Pressure of the parcel to lift (hPa)
tmpc (number) – Temperature of the parcel to lift (C)
dwpc (number) – Dew Point of the parcel to lift (C)
parcel beginning pressure (mb)
- Type
number
parcel beginning temperature (C)
- Type
number
parcel beginning dewpoint (C)
- Type
number
parcel trace pressure (mb)
- Type
array
parcel trace temperature (C)
- Type
array
Pressure of the bottom of the layer the parcel is lifted (mb)
- Type
number
Pressure of the top of the layer the parcel is lifted (mb)
- Type
number
Parcel entrainment fraction (not yet implemented)
- Type
number
Parcel LCL (lifted condensation level) pressure (mb)
- Type
number
Parcel LCL height (m AGL)
- Type
number
Parcel LFC (level of free convection) pressure (mb)
- Type
number
Parcel LCL height (m AGL)
- Type
number
Parcel EL (equilibrium level) pressure (mb)
- Type
number
Parcel EL height (m AGL)
- Type
number
Maximum Parcel Level (mb)
- Type
number
Maximum Parcel Level (m AGL)
- Type
number
Parcel CAPE (J/kg)
- Type
number
Parcel CIN below 500 mb (J/kg)
- Type
number
Parcel CAPE up to freezing level (J/kg)
- Type
number
Parcel CAPE up to 3 km (J/kg)
- Type
number
Parcel CAPE up to 6 km (J/kg)
- Type
number
Pressure value at 0 C (mb)
- Type
number
Pressure value at -10 C (mb)
- Type
number
Pressure value at -20 C (mb)
- Type
number
Pressure value at -30 C (mb)
- Type
number
Height value at 0 C (m AGL)
- Type
number
Height value at -10 C (m AGL)
- Type
number
Height value at -20 C (m AGL)
- Type
number
Height value at -30 C (m AGL)
- Type
number
Wetbulb at -10 C (C)
- Type
number
Wetbulb at -20 C (C)
- Type
number
Wetbulb at -30 C (C)
- Type
number
500-mb lifted index (C)
- Type
number
300-mb lifted index (C)
- Type
number
Bulk Richardson Number Shear (kts)
- Type
number
U-component Bulk Richardson Number Shear (kts)
- Type
number
V-component Bulk Richardson Number Shear (kts)
- Type
number
Bulk Richardson Number (unitless)
- Type
number
Maximum lifted index value (C)
- Type
number
Pressure at Maximum lifted index (mb)
- Type
number
Cap strength (C)
- Type
number
Cap strength pressure (mb)
- Type
number
Buoyancy minimum (C)
- Type
number
Pressure at the buoyancy minimum (mb)
- Type
number
Calculates the K-Index from a profile object
- Parameters
prof (profile object) – Profile Object
- Returns
k_index – K-Index
- Return type
number
Calculates the Total Totals Index from a profile object
- Parameters
prof (profile object) – Profile Object
- Returns
t_totals – Total Totals Index
- Return type
number
Calculates the Cross Totals Index from a profile object
- Parameters
prof (profile object) – Profile Object
- Returns
c_totals – Cross Totals Index
- Return type
number
Calculates the Vertical Totals Index from a profile object
- Parameters
prof (profile object) – Profile Object
- Returns
v_totals – Vertical Totals Index
- Return type
number
Calculates the precipitable water from a profile object within the specified layer. The default layer (lower=-1 & upper=-1) is defined to be surface to 400 hPa.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa).
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
pwat – Precipitable Water (in)
- Return type
number,
Calculates the level (hPa) of the first occurrence of the specified temperature.
- Parameters
prof (profile object) – Profile Object
temp (number) – Temperature being searched (C)
wetbulb (boolean) – Flag to indicate whether or not the wetbulb profile should be used instead
- Returns
First Level of the temperature (hPa)
- Return type
number
Calculates a maximum temperature forecast based on the depth of the mixing layer and low-level temperatures
- Parameters
prof (profile object) – Profile Object
mixlayer (number (optional; default = 100)) – Top of layer over which to “mix” (hPa)
- Returns
mtemp – Forecast Maximum Temperature
- Return type
number
Calculates the mean mixing ratio from a profile object within the specified layer.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
Mean Mixing Ratio
- Return type
number
Calculates the mean theta from a profile object within the specified layer.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
Mean Theta
- Return type
number
Calculates the mean theta-e from a profile object within the specified layer.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
Mean Theta-E
- Return type
number
Calculates the mean relative humidity from a profile object within the specified layer.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
Mean Relative Humidity
- Return type
number
Calculates the lapse rate (C/km) from a profile object
- Parameters
prof (profile object) – Profile Object
lower (number) – Lower Bound of lapse rate (mb or m AGL)
upper (number) – Upper Bound of lapse rate (mb or m AGL)
pres (bool (optional; default = True)) – Flag to determine if lower/upper are pressure [True] or height [False]
- Returns
lapse rate (C/km)
- Return type
number
Calculates the maximum lapse rate (C/km) between a layer at a specified interval
- Parameters
prof (profile object) – Profile object
lower (number) – Lower bound in height (m)
upper (number) – Upper bound in height (m)
interval (number) – Interval to assess the lapse rate at (m)
depth (number) – Depth of the layer to assess the lapse rate over (m)
- Returns
max lapse rate (C/km) (float)
lower pressure of max lapse rate (mb) (number)
upper pressure of max lapse rate (mb) (number)
Finds the most unstable level between the lower and upper levels.
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
Pressure level of most unstable level (hPa)
- Return type
number
Lifts the specified parcel, calculates various levels and parameters from the profile object. B+/B- are calculated based on the specified layer. Such parameters include CAPE, CIN, LCL height, LFC height, buoyancy minimum, EL height, MPL height.
!! All calculations use the virtual temperature correction unless noted. !!
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
pres (number (optional)) – Pressure of parcel to lift (hPa)
tmpc (number (optional)) – Temperature of parcel to lift (C)
dwpc (number (optional)) – Dew Point of parcel to lift (C)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
flag (number (optional; default = 5)) – Flag to determine what kind of parcel to create; See DefineParcel for flag values
lplvals (lifting parcel layer object (optional)) – Contains the necessary parameters to describe a lifting parcel
- Returns
- Return type
Parcel Object
Calculates the Bulk Richardson Number for a given parcel.
- Parameters
prof (profile object) – Profile object
pcl (parcel object) – Parcel object
- Returns
Bulk Richardson Number
- Return type
number
Compute the Bunkers Storm Motion for a right moving supercell using a parcel based approach. This code is consistent with the findings in Bunkers et. al 2014, using the Effective Inflow Base as the base, and 65% of the most unstable parcel equilibrium level height using the pressure weighted mean wind.
- Parameters
prof (profile object) – Profile Object
pbot (float (optional)) – Base of effective-inflow layer (hPa)
mupcl (parcel object (optional)) – Most Unstable Layer parcel
- Returns
rstu (number) – Right Storm Motion U-component (kts)
rstv (number) – Right Storm Motion V-component (kts)
lstu (number) – Left Storm Motion U-component (kts)
lstv (number) – Left Storm Motion V-component (kts)
Calculates the top and bottom of the effective inflow layer based on research by 3.
- Parameters
prof (profile object) – Profile object
ecape (number (optional; default=100)) – Minimum amount of CAPE in the layer to be considered part of the effective inflow layer.
echine (number (optional; default=250)) – Maximum amount of CINH in the layer to be considered part of the effective inflow layer
mupcl (parcel object) – Most Unstable Layer parcel
- Returns
pbot (number) – Pressure at the bottom of the layer (hPa)
ptop (number) – Pressure at the top of the layer (hPa)
Computes the convective temperature, assuming no change in the moisture profile. Parcels are iteratively lifted until only mincinh is left as a cap. The first guess is the observed surface temperature.
- Parameters
prof (profile object) – Profile Object
mincinh (parcel object (optional; default -1)) – Amount of CINH left at CI
pres (number (optional)) – Pressure of parcel to lift (hPa)
tmpc (number (optional)) – Temperature of parcel to lift (C)
dwpc (number (optional)) – Dew Point of parcel to lift (C)
- Returns
Convective Temperature (C)
- Return type
number
Enhanced Stretching Potential (ESP) This composite parameter identifies areas where low-level buoyancy and steep low-level lapse rates are co-located, which may favor low-level vortex stretching and tornado potential.
REQUIRES: 0-3 km MLCAPE (from MLPCL)
- Parameters
prof (profile object) – Profile object
mlpcl (parcel object, optional) – Mixed-Layer Parcel object
- Returns
ESP Index
- Return type
number
Planetary Boundary Layer Depth Adapted from NSHARP code donated by Rich Thompson (SPC)
Calculates the planetary boundary layer depth by calculating the virtual potential temperature of the surface parcel + .5 K, and then searching for the location above the surface where the virtual potential temperature of the profile is greater than the surface virtual potential temperature.
While this routine suggests a parcel lift, this Python adaptation does not use loop like parcelx().
- Parameters
prof (profile object) – Profile object
- Returns
ppbl_top (mb)
- Return type
number
Precipitation Efficiency (*)
This calculation comes from Noel and Dobur 2002, published in NWA Digest Vol 26, No 34.
The calculation multiplies the PW from the whole atmosphere by the 1000 - 700 mb mean relative humidity (in decimal form)
Values on the SPC Mesoanalysis range from 0 to 2.6.
Larger values means that the precipitation is more efficient.
Warning
This function has not been directly compared with a version at SPC.
- Parameters
prof (profile object) – Profile object
pwat (number, optional) – precomputed precipitable water vapor (inch)
pbot (number, optional) – the bottom pressure of the RH layer (mb)
ptop (number, optional) – the top pressure of the RH layer (mb)
- Returns
precip_efficency (inches)
- Return type
number
Downdraft CAPE (DCAPE)
Adapted from John Hart’s (SPC) DCAPE code in NSHARP donated by Rich Thompson (SPC)
Calculates the downdraft CAPE value using the downdraft parcel source found in the lowest 400 mb of the sounding. This downdraft parcel is found by identifying the minimum 100 mb layer averaged Theta-E.
Afterwards, this parcel is lowered to the surface moist adiabatically (w/o virtual temperature correction) and the energy accumulated is called the DCAPE.
Future adaptations of this function may utilize the Parcel/DefineParcel object.
- Parameters
prof (profile object) – Profile object
- Returns
dcape (number) – downdraft CAPE (J/kg)
ttrace (array) – downdraft parcel trace temperature (C)
ptrace (array) – downdraft parcel trace pressure (mb)
Significant Severe (SigSevere) Craven and Brooks, 2004
- Parameters
prof (profile object) – Profile object
mlpcl (parcel object, optional) – Mixed-Layer Parcel object
- Returns
significant severe parameter (m3/s3)
- Return type
number
Dendritic Growth Zone Levels
This function finds the pressure levels for the dendritic growth zone (from -12 C to -17 C). If either temperature cannot be found, it is set to be the surface pressure.
- Parameters
prof (profile object) – Profile Object
- Returns
pbot (number) – Pressure of the bottom level (mb)
ptop (number) – Pressure of the top level (mb)
Calculate the Sig Hail Parameter (SHIP)
Ryan Jewell (SPC) helped in correcting this equation as the SPC sounding help page version did not have the correct information of how SHIP was calculated.
The significant hail parameter (SHIP; SPC 2014) is an index developed in-house at the SPC. (Johnson and Sugden 2014)
- Parameters
prof (profile object) – Profile object
mupcl (parcel object, optional) – Most Unstable Parcel object
lr75 (float, optional) – 700 - 500 mb lapse rate (C/km)
h5_temp (float, optional) – 500 mb temperature (C)
shr06 (float, optional) – 0-6 km shear (m/s)
frz_lvl (float, optional) – freezing level (m)
- Returns
ship – significant hail parameter (unitless)
- Return type
number
Significant Tornado Parameter (w/CIN)
Formulated using the methodology outlined in 1. Used to detect environments where significant tornadoes are possible within the United States. Uses the effective inflow layer calculations in 3 and was created as an alternative to 2.
- 1
Thompson, R. L., B. T. Smith, J. S. Grams, A. R. Dean, and C. Broyles, 2012: Convective modes for significant severe thunderstorms in the contiguous United States.Part II: Supercell and QLCS tornado environments. Wea. Forecasting, 27, 1136–1154,doi:https://doi.org/10.1175/WAF-D-11-00116.1.
- 3(1,2)
Thompson, R. L., C. M. Mead, and R. Edwards, 2007: Effective storm-relative helicity and bulk shear in supercell thunderstorm environments. Wea. Forecasting, 22, 102–115, doi:https://doi.org/10.1175/WAF969.1.
- Parameters
mlcape (float) – Mixed-layer CAPE from the parcel class (J/kg)
esrh (float) – effective storm relative helicity (m2/s2)
ebwd (float) – effective bulk wind difference (m/s)
mllcl (float) – mixed-layer lifted condensation level (m)
mlcinh (float) – mixed-layer convective inhibition (J/kg)
- Returns
stp_cin – significant tornado parameter (unitless)
- Return type
number
See also
Significant Tornado Parameter (fixed layer)
Formulated using the methodology in 2. Used to detect environments where significant tornadoes are possible within the United States.
- 2(1,2,3)
Thompson, R. L., R. Edwards, J. A. Hart, K. L. Elmore, and P. Markowski, 2003: Close proximity soundings within supercell environments obtained from the Rapid Update Cycle. Wea. Forecasting, 18, 1243–1261, doi:https://doi.org/10.1175/1520-0434(2003)018<1243:CPSWSE>2.0.CO;2
- Parameters
sbcape (number) – Surface based CAPE from the parcel class (J/kg)
sblcl (number) – Surface based lifted condensation level (LCL) (m)
srh01 (number) – Surface to 1 km storm relative helicity (m2/s2)
bwd6 (number) – Bulk wind difference between 0 to 6 km (m/s)
- Returns
stp_fixed – signifcant tornado parameter (fixed-layer)
- Return type
number
Supercell Composite Parameter
From Thompson et al. 2004, updated from the methodology in 2 and uses the effective inflow layer.
- Parameters
prof (profile object) – Profile object
mucape (number, optional) – Most Unstable CAPE from the parcel class (J/kg) (optional)
srh (number, optional) – the effective SRH from the winds.helicity function (m2/s2)
ebwd (number, optional) – effective bulk wind difference (m/s)
- Returns
scp – supercell composite parameter
- Return type
number
MCS Maintenance Probability (MMP) The probability that a mature MCS will maintain peak intensity for the next hour.
This equation was developed using proximity soundings and a regression equation Uses MUCAPE, 3-8 km lapse rate, maximum bulk shear, 3-12 km mean wind speed. Derived in 4.
- 4
Coniglio, M. C., D. J. Stensrud, and L. J. Wicker, 2006: Effects of upper-level shear on the structure and maintenance of strong quasi-linear mesoscale convective systems. J. Atmos. Sci., 63, 1231–1251, doi:https://doi.org/10.1175/JAS3681.1.
Note: Per Mike Coniglio (personal comm.), the maximum deep shear value is computed by computing the shear vector between all the wind vectors in the lowest 1 km and all the wind vectors in the 6-10 km layer. The maximum speed shear from this is the max_bulk_shear value (m/s).
- Parameters
prof (profile object) – Profile object
mupcl (parcel object, optional) – Most-Unstable Parcel object
- Returns
MMP index (%)
- Return type
number
Wind Damage Parameter (WNDG)
A non-dimensional composite parameter that identifies areas where large CAPE, steep low-level lapse rates, enhanced flow in the low-mid levels, and minimal convective inhibition are co-located.
WNDG values > 1 favor an enhanced risk for scattered damaging outflow gusts with multicell thunderstorm clusters, primarily during the afternoon in the summer.
- Parameters
prof (profile object) – Profile object
mlpcl (parcel object, optional) – Mixed-Layer Parcel object (optional)
- Returns
WNDG Index
- Return type
number
Severe Hazards In Environments with Reduced Buoyancy (SHERB) Parameter (*)
A composite parameter designed to assist forecasters in the High-Shear Low CAPE (HSLC) environment. This allows better discrimination between significant severe and non-severe convection in HSLC enviroments.
It can detect significant tornadoes and significant winds. Values above 1 are more likely associated with significant severe.
See Sherburn et. al. 2014 WAF for more information
REQUIRES (if effective==True): The effective inflow layer be defined
Warning
This function has not been evaluated or tested against the version used at SPC.
- Parameters
prof (profile object) – Profile object
effective (bool, optional) – Use the effective layer computation or not the effective bulk wind difference (prof.ebwd) must exist first if not specified it will (Default is False)
ebottom (number, optional) – bottom of the effective inflow layer (mb)
etop (number, optional) – top of the effective inflow layer (mb)
mupcl (parcel object, optional) – Most-Unstable Parcel
- Returns
SHERB
- Return type
number
Theta-E Index (TEI) TEI is the difference between the surface theta-e and the minimum theta-e value in the lowest 400 mb AGL
Note: This is the definition of TEI on the SPC help page, but these calculations do not match up with the TEI values on the SPC Online Soundings. The TEI values online are more consistent with the max Theta-E minus the minimum Theta-E found in the lowest 400 mb AGL.
- Parameters
prof (profile object) – Profile object
- Returns
tei – Theta-E Index
- Return type
number
Lifts the specified parcel, calculates various levels and parameters from the profile object. Only B+/B- are calculated based on the specified layer.
This is a convenience function for effective_inflow_layer and convective_temp, as well as any function that needs to lift a parcel in an iterative process. This function is a stripped back version of the parcelx function, that only handles bplus and bminus. The intention is to reduce the computation time in the iterative functions by reducing the calculations needed.
This method of creating a stripped down parcelx function for CAPE/CIN calculations was developed by Greg Blumberg and Kelton Halbert and later implemented in SPC’s version of SHARP to speed up their program.
For full parcel objects, use the parcelx function.
!! All calculations use the virtual temperature correction unless noted. !!
- Parameters
prof (profile object) – Profile Object
pbot (number (optional; default surface)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 400 hPa)) – Pressure of the top level (hPa)
pres (number (optional)) – Pressure of parcel to lift (hPa)
tmpc (number (optional)) – Temperature of parcel to lift (C)
dwpc (number (optional)) – Dew Point of parcel to lift (C)
dp (negative integer (optional; default = -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = False)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
flag (number (optional; default = 5)) – Flag to determine what kind of parcel to create; See DefineParcel for flag values
lplvals (lifting parcel layer object (optional)) – Contains the necessary parameters to describe a lifting parcel
- Returns
pcl – Parcel Object
- Return type
parcel object
Microburst Composite Index
Formulated by Chad Entremont NWS JAN 12/7/2014 Code donated by Rich Thompson (SPC)
Below is taken from the SPC Mesoanalysis: The Microburst Composite is a weighted sum of the following individual parameters: SBCAPE, SBLI, lapse rates, vertical totals (850-500 mb temperature difference), DCAPE, and precipitable water.
All of the terms are summed to arrive at the final microburst composite value. The values can be interpreted in the following manner: 3-4 infers a “slight chance” of a microburst; 5-8 infers a “chance” of a microburst; >= 9 infers that microbursts are “likely”. These values can also be viewed as conditional upon the existence of a storm.
This code was updated on 9/11/2018 - TT was being used in the function instead of VT. The original SPC code was checked to confirm this was the problem. This error was not identified during the testing phase for some reason.
- Parameters
prof (profile object) – Profile object
- Returns
mburst – Microburst Composite (unitless)
- Return type
number
Derecho Composite Parameter (*)
This parameter is based on a data set of 113 derecho events compiled by Evans and Doswell (2001). The DCP was developed to identify environments considered favorable for cold pool “driven” wind events through four primary mechanisms:
Cold pool production [DCAPE]
Ability to sustain strong storms along the leading edge of a gust front [MUCAPE]
Organization potential for any ensuing convection [0-6 km shear]
Sufficient flow within the ambient environment to favor development along downstream portion of the gust front [0-6 km mean wind].
This index is fomulated as follows: DCP = (DCAPE/980)*(MUCAPE/2000)*(0-6 km shear/20 kt)*(0-6 km mean wind/16 kt)
Reference: Evans, J.S., and C.A. Doswell, 2001: Examination of derecho environments using proximity soundings. Wea. Forecasting, 16, 329-342.
- Parameters
prof (profile object) – Profile object
- Returns
dcp – Derecho Composite Parameter (unitless)
- Return type
number
Energy-Helicity Index
Computes the energy helicity index (EHI) using a parcel object and a profile object.
The equation is EHI = (CAPE * HELICITY) / 160000.
- Parameters
prof (profile object) – Profile object
pcl (parcel object) – Parcel object
hbot (number) – Height of the bottom of the helicity layer [m]
htop (number) – Height of the top of the helicity layer [m]
stu (number) – Storm-relative wind U component [kts] (optional; default=0)
stv (number) – Storm-relative wind V component [kts] (optional; default=0)
- Returns
ehi – Energy Helicity Index (unitless)
- Return type
number
SWEAT Index
Computes the SWEAT (Severe Weather Threat Index) using the following numbers:
850 Dewpoint
Total Totals Index
850 mb wind speed
500 mb wind speed
Direction of wind at 500
Direction of wind at 850
Formulation taken from Notes on Analysis and Severe-Storm Forecasting Procedures of the Air Force Global Weather Central, 1972 by RC Miller.
Warning
This function has not been tested against the SPC version of SHARP.
- Parameters
prof (profile object) – Profile object
- Returns
sweat – SWEAT Index (number)
- Return type
number
Hail Growth Zone Levels
This function finds the pressure levels for the dendritic growth zone (from -10 C to -30 C). If either temperature cannot be found, it is set to be the surface pressure.
- Parameters
prof (profile object) – Profile Object
- Returns
pbot (number) – Pressure of the bottom level (mb)
ptop (number) – Pressure of the top level (mb)
Large Hail Parameter
From Johnson and Sugden (2014), EJSSM
Warning
This code has not been compared directly against an SPC version.
- Parameters
prof (profile object) – ConvectiveProfile object
- Returns
lhp – large hail parameter (unitless)
- Return type
number
sharppy.sharptab.prof_collection module¶
Code that describes the “Profile Collection” objects that is used by the sharppy.io.decoders and the SHARPpy GUI. This is essentially an object that is a collection of Profile objects.
Bases:
object
- ProfCollection: A class to keep track of profiles from a single data source. Handles time switching, ensemble member switching,
and modifications to profiles.
Change which member is highlighted. direction: An integer (either 1 or -1) specifying which direction to go in the list. The list is in
alphabetical order, so the members will be gone through in that order.
Advance time in a direction specified by ‘direction’. Returns a datetime object containing the new time. direction: An integer (ether 1 or -1) specifying which direction to move time in. 1 moves time forward,
-1 moves time backward.
Terminates any threads that are running in the background.
Defines a custom parcel for the current profile. parcel: A parcel object to use as the custom parcel.
If this is an analog, return the date of the analog. Otherwise, returns None.
Returns the current date in the profile object
Returns the profiles at the current time.
Gets the name of the member that is currently highlighted.
Returns which profile is highlighted.
Returns metadata about the profile. key: What metadata to return. index [optional]: If true, treat the metadata as an array with the same length as dates passed in the constructor.
Returns value of that array at this time index..
Returns True if the collection has a profile at the current time. Otherwise, returns False.
Returns True if the collection has metadata corresponding to ‘key’. Otherwise returns False.
Interpolate the profile object to a specific pressure level spacing.
Returns True if this collection has multiple ensemble members. Otherwise, returns False.
Returns True if the profiles at the current time have been modified. Returns False otherwise.
Returns True if the profiles at the current time have been modified. Returns False otherwise.
Modify the profile at the current time. idx: The vertical index to modify **kwargs: The variables to modify (‘tmpc’, ‘dwpc’, ‘u’, or ‘v’)
- TODO: Allow modification of layers. Could be that idx is -999 for layer
and kwargs passes information about the layers to be modified.
Reset the profile to its original state. *args: The variables to reset (‘tmpc’, ‘dwpc’, ‘u’, or ‘v’).
- Specify that this collection represents an analog; the date is set to ‘analog_to_date’, and the
analog date is set to the former date.
analog_to_date: A datetime object that specifies the date to which this collection is an analog.
Start an asynchronous process to load objects of type ‘target_type’ in the background. Used to upgrade the Profile objects to ConvectiveProfile objects in the background
async: An AsyncThreads instance.
Sets the current date to be ‘cur_dt’. cur_dt: A datetime object specifiying which date to set it to.
Sets the highlighted ensemble member to be ‘member_name’.
Sets the metadata ‘key’ to ‘value’.
Subset the profile collection over time. idxs: The time indices to include in the subsetted collection.
sharppy.sharptab.profile module¶
Contains code to create the Profile objects.
Create the Sounding (Profile) Object
Bases:
sharppy.sharptab.profile.Profile
The default data class for SHARPpy. All other data classes inherit from this class. This class holds the vertical data for pressure, height, temperature, dewpoint, and winds. This class has no indices computed.
Function to calculate the relative humidity profile
- Parameters
None –
- Returns
- Return type
Array of the relative humidity profile
Convenience function to get the index of the surface. It is determined by finding the lowest level in which a temperature is reported.
- Parameters
None –
- Returns
- Return type
Index of the surface
Function to calculate the theta profile.
- Parameters
None –
- Returns
- Return type
Array of theta profile
Function to calculate the theta-e profile.
- Parameters
None –
- Returns
- Return type
Array of theta-e profile
Convenience function to get the index of the surface. It is determined by finding the lowest level in which a temperature is reported.
- Parameters
None –
- Returns
- Return type
Index of the surface
Function to calculate the wetbulb profile.
- Parameters
None –
- Returns
- Return type
Array of wet bulb profile
Function to calculate the water vapor mixing ratio profile.
- Parameters
None –
- Returns
- Return type
Array of water vapor mixing ratio profile
Bases:
sharppy.sharptab.profile.BasicProfile
The Convective data class for SHARPPy. This is the class used to generate the indices that are default for the SPC NSHARP display.
This class inherits from the Profile object.
Function to compute the location of the current PWV with respect to it’s sounding climatology from Bunkers.
- Parameters
None –
- Returns
- Return type
None
Function to generate different indices and information regarding any fire weather in the sounding. This helps fill the data shown in the FIRE inset.
- Parameters
None –
- Returns
- Return type
None
Function to set any additional indices that are included in the thermo window.
- Parameters
None –
- Returns
- Return type
None
Function to generate the numerous kinematic quantities used for display and calculations. It requires that the parcel calculations have already been called for the lcl to el shear and mean wind vectors, as well as indices that require an effective inflow layer.
- Parameters
None –
- Returns
- Return type
None
Function to generate various parcels and parcel traces. Returns nothing, but sets the following variables:
self.mupcl : Most Unstable Parcel self.sfcpcl : Surface Based Parcel self.mlpcl : Mixed Layer Parcel self.fcstpcl : Forecast Surface Parcel self.ebottom : The bottom pressure level of the effective inflow layer self.etop : the top pressure level of the effective inflow layer self.ebotm : The bottom, meters (agl), of the effective inflow layer self.etopm : The top, meters (agl), of the effective inflow layer
- Parameters
None –
- Returns
- Return type
None
Function to generate different indices and information regarding any precipitation in the sounding. This helps fill the data shown in the WINTER inset.
Returns nothing, but sets the following variables:
self.dgz_pbot, self.dgz_ptop : the dendretic growth zone (DGZ) top and bottom (mb) self.dgz_meanrh : DGZ mean relative humidity (%) self.dgz_pw : the preciptable water vapor in the DGZ (inches) self.dgz_meanq : the mean water vapor mixing ratio in the DGZ (g/kg) self.dgz_meanomeg : the mean omega in the DGZ (microbars/second) self.oprh : the OPRH variable (units don’t mean anything) self.plevel, self.phase, self.tmp, self.st : the initial phase, level, temperature, and state of any precip in the sounding self.tpos, self.tneg, self.ttop, self.tbot : positive and negative temperature layers in the sounding self.wpos, self.wneg, self.wtop, self.wbot : positive and negative wetbulb layers in the soundings self.precip_type : the best guess precipitation type
- Parameters
None –
- Returns
- Return type
None
Function to get the SARS analogues from the hail and supercell databases. Requires calling get_kinematics() and get_parcels() first. Also calculates the significant hail parameter.
Function returns nothing, but sets the following variables:
self.matches - the matches from SARS HAIL self.ship - significant hail parameter self.supercell_matches - the matches from SARS SUPERCELL
- Parameters
None –
- Returns
- Return type
None
Function to calculate special severe weather indices. Requires calling get_parcels() and get_kinematics().
Returns nothing, but sets the following variables:
self.right_stp_fixed - fixed layer significant tornado parameter (computed with SRH relative to the right-mover vector) self.left_stp_fixed - fixed layer significant tornado parameter (computed with SRH relative to the left-mover vector) self.right_stp_cin - effective layer significant tornado parameter (computed with SRH relative to the right-mover vector) self.left_stp_cin - effective layer significant tornado parameter (computed with SRH relative to the left-mover vector) self.right_scp - right moving supercell composite parameter self.left_scp - left moving supercell composite parameter
- Parameters
None –
- Returns
- Return type
None
Function to generate thermodynamic indices.
Function returns nothing, but sets the following variables:
self.k_idx - K Index, a severe weather index self.pwat - Precipitable Water Vapor (inches) self.lapserate_3km - 0 to 3km AGL lapse rate (C/km) self.lapserate_3_6km - 3 to 6km AGL lapse rate (C/km) self.lapserate_850_500 - 850 to 500mb lapse rate (C/km) self.lapserate_700_500 - 700 to 500mb lapse rate (C/km) self.convT - The Convective Temperature (F) self.maxT - The Maximum Forecast Surface Temp (F) self.mean_mixr - Mean Mixing Ratio self.low_rh - low level mean relative humidity self.mid_rh - mid level mean relative humidity self.totals_totals - Totals Totals index, a severe weather index
- Parameters
None –
- Returns
- Return type
None
Function to compute the storm slinky profile using the trajectory model.
self.slinky_traj - the list containing the position vector for the updraft self.updraft_tilt - the updraft tilt (an angle) with respect to the horizon
- Parameters
None –
- Returns
- Return type
None
Function to get the possible watch type. Function returns nothing, but sets the following variables:
self.watch_type - possible watch type
- Parameters
None –
- Returns
- Return type
None
Resets the storm motion vector to those found by the Bunkers algorithm
- Parameters
None –
- Returns
- Return type
None
Sets the u and v values of the left mover supercell storm motion vector.
- Parameters
lm_u (number) – Left mover u-component of the storm motion vector
lm_v (number) – Left mover v-component of the storm motion vector
- Returns
- Return type
None
Sets the u and v values of the right mover supercell storm motion vector.
- Parameters
rm_u (number) – Right mover u-component of the storm motion vector
rm_v (number) – Right mover v-component of the storm motion vector
- Returns
- Return type
None
Bases:
object
Copies a profile object.
This is a wrapper function for constructing Profile objects and objects that inherit from the Profile class. This will construct and return the appropriate Profile object based on the supplied keyword argument. If no profile keyword is supplied, it defaults to a basic Profile. This also requires that you pass through all the relevant keyword arguments for the constructors to the Profile objects and the objects that inherit from Profile.
- Parameters
Keywords (Optional) –
pres (array_like) – The pressure values (Hectopascals)
hght (array_like) – The corresponding height values (Meters)
tmpc (array_like) – The corresponding temperature values (Celsius)
dwpc (array_like) – The corresponding dewpoint temperature values (Celsius)
Keyword Pairs (must use one or the other) (Optional) –
wdir (array_like) – The direction from which the wind is blowing in meteorological degrees
wspd (array_like) – The speed of the wind (kts)
OR –
u (array_like) – The U-component of the direction from which the wind is blowing. (kts)
v (array_like) – The V-component of the direction from which the wind is blowing. (kts)
Keywords –
missing (number, optional (default: sharppy.sharptab.constants.MISSING)) – The value of the missing flag used in the Profile objects
profile (string, optional (default: 'default')) – The text identifier for the Profile to be generated. Valid options include (‘default’ | ‘basic’ | ‘convective’). Default will construct a basic Profile, and convective will construct a ConvectiveProfile used for the SPC style GUI.
omeg (array_like) – The corresponding vertical velocity values (Pa/s)
- Returns
Profile (a basic Profile object) – This is the most basic and default object.
OR
ConvectiveProfile (a child of Profile) – This is the class used for the SPC GUI.
sharppy.sharptab.thermo module¶
Contains code to perform thermodynamic routines (i.e. saturated lifting, dry lifting, calculation of dewpoint, mixing ratio, equivalent potential temperature)
Thermodynamic Library
Lifts a parcel to the LCL and returns its new level and temperature.
- Parameters
p (number, numpy array) – Pressure of initial parcel in hPa
t (number, numpy array) – Temperature of inital parcel in C
td (number, numpy array) – Dew Point of initial parcel in C
- Returns
p2 (number, numpy array) – LCL pressure in hPa
t2 (number, numpy array) – LCL Temperature in C
Returns the level (hPa) of a parcel.
- Parameters
theta (number, numpy array) – Potential temperature of the parcel (C)
t (number, numpy array) – Temperature of the parcel (C)
- Returns
- Return type
Pressure Level (hPa [float]) of the parcel
Returns the temperature (C) of a parcel when raised to its LCL.
- Parameters
t (number, numpy array) – Temperature of the parcel (C)
td (number, numpy array) – Dewpoint temperature of the parcel (C)
- Returns
- Return type
Temperature (C) of the parcel at it’s LCL.
Returns the potential temperature (C) of a parcel.
- Parameters
p (number, numpy array) – The pressure of the parcel (hPa)
t (number, numpy array) – Temperature of the parcel (C)
p2 (number, numpy array (default 1000.)) – Reference pressure level (hPa)
- Returns
- Return type
Potential temperature (C)
Implementation of the Wobus Function for computing the moist adiabats.
Caution
The Wobus function has been found to have a slight pressure dependency (Davies-Jones 2008). This dependency is not included in this implementation.
- Parameters
t (number, numpy array) – Temperature (C)
- Returns
- Return type
Correction to theta (C) for calculation of saturated potential temperature.
Returns the temperature (C) of a saturated parcel (thm) when lifted to a new pressure level (hPa)
Caution
Testing of the SHARPpy parcel lifting routines has revealed that the convergence criteria used the SHARP version (and implemented here) may cause drifting the pseudoadiabat to occasionally “drift” when high-resolution radiosonde data is used. While a stricter convergence criteria (e.g. 0.01) has shown to resolve this problem, it creates a noticable departure from the SPC CAPE values and therefore may decalibrate the other SHARPpy functions (e.g. SARS).
- Parameters
p (number) – Pressure to which parcel is raised (hPa)
thetam (number) – Saturated Potential Temperature of parcel (C)
conv (number) – Convergence criteria for satlift() (C)
- Returns
- Return type
Temperature (C) of saturated parcel at new level
Lifts a parcel moist adiabatically to its new level.
- Parameters
p (number) – Pressure of initial parcel (hPa)
t (number) – Temperature of initial parcel (C)
p2 (number) – Pressure of final level (hPa)
- Returns
- Return type
Temperature (C)
Calculate temperature (C) of parcel (defined by p, t, td) lifted to the specified pressure level.
- Parameters
p (number) – Pressure of initial parcel in hPa
t (number) – Temperature of initial parcel in C
td (number) – Dew Point of initial parcel in C
lev (number) – Pressure to which parcel is lifted in hPa
- Returns
- Return type
Temperature (C) of lifted parcel
Returns the vapor pressure of dry air at given temperature
- Parameters
t (number, numpy array) – Temperature of the parcel (C)
- Returns
- Return type
Vapor Pressure of dry air
Returns the mixing ratio (g/kg) of a parcel
- Parameters
p (number, numpy array) – Pressure of the parcel (hPa)
t (number, numpy array) – Temperature of the parcel (hPa)
- Returns
- Return type
Mixing Ratio (g/kg) of the given parcel
Returns the temperature (C) of air at the given mixing ratio (g/kg) and pressure (hPa)
- Parameters
w (number, numpy array) – Mixing Ratio (g/kg)
p (number, numpy array) – Pressure (hPa)
- Returns
- Return type
Temperature (C) of air at given mixing ratio and pressure
Calculates the wetbulb temperature (C) for the given parcel
- Parameters
p (number) – Pressure of parcel (hPa)
t (number) – Temperature of parcel (C)
td (number) – Dew Point of parcel (C)
- Returns
- Return type
Wetbulb temperature (C)
Returns the wetbulb potential temperature (C) of a parcel.
- Parameters
p (number) – The pressure of the parcel (hPa)
t (number) – Temperature of the parcel (C)
td (number) – Dew point of parcel (C)
- Returns
- Return type
Wetbulb potential temperature (C)
Returns the equivalent potential temperature (C) of a parcel.
- Parameters
p (number) – The pressure of the parcel (hPa)
t (number) – Temperature of the parcel (C)
td (number) – Dew point of parcel (C)
- Returns
- Return type
Equivalent potential temperature (C)
Returns the virtual temperature (C) of a parcel. If td is masked, then it returns the temperature passed to the function.
- Parameters
p (number) – The pressure of the parcel (hPa)
t (number) – Temperature of the parcel (C)
td (number) – Dew point of parcel (C)
- Returns
- Return type
Virtual temperature (C)
Returns the virtual temperature (C) of a parcel.
- Parameters
p (number) – The pressure of the parcel (hPa)
t (number) – Temperature of the parcel (C)
td (number) – Dew point of parcel (C)
- Returns
- Return type
Relative humidity (%) of a parcel
Convert temperature from Fahrenheit to Celsius
- Parameters
t (number, numpy array) – The temperature in Fahrenheit
- Returns
- Return type
Temperature in Celsius (number or numpy array)
Convert temperature from Celsius to Fahrenheit
- Parameters
t (number, numpy array) – The temperature in Celsius
- Returns
- Return type
Temperature in Fahrenheit (number or numpy array)
Convert temperature from Celsius to Kelvin
- Parameters
t (number, numpy array) – The temperature in Celsius
- Returns
- Return type
Temperature in Kelvin (number or numpy array)
Convert temperature from Kelvin to Celsius
- Parameters
t (number, numpy array) – The temperature in Kelvin
- Returns
- Return type
Temperature in Celsius (number or numpy array)
Convert temperature from Fahrenheit to Kelvin
- Parameters
t (number, numpy array) – The temperature in Fahrenheit
- Returns
- Return type
Temperature in Kelvin (number or numpy array)
Convert temperature from Kelvin to Fahrenheit
- Parameters
t (number, numpy array) – The temperature in Kelvin
- Returns
- Return type
Temperature in Fahrenheit (number or numpy array)
sharppy.sharptab.utils module¶
Contains helper functions to convert data types.
Frequently used functions
Convert a value (float or int) into an integer string by rounding to the nearest integer and returning the string. Used to handle case where value is nan or masked.
- Parameters
val (float or int) –
- Returns
- Return type
Val rounded to the nearest int and converted to a string.
Convert a value (float or int) into a float string to the decimal place of a specified precision. Used to handle the case where the value is nan or masked.
- Parameters
val (float or int) –
precision (int) – used to specify the precision of the resulting rounded value
- Returns
val rounded to the nearest specified decimal place and converted
to a string.
Convert meters per second to knots
- Parameters
val (float, numpy_array) – Speed (m/s)
- Returns
- Return type
Val converted to knots (float)
Convert knots to meters per second
- Parameters
val (float, numpy_array) – Speed (kts)
- Returns
- Return type
Val converted to meters per second (float)
Convert meters per second to miles per hour
- Parameters
val (float, numpy_array) – Speed (m/s)
- Returns
- Return type
Val converted to miles per hour (float)
Convert miles per hour to meters per second
- Parameters
val (float, numpy_array) – Speed (mph)
- Returns
- Return type
Val converted to meters per second (float)
Convert miles per hour to knots
- Parameters
val (float, numpy_array) – Speed (mph)
- Returns
- Return type
Val converted to knots (float)
Convert knots to miles per hour
- Parameters
val (float, numpy_array) – Speed (kts)
- Returns
- Return type
Val converted to miles per hour (float)
Convert meters to feet
- Parameters
val (float, numpy_array) – Distance (m)
- Returns
- Return type
Val converted to feet (float)
Convert feet to meters
- Parameters
val (float, numpy_array) – Distance (ft)
- Returns
- Return type
Val converted to meters (float)
Convert inches to centimeters
- Parameters
val (float, numpy_array) – Distance (inches)
- Returns
- Return type
Val converted to centimeters (float)
Convert centimeters to inches
- Parameters
val (float, numpy_array) – Distance (centimeters)
- Returns
- Return type
Val converted to inches (float)
Convert direction and magnitude into U, V components
- Parameters
wdir (number, array_like) – Angle in meteorological degrees
wspd (number, array_like) – Magnitudes of wind vector (input units == output units)
missing (number (optional)) – Optional missing parameter. If not given, assume default missing value from sharppy.sharptab.constants.MISSING
- Returns
u (number, array_like (same as input)) – U-component of the wind (units are the same as those of input speed)
v (number, array_like (same as input)) – V-component of the wind (units are the same as those of input speed)
Convert U, V components into direction and magnitude
- Parameters
u (number, array_like) – U-component of the wind
v (number, array_like) – V-component of the wind
missing (number (optional)) – Optional missing parameter. If not given, assume default missing value from sharppy.sharptab.constants.MISSING
- Returns
wdir (number, array_like (same as input)) – Angle in meteorological degrees
wspd (number, array_like (same as input)) – Magnitudes of wind vector (input units == output units)
Compute the magnitude of a vector from its components
- Parameters
u (number, array_like) – U-component of the wind
v (number, array_like) – V-component of the wind
missing (number (optional)) – Optional missing parameter. If not given, assume default missing value from sharppy.sharptab.constants.MISSING
- Returns
mag – The magnitude of the vector (units are the same as input)
- Return type
number, array_like
Tests if a value is masked.
sharppy.sharptab.watch_type module¶
Contains functions to calculate the possible hazard type and precipitation type values (for the Winter inset).
Best Guess Precipitation type Adapted from SHARP code donated by Rich Thompson (SPC)
This algorithm utilizes the output from the init_phase() and posneg_temperature() functions to make a best guess at the preciptation type one would observe at the surface given a thermodynamic profile.
Precipitation Types Supported: * None * Rain * Snow * Sleet and Snow * Sleet * Freezing Rain/Drizzle * Unknown
- Parameters
prof (profile object) – Profile object
init_phase (int) – the initial phase of the precipitation (see 2nd value returned from init_phase())
init_lvl (float) – the initial level of the precipitation source (mb) (see 1st value returned from init_phase())
init_temp (float) – the initial level of the precipitation source (C) (see 3rd value returned from init_phase())
tpos (float) – the positive area (> 0 C) in the temperature profile (J/kg)
- Returns
precip_type – the best guess precipitation type
- Return type
str
Heat Index Equation
Computes the heat index using the equation obtained by performing multiple linear regression on the table in Steadman 1979.
Referenced from: http://www.srh.noaa.gov/images/ffc/pdf/ta_htindx.PDF
- Parameters
temp (number) – temperature (F)
rh (number) – relative humidity (%)
- Returns
heat_index – heat index value in (F)
- Return type
number
Inital Precipitation Phase Adapted from SHARP code donated by Rich Thompson (SPC)
This function determines the initial phase of any precipitation source in the profile. It does this either by finding a source of precipitation by searching for the highest 50 mb layer that has a relative humidity greater than 80 percent at the top and the bottom of the layer. This layer may be found either in the lowest 5 km of the profile, and if an OMEG profile is specified in the profile object, it will search for the layers with upward motion.
The precipitation type is determined by using a.) the interpolated temperature in the middle of the precipitation source layer and b.) set temperature thresholds to determine the precipitation type. The type may be “Rain”, “Freezing Rain”, “ZR/S Mix”, or “Snow”.
- Parameters
prof (profile object) – Profile object (omega profile optional)
- Returns
plevel (number) – the pressure level of the precipitation source (mb)
phase (int) – the phase type of the precipitation (int), phase = 0 for “Rain”, phase = 1 for “Freezing Rain” or “ZR/S Mix”, phase = 3 for “Snow”
tmp (number) – the temperature at the level that is the precipitation source (C)
st (str) – a string naming the precipitation type
Positive/Negative Temperature profile Adapted from SHARP code donated by Rich Thompson (SPC)
Description: This routine calculates the positive (above 0 C) and negative (below 0 C) areas of the temperature profile starting from a specified pressure (start). If the specified pressure is not given, this routine calls init_phase() to obtain the pressure level the precipitation expected to fall begins at.
This is an routine considers only the temperature profile as opposed to the wet-bulb profile.
- Parameters
prof (profile object) – Profile object
start (number) – the pressure level the precipitation originates from (found by calling init_phase()) (mb)
- Returns
pos (float) – the positive area (> 0 C) of the wet-bulb profile (J/kg)
neg (float) – the negative area (< 0 C) of the wet-bulb profile (J/kg)
top (float) – the top of the precipitation layer pressure (mb)
bot (float) – the bottom of the precipitation layer pressure (mb)
Positive/Negative Wetbulb profile Adapted from SHARP code donated by Rich Thompson (SPC)
This routine calculates the positive (above 0 C) and negative (below 0 C) areas of the wet bulb profile starting from a specified pressure (start). If the specified pressure is not given, this routine calls init_phase() to obtain the pressure level the precipitation expected to fall begins at.
This is an routine considers the wet-bulb profile instead of the temperature profile in case the profile beneath the profile beneath the falling precipitation becomes saturated.
- Parameters
prof (profile object) – Profile object
start (number) – the pressure level the precipitation originates from (found by calling init_phase()) (mb)
- Returns
pos (float) – the positive area (> 0 C) of the wet-bulb profile (J/kg)
neg (float) – the negative area (< 0 C) of the wet-bulb profile (J/kg)
top (float) – the top of the precipitation layer pressure (mb)
bot (float) – the bottom of the precipitation layer pressure (mb)
Possible Weather/Hazard/Watch Type
This function generates a list of possible significant weather types one can expect given a Profile object. (Currently works only for ConvectiveProfile.)
These possible weather types are computed via fuzzy logic through set thresholds that have been found through a.) analyzing ingredients within the profile and b.) combining those ingredients with forecasting experience to produce a suggestion of what hazards may exist. Some of the logic is based on experience, some of it is based on actual National Weather Service criteria.
This function has not been formally verified and is not meant to be comprehensive nor a source of strict guidance for weather forecasters. As always, the raw data is to be consulted.
Wx Categories (ranked in terms of severity): * PDS TOR * TOR * MRGL TOR * SVR * MRGL SVR * FLASH FLOOD * BLIZZARD * EXCESSIVE HEAT
Suggestions for severe/tornado thresholds were contributed by Rich Thompson - NOAA Storm Prediction Center
- Parameters
prof (profile object) – ConvectiveProfile object
use_left (bool) – If True, uses the parameters computed from the left-mover bunkers vector to decide the watch type. If False, uses parameters from the right-mover vector. The default is False.
- Returns
watch_types – strings containing the weather types in code
- Return type
numpy array
Surface Wind Chill Equation
Computes wind chill at the surface data point in the profile object using the equation found at:
www.nws.noaa.gov/os/windchill/index.shtml
- Parameters
prof (profile object) – Profile object
- Returns
wind_chill – wind chill value in (F)
- Return type
number
sharppy.sharptab.winds module¶
Contains functions to analyze the wind data of Profile objects. Contains routines to calculate wind shear, pressure-weighted mean winds, storm-relative helicity, and critical angle.
Wind Manipulation Routines
Calculates a pressure-weighted mean wind through a layer. The default layer is 850 to 200 hPa.
- Parameters
prof (profile object) – Profile object
pbot (number (optional; default 850 hPa)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 250 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default -1)) – The pressure increment for the interpolated sounding
stu (number (optional; default 0)) – U-component of storm-motion vector (kts)
stv (number (optional; default 0)) – V-component of storm-motion vector (kts)
- Returns
mnu (number) – U-component (kts)
mnv (number) – V-component (kts)
Calculates a non-pressure-weighted mean wind through a layer. The default layer is 850 to 200 hPa.
- Parameters
prof (profile object) – Profile object
pbot (number (optional; default 850 hPa)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 250 hPa)) – Pressure of the top level (hPa)
dp (negative integer (optional; default -1)) – The pressure increment for the interpolated sounding (mb)
stu (number (optional; default 0)) – U-component of storm-motion vector (kts)
stv (number (optional; default 0)) – V-component of storm-motion vector (kts)
- Returns
mnu (number) – U-component (kts)
mnv (number) – V-component (kts)
Calculates a pressure-weighted mean storm-relative wind through a layer. The default layer is 850 to 200 hPa. This is a thin wrapper around mean_wind().
- Parameters
prof (profile object) – Profile object
pbot (number (optional; default 850 hPa)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 250 hPa)) – Pressure of the top level (hPa)
stu (number (optional; default 0)) – U-component of storm-motion vector (kts)
stv (number (optional; default 0)) – V-component of storm-motion vector (kts)
dp (negative integer (optional; default -1)) – The pressure increment for the interpolated sounding (mb)
- Returns
mnu (number) – U-component (kts)
mnv (number) – V-component (kts)
Calculates a none-pressure-weighted mean storm-relative wind through a layer. The default layer is 850 to 200 hPa. This is a thin wrapper around mean_wind_npw().
- Parameters
prof (profile object) – Profile object
pbot (number (optional; default 850 hPa)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 250 hPa)) – Pressure of the top level (hPa)
stu (number (optional; default 0)) – U-component of storm-motion vector (kts)
stv (number (optional; default 0)) – V-component of storm-motion vector (kts)
dp (negative integer (optional; default -1)) – The pressure increment for the interpolated sounding (mb)
- Returns
mnu (number) – U-component (kts)
mnv (number) – V-component (kts)
Calculates the shear between the wind at (pbot) and (ptop).
- Parameters
prof (profile object) – Profile object
pbot (number (optional; default 850 hPa)) – Pressure of the bottom level (hPa)
ptop (number (optional; default 250 hPa)) – Pressure of the top level (hPa)
- Returns
shu (number) – U-component (kts)
shv (number) – V-component (kts)
Calculates the relative helicity (m2/s2) of a layer from lower to upper. If storm-motion vector is supplied, storm-relative helicity, both positve and negative, is returned.
- Parameters
prof (profile object) – Profile Object
lower (number) – Bottom level of layer (m, AGL)
upper (number) – Top level of layer (m, AGL)
stu (number (optional; default = 0)) – U-component of storm-motion (kts)
stv (number (optional; default = 0)) – V-component of storm-motion (kts)
dp (negative integer (optional; default -1)) – The pressure increment for the interpolated sounding (mb)
exact (bool (optional; default = True)) – Switch to choose between using the exact data (slower) or using interpolated sounding at ‘dp’ pressure levels (faster)
- Returns
phel+nhel (number) – Combined Helicity (m2/s2)
phel (number) – Positive Helicity (m2/s2)
nhel (number) – Negative Helicity (m2/s2)
Finds the maximum wind speed of the layer given by lower and upper levels. In the event of the maximum wind speed occurring at multiple levels, the lowest level it occurs is returned by default.
- Parameters
prof (profile object) – Profile Object
lower (number) – Bottom level of layer (m, AGL)
upper (number) – Top level of layer (m, AGL)
all (Boolean) – Switch to change the output to sorted wind levels or maximum level.
- Returns
p (number, numpy array) – Pressure level (hPa) of max wind speed
maxu (number, numpy array) – Maximum Wind Speed U-component (kts)
maxv (number, numpy array) – Maximum Wind Speed V-component (kts)
Compute the Bunkers Storm Motion for a Right Moving Supercell
- Parameters
prof (profile object) – Profile Object
- Returns
rstu (number) – Right Storm Motion U-component (kts)
rstv (number) – Right Storm Motion V-component (kts)
lstu (number) – Left Storm Motion U-component (kts)
lstv (number) – Left Storm Motion V-component (kts)
Calculated the Meso-beta Elements (Corfidi) Vectors
- Parameters
prof (profile object) – Profile Object
- Returns
upu (number) – U-component of the upshear vector (kts)
upv (number) – V-component of the upshear vector (kts)
dnu (number) – U-component of the downshear vector (kts)
dnv (number) – V-component of the downshear vector (kts)
Thin wrapper around corfidi_mcs_motion()
- Parameters
prof (profile object) – Profile Object
- Returns
upu (number) – U-component of the upshear vector (kts)
upv (number) – V-component of the upshear vector (kts)
dnu (number) – U-component of the downshear vector (kts)
dnv (number) – V-component of the downshear vector (kts)
Compute the Bunkers Storm Motion for a Right Moving Supercell
- Parameters
prof (profile object) – Profile Object
- Returns
rstu (number) – Right Storm Motion U-component (kts)
rstv (number) – Right Storm Motion V-component (kts)
lstu (number) – Left Storm Motion U-component (kts)
lstv (number) – Left Storm Motion V-component (kts)
Calculates the critical angle (degrees) as specified by Esterheld and Giuliano (2008). If the critical angle is 90 degrees, this indicates that the lowest 500 meters of the storm is experiencing pure streamwise vorticity.
- Parameters
prof (profile object) – Profile Object
stu (number (optional; default = 0)) – U-component of storm-motion (kts)
stv (number (optional; default = 0)) – V-component of storm-motion (kts)
- Returns
angle – Critical Angle (degrees)
- Return type
number