Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:heatindex

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:heatindex [2015/01/26 22:50] jt3tips:heatindex [2015/01/27 12:12] (current) – added short intro splitbrain
Line 1: Line 1:
-===== Examples =====+====== Calculating Heatindex ====== 
 + 
 +The heat index (HI) is an index that combines air temperature and relative humidity in an attempt to determine the human-perceived equivalent temperature—how hot it feels. The result is also known as the "felt air temperature" or "apparent temperature"
 + 
 +This tells you how hot a day "feels". See also [[tips:windchill|Caclulating Wind Chill]] for cold days. 
 + 
 +===== Example ===== 
 ====Fahrenheit==== ====Fahrenheit====
    Text:  ({wt}<80 and {wt} or {wh}<40 and {wt} or math.floor(-42.379+(2.04901523*{wt})+(10.14333127*{wh})+(-0.22475541*{wt}*{wh})+(-.00683783*({wt}^2))+(-.05481717*({wh}^2))+(.00122874*{wh}*({wt}^2))+(.00085282*{wt}*({wh}^2))+(-.00000199*({wt}^2)*({wh}^2))+.5)) .. "ᵒF"    Text:  ({wt}<80 and {wt} or {wh}<40 and {wt} or math.floor(-42.379+(2.04901523*{wt})+(10.14333127*{wh})+(-0.22475541*{wt}*{wh})+(-.00683783*({wt}^2))+(-.05481717*({wh}^2))+(.00122874*{wh}*({wt}^2))+(.00085282*{wt}*({wh}^2))+(-.00000199*({wt}^2)*({wh}^2))+.5)) .. "ᵒF"
Line 8: Line 15:
 The example shows the text field of a text object displaying Heat Index in the following format:  129ᵒF The example shows the text field of a text object displaying Heat Index in the following format:  129ᵒF
  
-This is done by first calculating heat index using the current temperature ({wt}) and the current humidity ({wh}).  +This is done by first calculating heat index using the current temperature ({wt}) and the current humidity ({wh}).  Note that Heat Index is only calculated if the temperature is at or above 80ᵒF and the relative humitity is at or above 40%. Also note that there are several "alternate" formulas for certain conditions.  This formula is simply the standard formula, which gets you pretty darn close.
  
 Once we've done the calculation, we need to concatenate the "ᵒF" or "ᵒC" to the formula.  To do this, we need to fool LUA into thinking that we're dealing exclusively with strings (for some stupid reason... LUA isn't the smartest of languages sometimes).  We do this by encapsulating the entire formula within a single set of parentheses.  So, yes, the first and last parentheses **are** required.  Then, we simply add the concatenation symbol ".." followed by the desired display in quotes ("ᵒF" or even just "ᵒ").  Just be sure to include a single space on either side of the concatenation symbol. Once we've done the calculation, we need to concatenate the "ᵒF" or "ᵒC" to the formula.  To do this, we need to fool LUA into thinking that we're dealing exclusively with strings (for some stupid reason... LUA isn't the smartest of languages sometimes).  We do this by encapsulating the entire formula within a single set of parentheses.  So, yes, the first and last parentheses **are** required.  Then, we simply add the concatenation symbol ".." followed by the desired display in quotes ("ᵒF" or even just "ᵒ").  Just be sure to include a single space on either side of the concatenation symbol.
  
 I'm sure some of you are wondering why I didn't include a Celsius formula.  The reason is simple.  I couldn't find a formula for Celsius!  I'm guessing that nobody wanted to duplicate that madness for another temperature scale, so they just do it in Fahrenheit, and convert the result to Celsius using the standard Fahrenheit to Celsius conversion formula of (F-32)*5/9. I'm sure some of you are wondering why I didn't include a Celsius formula.  The reason is simple.  I couldn't find a formula for Celsius!  I'm guessing that nobody wanted to duplicate that madness for another temperature scale, so they just do it in Fahrenheit, and convert the result to Celsius using the standard Fahrenheit to Celsius conversion formula of (F-32)*5/9.
tips/heatindex.1422312647.txt.gz · Last modified: 2015/01/26 22:50 by jt3