TNET Weather Station Notebooks - Parsing WD Clientraw data files
Parsing WD clientraw data files is a way of obtaining information from your Weather-Display weather software without having to download a lot of information.
Below are some basic PHP routines that you can use to get the info out of the files
get-raw function
function get_client( $RF ) {
$DEL = ' ';
$RD = array();
$fd = fopen($RF, "r");
if ( $fd ) {
$contents = '';
while (!feof($fd) ) {
$contents .= fread($fd,8192);
}
fclose($fd);
$RD = explode ($DEL, $contents);
} else {
$RD[0]= -9999;
}
return $RD;
}
Calling the get-client Function
Now you are ready to call the function for each of the possible 3 clientraw.txt files, clientraw.txt, clientrawdaily.txt and clientrawextra.txt.
The code below will do that using the function above.Note that you will need to set the $loc variable that points to where on your site the files reside. Many, times this will simply be $loc = "./";
// $loc = the location on your server for your clientraw files
// You can leave off the ending / as it will be supplied with the path
$loc = ".";
$clientraw = get_client ("${loc}/clientraw.txt");
$clientrawextra = get_client ("${loc}/clientrawextra.txt");
$clientrawdaily = get_client ("${loc}/clientrawdaily.txt");
Using the collected data
After you have done the above, you can now use the data by referencing the the data element you want and the file that contains it by way of an array.
Some examples: From clientraw.txt:
1 Avg Speed (kts) 2 Gusts (kts) 3 WindDir (deg) 4 Temp (celcius) 5 Outside Humidity (%) 6 Barometer (hPa) 7 Daily Rain (mm) 8 Monthly Rain (mm) 9 Yearly Rain (mm)
So the variables above would be found in the same number variables shown below
$clientraw[1];
$clientraw[2];
$clientraw[3];
$clientraw[4];
$clientraw[5];
$clientraw[6];
$clientraw[7];
$clientraw[8];
$clientraw[9];
One issue you might have is that the value is not in the format you want. By default the information contained in the clientraw files are Temps in Celsius, Rain in mm, wind speeds are kts etc... So if you are in the US, you might need to change the format to before you can use them.
So you might need to use a calculation to get what you want them to be like
$current_temp = tempToFahrenheit ($clientraw[1], 0);
This would take the current temp from clientraw and provide it to you in Fahrenheit.
You can find a list of similar calculation functions on the following TNET notebook
TNET PHP Functions NotebookYou can see what values are available in the WD clientraw files by using our WD-Parser below on your own clientraw files TNET WD Parser
Arizona Random Weather Facts
HUMIDEX
Definition Humidex - Over the years, several measures have been proposed to relate various combinations of temperature and humidity into a single number to approximate what hot, humid weather feels like to the average person. Of these, humidex is the one most familiar to Canadians. Humidex was introduced into Canada in 1965. The index is a summer analogue of the wind chill factor in that it is an equivalent air temperature. Air of a given temperature and humidity is equated in comfort to air of a higher temperature that has a negligible moisture content. Comfort is quite subjective and largely dependent on the age and health of the individual. Weather conditions causing prickly heat in an infant may result in heat cramps in a teenager, heat exhaustion in a middle-aged and heat stroke in a senior. Humidex is also limited as an overall hot-weather comfort index because it does not consider other factors such as pressure, wind speed, precipitation, sunshine or pollen.


NEXRAD Radar & Satellite Maps



© 1992-2010 Copyright TNET Services, Inc.