/****************************************************************************** * Weather Display clientraw.txt current conditions parser * Copyright (C) 2005 Anole Computer Services, LLC * scripts@anolecomputer.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ******************************************************************************* * This script parses the Weather Display Generated clientraw files to * provide the data for a php based web site * * parse_clientraw.php v 2.0 *******************************************************************************/ General Description ------------------- First a disclaimer. I am not a programmer. Anyone who is and looks at this code will instantly recognize that. I am well aware that there are probably numerous ways to do what I've done here in much more efficient ways and I encourage the real programmers out there who look at this script and see a way to make it better to provide some input. Now that that is out of the way.... This script parses the Weather Display generated clientraw files to provide the data for a php based web site. Specific clientraw.txt and clientrawextra.txt data points are converted to PHP variables which can then be included on a web page. Obviously, since this is a PHP script, your server needs to support PHP. To utilize this script you should understand the following basic concepts: 1) What file paths are, absolute and relative. 2) How to set up Weather Display to process and upload clientraw data. Requirements ------------------- This script requires the following to function: PHP Weather Display Installing the script --------------------- To install the script: 1) Unpack/unzip the archive. 3) Enable processing and upload of clientraw data to your server 4) Verify that the clientraw data is being processed an uploaded to the server. 5) Create a directory on your server that can be accessed with a URL, ie, in your document root or subdirectory of it. 6) Set the following parameters in parse_clientraw.txt to match your specific desires: $clientraw_path $temp_prec $wind_prec $barom_prec $rain_prec 7) Upload parse_clientraw.php to that directory. The file can be placed in an existing directory if desired. Using The Script ---------------- Once installed you use the script by using a PHP include to call the script within the web page where you want the clientraw data to appear. EXAMPLE: You then insert the PHP variable names in the web page at the specific location you want the data points to appear. EXAMPLE: Temp: Because the data points are PHP variables you can perform additional manipulations or use them in other functions. In the following example heat index and wind chill values are checked to determine whether they should be displayed on the page: = 70){ echo "Heat Index: $HeatIndex °F } if ($WindChill <= 60){ echo "Wind Chill: $WindChill °F } ?> Supported Data Points --------------------- This script DOES NOT currently parse all of the data points from the clientraw files. Unit conversion is only supported for standard US measurements at this time and all data points are currently converted to US units. It is important to understand that the clientraw files do not take into account your unit preference settings. For example, temperature readings in clientraw.txt are always in C even if your have your Weather Display preferences set to display in F. In order to make it possible to make the values appear in the units described above they must be converted. Because the units are converted via mathematical functions, you must specify the precision (number of decimal places) you wish to see in the final display. Keep in mind that these values represent the maximum number of decimal places to display. If a precision is set to '2' and there is only one decimal place in the value, only one decimal place will be displayed. The following is a complete list of data points that are parsed, the variable name used, and the units used: Value Variable Name Units ----- ------------- ----- Humidity $Humidity % Dew Point $DewPoint F Temperature $Temp F Temperature Month High $TempMonthHigh F Temperature Month High Time $TempMonthHighTime am/pm Temperature Month High Date $TempMonthHighDate mm/dd/yyyy Temperature Month Low $TempMonthLow F Temperature Month Low Time $TempMonthLowTime am/pm Temperature Month Low Date $TempMonthLowDate mm/dd/yyyy Temperature Year High $TempYearHigh F Temperature Year High Time $TempYearHighTime am/pm Temperature Year High Date $TempYearHighDate mm/dd/yyyy Temperature Year Low $TempYearLow F Temperature Year Low Time $TempYearLowTime am/pm Temperature Year Low Date $TempYearLowDate mm/dd/yyyy Temperature All Time High $TempAllTimeHigh F Temperature All Time High Time $TempAllTimeHighTime am/pm Temperature All Time High Date $TempAllTimeHighDate mm/dd/yyyy Temperature All Time Low $TempAllTimeLow F Temperature All Time Low Time $TempAllTimeLowTime am/pm Temperature All Time Low Date $TempAllTimeLowDate mm/dd/yyyy Heat Index $HeatIndex F Heat Index Month High $HeatIndexMonthHigh F Heat Index Month High Time $HeatIndexMonthHighTime am/pm Heat Index Month High Date $HeatIndexMonthHighDate mm/dd/yyyy Heat Index Year High $HeatIndexYearHigh F Heat Index Year High Time $HeatIndexYearHighTime am/pm Heat Index Year High Date $HeatIndexYearHighDate mm/dd/yyyy Heat Index All Time High $HeatIndexAllTimeHigh F Heat Index All Time High Time $HeatIndexAllTimeHighTime am/pm Heat Index All Time High Date $HeatIndexAllTimeHighDate mm/dd/yyyy Wind Chill $WindChill F Wind Chill Month Low $WindChillMonthLow F Wind Chill Month Low Time $WindChillMonthLowTime am/pm Wind Chill Month Low Date $WindChillMonthLowDate mm/dd/yyyy Wind Chill Year Low $WindChillYearLow F Wind Chill Year Low Time $WindChillYearLowTime am/pm Wind Chill Year Low Date $WindChillYearLowDate mm/dd/yyyy Wind Chill All Time Low $WindChillAllTimeLow F Wind Chill All Time Low Time $WindChillAllTimeLowTime am/pm Wind Chill All Time Low Date $WindChillAllTimeLowDate mm/dd/yyyy Wind Direction $WindDir degrees Wind Direction Text $WindDirTxt compass points Wind Speed $Wind MPH Wind Month High $WindMonthHigh MPH Wind Month High Time $WindMonthHighTime am/pm Wind Month High Date $WindMonthHighDate mm/dd/yyyy Wind Year High $WindYearHigh MPH Wind Year High Time $WindYearHighTime am/pm Wind Year High Date $WindYearHighDate mm/dd/yyyy Wind All Time High $WindAllTimeHigh MPH Wind All Time High Time $WindAllTimeHighTime am/pm Wind All Time High Date $WindAllTimeHighDate mm/dd/yyyy Gust $Gust MPH Gust Month High $GustMonthHigh MPH Gust Month High Time $GustMonthHighTime am/pm Gust Month High Date $GustMonthHighDate mm/dd/yyyy Gust Year High $GustYearHigh MPH Gust Year High Time $GustYearHighTime am/pm Gust Year High Date $GustYearHighDate mm/dd/yyyy Gust All Time High $GustAllTimeHigh MPH Gust All Time High Time $GustAllTimeHighTime am/pm Gust All Time High Date $GustAllTimeHighDate mm/dd/yyyy Barometer $Barom inches Hg Barometric Trend $BaromTrend text Barometer Today High $BaromTodayHigh inches Hg Barometer Today Low $BaromTodayLow inches Hg Barometer Month High $BaromMonthHigh inches Hg Barometer Month High Time $BaromMonthHighTime am/pm Barometer Month High Date $BaromMonthHighDate mm/dd/yyyy Barometer Month Low $BaromMonthLow inches Hg Barometer Month Low Time $BaromMonthLowTime am/pm Barometer Month Low Date $BaromMonthLowDate mm/dd/yyyy Barometer Year High $BaromYearHigh inches Hg Barometer Year High Time $BaromYearHighTime am/pm Barometer Year High Date $BaromYearHighDate mm/dd/yyyy Barometer Year Low $BaromYearLow inches Hg Barometer Year Low Time $BaromYearLowTime am/pm Barometer Year Low Date $BaromYearLowDate mm/dd/yyyy Barometer All Time High $BaromAllTimeHigh inches Hg Barometer All Time High Time $BaromAllTimeHighTime am/pm Barometer All Time High Date $BaromAllTimeHighDate mm/dd/yyyy Barometer All Time Low $BaromAllTimeLow inches Hg Barometer All Time Low Time $BaromAllTimeLowTime am/pm Barometer All Time Low Date $BaromAllTimeLowDate mm/dd/yyyy Rain Today $RainToday inches Rain Yesterday $RainYesterday inches Rain Month $RainMonth inches Rain Year $RainYear inches Rain Rate Current $RainRateCurrent inches/hour Rain Rate Month High $RainRateMonthHigh inches Hg Rain Rate Month High Time $RainRateMonthHighTime am/pm Rain Rate Month High Date $RainRateMonthHighDate mm/dd/yyyy Rain Rate Year High $RainRateYearHigh inches Hg Rain Rate Year High Time $RainRateYearHighTime am/pm Rain Rate Year High Date $RainRateYearHighDate mm/dd/yyyy Rain Rate All Time High $RainRateAllTimeHigh inches Hg Rain Rate All Time High Time $RainRateAllTimeHighTime am/pm Rain Rate All Time High Date $RainRateAllTimeHighDate mm/dd/yyyy Rain Daily Month High $RainDailyMonthHigh inches Hg Rain Daily Month High Time $RainDailyMonthHighTime am/pm Rain Daily Month High Date $RainDailyMonthHighDate mm/dd/yyyy Rain Daily Year High $RainDailyYearHigh inches Hg Rain Daily Year High Time $RainDailyYearHighTime am/pm Rain Daily Year High Date $RainDailyYearHighDate mm/dd/yyyy Rain Daily All Time High $RainDailyAllTimeHigh inches Hg Rain Daily All Time High Time $RainDailyAllTimeHighTime am/pm Rain Daily All Time High Date $RainDailyAllTimeHighDate mm/dd/yyyy Rain 1 Hour Month High $Rain1HourMonthHigh inches Hg Rain 1 Hour Month High Time $Rain1HourMonthHighTime am/pm Rain 1 Hour Month High Date $Rain1HourMonthHighDate mm/dd/yyyy Rain 1 Hour Year High $Rain1HourYearHigh inches Hg Rain 1 Hour Year High Time $Rain1HourYearHighTime am/pm Rain 1 Hour Year High Date $Rain1HourYearHighDate mm/dd/yyyy Rain 1 Hour All Time High $Rain1HourAllTimeHigh inches Hg Rain 1 Hour All Time High Time $Rain1HourAllTimeHighTime am/pm Rain 1 Hour All Time High Date $Rain1HourAllTimeHighDate mm/dd/yyyy Rain Days Since Last $RainDaysSinceLast days Rain Days This Month $RainDaysThisMonth days Date $Date WD setup Time $Time am/pm Weather Display Version # $WDVersion text Sunrise Time $Sunrise WD default Sunset Time $Sunset WD default Moonrise Time $Moonrise WD default Moonset Time $Moonset WD default Moon Phase $MoonPhase % Moon Age $MoonAge days Release Notes ------------- 2.0 - Added additional parameters Added wind direction text and barometric trend parameters 1.0 - Initial Release