Basic Calculations

metpy.calc.basic.get_wind_speed(u, v)

Compute the wind speed from u and v-components.

Parameters:
  • u (array_like) – Wind component in the X (East-West) direction
  • v (array_like) – Wind component in the Y (North-South) direction
Returns:

wind speed (array_like) – The speed of the wind

metpy.calc.basic.get_wind_dir(u, v)

Compute the wind direction from u and v-components.

Parameters:
  • u (array_like) – Wind component in the X (East-West) direction
  • v (array_like) – Wind component in the Y (North-South) direction
Returns:

wind direction (array_like) – The direction of the wind in degrees

metpy.calc.basic.get_wind_components(speed, wdir)

Calculate the U, V wind vector components from the speed and direction.

Parameters:
  • speed (array_like) – The wind speed (magnitude)
  • wdir (array_like) – The wind direction, specified as the direction from which the wind is blowing.
Returns:

u, v (tuple of array_like) – The wind components in the X (East-West) and Y (North-South) directions, respectively.

See also

get_speed_dir()

Examples

>>> from metpy.units import units
>>> metpy.calc.get_wind_components(10. * units('m/s'), 225. * units.deg)
(<Quantity(7.071067811865475, 'meter / second')>,
 <Quantity(7.071067811865477, 'meter / second')>)
metpy.calc.basic.windchill(temperature, speed, face_level_winds=False, mask_undefined=True)

Calculate the Wind Chill Temperature Index (WCTI) from the current temperature and wind speed.

Specifically, these formulas assume that wind speed is measured at 10m. If, instead, the speeds are measured at face level, the winds need to be multiplied by a factor of 1.5 (this can be done by specifying face_level_winds as True.)

Parameters:
  • temperature (array_like) – The air temperature
  • speed (array_like) – The wind speed at 10m. If instead the winds are at face level, face_level_winds should be set to True and the 1.5 multiplicative correction will be applied automatically.
Returns:

array_like – The corresponding Wind Chill Temperature Index value(s)

Other Parameters:
 
  • face_level_winds (bool, optional) – A flag indicating whether the wind speeds were measured at facial level instead of 10m, thus requiring a correction. Defaults to False.
  • mask_undefined (bool, optional) – A flag indicating whether a masked array should be returned with values where wind chill is undefined masked. These are values where the temperature > 50F or wind speed <= 3 miles per hour. Defaults to True.

See also

heat_index()

References

[4]http://www.ofcm.gov/jagti/r19-ti-plan/pdf/03_chap3.pdf
metpy.calc.basic.heat_index(temperature, rh, mask_undefined=True)

Calculate the Heat Index from the current temperature and relative humidity.

The implementation uses the formula outlined in [6].

Parameters:
  • temperature (array_like) – Air temperature
  • rh (array_like) – The relative humidity expressed as a unitless ratio in the range [0, 1]. Can also pass a percentage if proper units are attached.
Returns:

array_like – The corresponding Heat Index value(s)

Other Parameters:
 

mask_undefined (bool, optional) – A flag indicating whether a masked array should be returned with values where heat index is undefined masked. These are values where the temperature < 80F or relative humidity < 40 percent. Defaults to True.

See also

windchill()

References

[5]Steadman, R.G., 1979: The assessment of sultriness. Part I: A temperature-humidity index based on human physiology and clothing science. J. Appl. Meteor., 18, 861-873.
[6]http://www.srh.noaa.gov/ffc/html/studies/ta_htindx.PDF
metpy.calc.basic.pressure_to_height_std(pressure)

Convert pressure data to heights using the U.S. standard atmosphere.

The implementation uses the formula outlined in [7].

Parameters:pressure (array_like) – Atmospheric pressure
Returns:array_like – The corresponding height value(s)

Notes

\[Z = \frac{T_0}{\Gamma}[1-\frac{p}{p_0}^\frac{R\Gamma}{g}]\]

References

[7]Hobbs, Peter V. and Wallace, John M., 1977: Atmospheric Science, an Introductory Survey. 60-61.