Basic Calculations¶
Contains a collection of basic calculations.
These include:
- wind components
- heat index
- windchill
-
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
See also
-
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 (pint.Quantity) – The direction of the wind, specified as the direction from which it is blowing, with 0 being North.
See also
-
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, with 0 being North.
Returns: u, v (tuple of array_like) – The wind components in the X (East-West) and Y (North-South) directions, respectively.
See also
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).
Calculates WCTI from the current temperature and wind speed using the formula outlined by the FCM [4].
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 (pint.Quantity) – The air temperature
- speed (pint.Quantity) – 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.
- 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.
Returns: pint.Quantity – The corresponding Wind Chill Temperature Index value(s)
See also
References
[4] Federal Coordinator for Meteorological Services and Supporting Research: Report on Wind Chill Temperature and Extreme Heat Indices: Evaluation and Improvement Projects. Washington, DC: Office of the Federal Coordinator for Meteorological Services and Supporting Research, 2003. FCM-R19-2003
-
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]. This equation is a multi-variable least-squares regression of the values obtained in [5].
Parameters: - temperature (pint.Quantity) – 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: pint.Quantity – 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
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] Rothfusz, L.P.: The Heat Index “Equation”. Fort Worth, TX: Scientific Services Division, NWS Southern Region Headquarters, 1990. SR90-23
-
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 (pint.Quantity) – Atmospheric pressure Returns: pint.Quantity – 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.
-
metpy.calc.basic.
coriolis_parameter
(latitude)¶ Calculate the coriolis parameter at each point.
The implementation uses the formula outlined in [8].
Parameters: latitude (array_like) – Latitude at each point Returns: pint.Quantity – The corresponding coriolis force at each point References
[8] Hobbs, Peter V. and Wallace, John M., 1977: Atmospheric Science, an Introductory Survey. 370-371.