Created
July 20, 2016 00:46
-
-
Save mumblepins/d4e6f2189200cbd0914e217a2e4adde9 to your computer and use it in GitHub Desktop.
Accuweather Realfeel temperature calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on patent https://www.google.com/patents/US7251579 | |
# Not responsible if you use this for anything other than personal use | |
from math import sqrt | |
def realfeel(W, #windspeed mph | |
A, #pressure mb | |
T, # temperature F | |
UV, # UV Index | |
D, # Dew Point F | |
P2, # preciptation Factor from 0-5 | |
): | |
if W<4: | |
Wa=W/2+2 | |
elif W<56: | |
Wa=W | |
else: | |
Wa=56 | |
# print Wa | |
WSP2=(80-T)*(0.566+0.25*sqrt(Wa)-0.0166*Wa)*((sqrt(A/10))/10) | |
WSP1=sqrt(W)*((sqrt(A/10))/10) | |
# print WSP2 | |
SI2 = UV # UV index is already in hectoJoules/m^2 ? | |
if D >= (55+sqrt(W)): | |
Da=D | |
else: | |
Da=55+sqrt(W) | |
# print Da | |
H2=(Da-55-sqrt(W))**2/30 | |
# print H2 | |
if T>= 65: | |
MFT=80-WSP2+SI2+H2-P2 | |
else: | |
MFT=T-WSP1+SI2+H2-P2 | |
return MFT | |
print realfeel(5,1013,70,6,50,0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great script!
Just curious, what do you use for the "precipitation factor" value?
AccuWeather (as well as the other weather services) does not appear to display this figure on their weather webpages. An online search for the term reveals that it is not an industry-used term, so I wonder if this figure is an AccuWeather proprietary calculation.
Update:
Never mind, I understand how it is calculated now, after clicking on the patent link.