pyiem.meteorology module#
We do meteorological things, when necessary
- pyiem.meteorology.flight_rule(data)[source]#
Compute the flight rule for a database data entry.
- Parameters:
data (dict[str, float | None]) – Sky coverage codes in
skyc1throughskyc4, sky layer heights in feet AGL inskyl1throughskyl4, and visibility in statute miles invsby.- Returns:
One of the following flight rules:
UNKNOWNwhen the conditions do not match a category.VFRwhen the ceiling is above 3,000 feet AGL and visibility is above 5 statute miles (green).MVFRwhen the ceiling is 1,000 to 3,000 feet AGL and/or visibility is 3 to 5 statute miles, inclusive (blue).IFRwhen the ceiling is 500 to below 1,000 feet AGL and/or visibility is 1 to below 3 statute miles (red).LIFRwhen the ceiling is below 500 feet AGL and/or visibility is below 1 statute mile (magenta).
- Return type:
- pyiem.meteorology.temperature_humidity_index(temperature, humidity)[source]#
Compute the Temperature Humidity Index
- Parameters:
temperature (temperature) – The Air Temperature
humidity (humidity) – The Relative Humidity
- Returns:
The THI
- Return type:
- pyiem.meteorology.comprehensive_climate_index(airtemp, rh, windspeed, solarrad, shade_effect=False)[source]#
Compute the Comprehensive Climate Index.
A comprehensive index for assessing environmental stress in animals. 2010. T.L. Mader, Leslie J. Johnson and John B. Gaughan. Journal of Animal Science 2010, Volume 88: pages 2153-2165. The formula was corrected as Erratum in Journal of Animal Science 2011, Volume 89: page 2955. https://academic.oup.com/jas/article/88/6/2153/4779866 https://content.prod.mesonet.org/learn/ag/tools_documentation/Cattle_Comfort_Description.201605.pdf
Note: shade_effect multiplies the
solarradvalue by 0.2 (80% reduction)- Parameters:
shade_effect (bool)
- pyiem.meteorology.clearsky_shortwave_irradiance_year(lat, elevation)[source]#
Compute the Clear Sky Shortwave Irradiance for year in MJ m**-2
- pyiem.meteorology.drct(u, v)[source]#
Compute the wind direction given a u and v wind speed
- Parameters:
u (dt.speed) – u component wind speed
v (dt.speed) – v component wind speed
- Returns:
dt.direction value
- pyiem.meteorology.uv(speed, direction)[source]#
Compute the u and v components of the wind @param wind speed in whatever units @param dir wind direction with zero as north @return u and v components
- pyiem.meteorology.mcalc_feelslike(tmpf, dwpf, smps, mask_undefined=False)[source]#
Compute a feels like temperature
- Parameters:
temperature (temperature) – The dry bulb temperature
dewpoint (temperature) – The dew point temperature
speed (speed) – the wind speed
mask_undefined (bool) – If True, mask values where feels like is undef.
- Returns:
The feels like temperature
- Return type:
- pyiem.meteorology.windchill(temperature, speed)[source]#
Compute the wind chill temperature
http://www.ofcm.gov/publications/reports2.htm
- Parameters:
temperature (temperature) – The Air Temperature
speed (speed) – The Wind Speed
- Returns:
The Wind Chill Temperature
- Return type:
- pyiem.meteorology.heatindex(temperature, polyarg)[source]#
Compute the heat index based on
Stull, Richard (2000). Meteorology for Scientists and Engineers, Second Edition. Brooks/Cole. p. 60. ISBN 9780534372149.
Another opinion on appropriate equation: http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
- pyiem.meteorology.dewpoint_from_pq(pressure, mixingratio)[source]#
Compute the Dew Point given a Pressure and Mixing Ratio
- pyiem.meteorology.dewpoint(temperature, relhumid)[source]#
Compute Dew Point given a temperature and RH%
- pyiem.meteorology.relh(temperature, _dewpoint)[source]#
Compute Relative Humidity based on a temperature and dew point
- pyiem.meteorology.mixing_ratio(_dewpoint)[source]#
Compute the mixing ratio
- Parameters:
dewpoint (temperature) – Dew Point temperature
- Returns:
mixing ratio
- pyiem.meteorology.gdd(high, low, base=50.0, ceiling=86.0)[source]#
Compute Growing Degree Days
- Parameters:
high (temperature, or metpy.units) – High Temperature
low (temperature or metpy.units) – Low Temperature
base (int) – Base to use in GDD Computation (F)
ceiling (int) – Ceiling to use in GDD Computation (F)
- Returns:
float value for GDDs