Closed steepleian closed 5 years ago
You're probably right, but I'm gonna take a look at it tomorrow when the heat index is high enough to activate that formula.
Thanks. Well one thing is for sure its not going to ever be that high here to check it out!
Yea.... My real temp yesterday hit 100.9°F, lol
Also same file: - Lines 184-186 function anyToF($field){
return cToFDirect ($field);
Should be: - function anyToF($field){ global $weather; if ($weather["temp_units"] == 'F'){ return $field; } else {
return cToFDirect ($field);
Sorry forget that last comment
I can't see any difference between those changes and the original. And the heat index here is varying between 98-101°F. Don't see a change when I switch to Celsius either.
Okay, I figured it out. The $weather["temp_units"] = 'C';
is irrelevant because livedata.php has already set $weather["temp_units"]
equal to 'C'
. This is because that's not the units that your site is currently displaying, that's the units that the data is received as, and with MB at least, all temps are received as Celsius. The second correct is immaterial as well, for the same reason. Data flows in as 'C'
, is converted to 'F'
because the Heat Index only applies to 'F'
, and its then converted back to 'C'
. Only then once the Heat Index is calculated is it finally converted to whichever unit is currently being displayed. Thankfully, temp conversion uses precise fractions and not rounded decimals, so there's not really any loss of precision when converting the units so many times.
All that being said, I will add these corrections anyway in case someone down the line converts their copy to store the data in Imperial, that way they won't be confused as to why the Heat Index is messed up for them.
At line 156, possible debug code left behind which may effect F display
$weather["temp_units"]='C'; if ($weather["temp_units"] == 'C'){ $heatIndex = fToCDirect($heatIndex); }