pinto wrote:Hi Steve,
Trying to build a near-realtime updating index page, is it possible to add
<#heatindex>
<#beaudesc>
<#windrununit>
<#presstrend>
to the end of the realtime.txt
(index page is partly working, not finished yet)
From
my point of view... I would be hesitant of adding redundant data to this file since almost all uses of the file is going to be via a script or some sort of program.
The smaller the better and the less changes the better.
heatindex makes sense because it cannot be easily derived from other data... for that matter
humidex would be nice as well (Common in Canada and becoming common in the US).
The rest are easily obtained from the data already contained in the realtime.txt file. That is why I didn't include them in the original request as they can be obtained from the data provided.
Oh... When I first recommended additional values, I couldn't think of a reason why
windrununit to be different from
windunit which is why I dropped it from the list.
presstrend can be derived from the existing data provided in pressure trend value. If it is positive (actually has a + in it it is Rising, if it is a negative value (will have a -) it is Falling..
So in a script you could do something like:
Code: Select all
echo "Trend = ";
( substr( $DATA[18],0,1 ) == "-" ) ? print "Falling" : print "Rising";
echo "<br/>";
Similarly, the file already has the
beaufortdesc value:
Beaufort values are fixed, they don't change... they are made up of a set of force values that are easily computed from existing data using a simple array.
Code: Select all
$beufortdesc = array("Calm","Light Air","Light Breeze","Gentle Breeze",
"Moderate Breeze", "Fresh Breeze", "Strong Breeze", "Near Gale",
"Gale", "Strong Gale", "Storm", "Violent Storm","Hurricane");
So that in a script, you could do...
Code: Select all
echo "Beaufort" . $DATA[12] . ' = ' . $beufortdesc[$DATA[12]] . "<br/>";
The power of the data in the realtime.txt file is that all the values are now known values so that if you want to display the other format, you can easily by checking to see what format is being used.
So if you were a metric station and you wanted display Fahrenheit for example, you can easily with:
Code: Select all
echo "Temp " . $DATA[2] . " " . $DATA[14] . " (" ;
if ( $DATA[14] == "C" ) ? print CoF($DATA[2],1) : print FtoC($DATA[2],1);
if ( $DATA[14] == "C" ) ? print "F)" : print "C)";
echo "<br/>";
Just an opinion of course...