Skip to content

Instantly share code, notes, and snippets.

@maxp
Created January 13, 2013 03:56
Show Gist options
  • Select an option

  • Save maxp/4522171 to your computer and use it in GitHub Desktop.

Select an option

Save maxp/4522171 to your computer and use it in GitHub Desktop.
def getWindchill(self):
"""
Return wind chill in degrees Celsius
"""
# http://en.wikipedia.org/wiki/Wind_chill - North American wind chill
# index
if self.w_chill is None:
if (self.temp and self.temp <= 10 and
self.windspeed and (self.windspeed*3.6) > 4.8):
self.w_chill = (13.12 + 0.6215*self.temp -
11.37*(self.windspeed*3.6)**0.16 +
0.3965*self.temp*(self.windspeed*3.6)**0.16)
return self.w_chill
def getWindchillF(self):
"""
Return wind chill in degrees Fahrenheit
"""
# http://en.wikipedia.org/wiki/Wind_chill - North American wind chill
# index
if self.w_chillf is None:
if (self.tempf and self.tempf <= 50 and
self.windspeedmph and self.windspeedmph >= 3):
self.w_chillf = (35.74 + 0.6215*self.tempf -
35.75*self.windspeedmph**0.16 +
0.4275*self.tempf*self.windspeedmph**0.16)
else:
self.w_chillf = self.tempf
return self.w_chillf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment