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
BAROMETRIC PRESSURE
The air that makes up our atmosphere exerts a pressure on the surface of the earth. This pressure is known as atmospheric pressure. Generally, the more air above an area, the higher the atmospheric pressure. Barometric pressure changes with local weather conditions, making barometric pressure an important and useful weather forecasting tool. High pressure zones are generally associated with fair weather, while low pressure zones are generally associated with poor weather. For forecasting purposes, the absolute barometric pressure value is generally less important than the change in barometric pressure. In general, rising pressure indicates improving weather conditions, while falling pressure indicates deteriorating weather conditions.


NEXRAD Radar & Satellite Maps



© 1992-2010 Copyright TNET Services, Inc.