# pywws.conversions¶

conversions.py - a set of functions to convert pywws native units (Centigrade, mm, m/s, hPa) to other popular units

Functions

 `apparent_temp`(temp, rh, wind) Compute apparent temperature (real feel), using formula from http://www.bom.gov.au/info/thermal_stress/ `cadhumidex`(temp, humidity) Calculate Humidity Index as per Canadian Weather Standards `cloud_base`(temp, hum) Calculate cumulus cloud base in metres, using formula from https://en.wikipedia.org/wiki/Cloud_base or https://de.wikipedia.org/wiki/Kondensationsniveau#Konvektionskondensationsniveau `cloud_ft`(m) Convert cloud base from metres to feet. `dew_point`(temp, hum) Compute dew point, using formula from http://en.wikipedia.org/wiki/Dew_point. `illuminance_wm2`(lux) Approximate conversion of illuminance in lux to solar radiation in W/m2 `pressure_inhg`(hPa) Convert pressure from hectopascals/millibar to inches of mercury `pressure_trend_text`(trend) Convert pressure trend to a string, as used by the UK met office. `rain_inch`(mm) Convert rainfall from millimetres to inches `scale`(value, factor) Multiply value by factor, allowing for None values. `temp_f`(c) Convert temperature from Celsius to Fahrenheit `usaheatindex`(temp, humidity[, dew]) Calculate Heat Index as per USA National Weather Service Standards `wind_bft`(ms) Convert wind from metres per second to Beaufort scale `wind_chill`(temp, wind) Compute wind chill, using formula from http://en.wikipedia.org/wiki/wind_chill `wind_kmph`(ms) Convert wind from metres per second to kilometres per hour `wind_kn`(ms) Convert wind from metres per second to knots `wind_mph`(ms) Convert wind from metres per second to miles per hour `winddir_average`(data, threshold, min_count) Compute average wind direction (in degrees) for a slice of data. `winddir_degrees`(pts) Convert wind direction from 0..15 to degrees `winddir_text`(pts) Convert wind direction from 0..15 to compass point text
`pywws.conversions.``scale`(value, factor)[source]

Multiply value by factor, allowing for None values.

`pywws.conversions.``illuminance_wm2`(lux)[source]

Approximate conversion of illuminance in lux to solar radiation in W/m2

`pywws.conversions.``pressure_inhg`(hPa)[source]

Convert pressure from hectopascals/millibar to inches of mercury

`pywws.conversions.``pressure_trend_text`(trend)[source]

Convert pressure trend to a string, as used by the UK met office.

`pywws.conversions.``rain_inch`(mm)[source]

Convert rainfall from millimetres to inches

`pywws.conversions.``temp_f`(c)[source]

Convert temperature from Celsius to Fahrenheit

`pywws.conversions.``winddir_average`(data, threshold, min_count, decay=1.0)[source]

Compute average wind direction (in degrees) for a slice of data.

The wind speed and direction of each data item is converted to a vector before averaging, so the result reflects the dominant wind direction during the time period covered by the data.

Setting the `decay` parameter converts the filter from a simple averager to one where the most recent sample carries the highest weight, and earlier samples have a lower weight according to how long ago they were.

This process is an approximation of “exponential smoothing”. See Wikipedia for a detailed discussion.

The parameter `decay` corresponds to the value `(1 - alpha)` in the Wikipedia description. Because the weather data being smoothed may not be at regular intervals this parameter is the decay over 5 minutes. Weather data at other intervals will have its weight scaled accordingly.

Note: The return value is in degrees, not the 0..15 range used elsewhere in pywws. data (pywws.storage.CoreStore) – a slice of pywws raw/calib or hourly data. threshold (float) – minimum average windspeed for there to be a valid wind direction. min_count (int) – minimum number of data items for there to be a valid wind direction. decay (float) – filter coefficient decay rate. float
`pywws.conversions.``winddir_degrees`(pts)[source]

Convert wind direction from 0..15 to degrees

`pywws.conversions.``winddir_text`(pts)[source]

Convert wind direction from 0..15 to compass point text

`pywws.conversions.``wind_kmph`(ms)[source]

Convert wind from metres per second to kilometres per hour

`pywws.conversions.``wind_mph`(ms)[source]

Convert wind from metres per second to miles per hour

`pywws.conversions.``wind_kn`(ms)[source]

Convert wind from metres per second to knots

`pywws.conversions.``wind_bft`(ms)[source]

Convert wind from metres per second to Beaufort scale

`pywws.conversions.``dew_point`(temp, hum)[source]

Compute dew point, using formula from http://en.wikipedia.org/wiki/Dew_point.

`pywws.conversions.``cadhumidex`(temp, humidity)[source]

Calculate Humidity Index as per Canadian Weather Standards

`pywws.conversions.``usaheatindex`(temp, humidity, dew=None)[source]

Calculate Heat Index as per USA National Weather Service Standards

See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40%

`pywws.conversions.``wind_chill`(temp, wind)[source]

Compute wind chill, using formula from http://en.wikipedia.org/wiki/wind_chill

`pywws.conversions.``apparent_temp`(temp, rh, wind)[source]

Compute apparent temperature (real feel), using formula from http://www.bom.gov.au/info/thermal_stress/

`pywws.conversions.``cloud_base`(temp, hum)[source]

Calculate cumulus cloud base in metres, using formula from https://en.wikipedia.org/wiki/Cloud_base or https://de.wikipedia.org/wiki/Kondensationsniveau#Konvektionskondensationsniveau

`pywws.conversions.``cloud_ft`(m)[source]

Convert cloud base from metres to feet.

Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.