23) {$t[0] = 12; } if (preg_match('/^12.*am/i',$WDtime)) { $t[0] = 0; } $t2 = join(':',$t); // put time back to gether; $t2 = preg_replace('/[^\d\:]/is','',$t2); // strip out the am/pm if any $r = date($timeOnlyFormat , strtotime($t2)); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // strip trailing units from a measurement // i.e. '30.01 in. Hg' becomes '30.01' function unUnit ($data, $DebugMode) { // global $DebugMode; preg_match('/([\d\.\,\+\-]+)/',$data,$t); $r = $t[1]; if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // adjust WD date to desired format // function adjustWDdate ($WDdate, $dateOnlyFormat,$WDdateMDY,$DebugMode ) { // global $timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; $d = split('/',$WDdate); if ($d[2] > 70 and $d[2] <= 99) {$d[2] += 1900;} // 2 digit dates 70-99 are 1970-1999 if ($d[2] < 99) {$d[2] += 2000; } // 2 digit dates (left) are assumed 20xx dates. if ($WDdateMDY) { $new = sprintf('%04d-%02d-%02d',$d[2],$d[0],$d[1]); // M/D/YYYY -> YYYY-MM-DD } else { $new = sprintf('%04d-%02d-%02d',$d[2],$d[1],$d[0]); // D/M/YYYY -> YYYY-MM-DD } $r = date($dateOnlyFormat,strtotime($new)); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // formatDate from Y, M, D // function formatDateYMD ( $Y, $M, $D, $dateOnlyFormat,$DebugMode) { // global $timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; $t = mktime(0,0,0,$M,$D,$Y); $r = date($dateOnlyFormat,$t); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // format weather record like: // '56.1°F on: Mar 01 2008' // '22.5°C on: 01 Mar 2008' // to using the uom values and date format // function reformatRecord ( $record, $dateOnlyFormat,$DebugMode ) { // global $uomTemp,$timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; // old: preg_match('|(.*?)\°(.*)\s+on\:\s+(\S+) (\S+) (\S+)|is',$record,$vals); preg_match('|([\d\,\.\-]+)[\°]*(.*)\s+on\:\s+(\S+) (\S+) (\S+)|is',$record,$vals); /* [0] => 62.3°F on: Mar 03 2008 [1] => 62.3 [2] => F [3] => Mar [4] => 03 [5] => 2008 */ $t = ''; if ($DebugMode) { $t = "\n"; } $d = $vals[3] . ' ' . $vals[4] . ' ' . $vals[5]; $d = date($dateOnlyFormat,strtotime($d)); $r = $t . $vals[1] . ' ' . $uomTemp . ' on ' . $d; if ($DebugMode) { $r = '' . $r . ''; } return ($r); } function getTrends(wdconfig $wdconfig) { // --- default settings -----------(will be overriden by Settings.php)--------------- $uomTemp = '°F'; $uomBaro = ' inHg'; $uomWind = ' mph'; $uomRain = ' in'; $uomPerHour = '/hr'; $uomDistance = ' miles'; $timeFormat = 'd-M-Y g:ia'; // 31-Mar-2006 6:35pm //$timeFormat = 'd-M-Y H:i'; // 31-Mar-2006 18:35 $timeOnlyFormat = 'g:ia'; // h:mm[am|pm]; //$timeOnlyFormat = 'H:i'; // hh:mm $dateOnlyFormat = 'd-M-Y'; // d-Mon-YYYY $WDdateMDY = true; // true=dates by WD are 'month/day/year' // // false=dates by WD are 'day/month/year' $ourTZ = "PST8PDT"; //NOTE: this *MUST* be set correctly to // translate UTC times to your LOCAL time for the displays. // $haveUV = true; // set to false if no UV sensor $haveSolar = true; // set to false if no Solar sensor // --- end of settings for standalone use // overrides from Settings.php if available //global $SITE; //if (isset($SITE['uomTemp'])) {$uomTemp = $SITE['uomTemp'];} //if (isset($SITE['uomBaro'])) {$uomBaro = $SITE['uomBaro'];} //if (isset($SITE['uomWind'])) {$uomWind = $SITE['uomWind'];} //if (isset($SITE['uomRain'])) {$uomRain = $SITE['uomRain'];} //if (isset($SITE['uomPerHour'])) {$uomPerHour = $SITE['uomPerHour'];} //if (isset($SITE['uomDistance'])) {$uomDistance = $SITE['uomDistance'];} //if (isset($SITE['timeFormat'])) {$timeFormat = $SITE['timeFormat'];} //if (isset($SITE['timeOnlyFormat'])) {$timeOnlyFormat = $SITE['timeOnlyFormat'];} //if (isset($SITE['dateOnlyFormat'])) {$dateOnlyFormat = $SITE['dateOnlyFormat'];} //if (isset($SITE['WDdateMDY'])) {$WDdateMDY = $SITE['WDdateMDY'];} //if (isset($SITE['tz'])) {$ourTZ = $SITE['tz'];} //if (isset($SITE['UV'])) {$haveUV = $SITE['UV'];} //if (isset($SITE['SOLAR'])) {$haveSolar = $SITE['SOLAR'];} // end of overrides from Settings.php $uomTemp = $wdconfig->getProperty('uomTemp'); $uomBaro = $wdconfig->getProperty('uomBaro'); $uomWind = $wdconfig->getProperty('uomWind'); $uomRain = $wdconfig->getProperty('uomRain'); $uomPerHour = $wdconfig->getProperty('uomPerHour'); $imagesDir = $wdconfig->getProperty('imagesDir'); $timeFormat = $wdconfig->getProperty('timeFormat'); $ourTZ = $wdconfig->getProperty('tz'); $WXtags = $wdconfig->getProperty('WXTags'); $timeOnlyFormat = $wdconfig->getProperty('timeOnlyFormat'); $dateOnlyFormat = $wdconfig->getProperty('dateOnlyFormat'); $WDdateMDY = $wdconfig->getProperty('WDdateMDY'); $haveUV = $wdconfig->getProperty('UV'); $haveSolar = $wdconfig->getProperty('SOLAR'); $fcstorg = $wdconfig->getProperty('fcstorg'); $fcstby = $wdconfig->getProperty('fcstorg'); $fcstscript = $wdconfig->getProperty('fcstscript'); $UVscript = $wdconfig->getProperty('UVscript'); // testing parameters $DebugMode = false; if (isset($_REQUEST['debug'])) {$DebugMode = strtolower($_REQUEST['debug']) == 'y'; } if (isset($_REQUEST['UV'])) {$haveUV = $_REQUEST['UV'] <> '0';} if (isset($_REQUEST['solar'])) {$haveSolar = $_REQUEST['solar'] <> '0';} ?>
TIME | TEMP |
WIND SPEED |
WIND GUST |
WIND DIR |
HUMIDITY % |
PRESSURE |
RAIN |
Current | 41.9 | 8.1 | 10.4 | WNW | 74 | 30.148 | 0.00 |
5 minutes ago | 42.0 | 10.4 | 12.7 | NW | 74 | 30.142 | 0.00 |
10 minutes ago | 42.1 | 9.2 | 10.4 | NW | 74 | 30.140 | 0.00 |
15 minutes ago | 42.0 | 10.4 | 11.5 | WNW | 75 | 30.135 | 0.00 |
20 minutes ago | 42.0 | 9.2 | 12.7 | NW | 76 | 30.138 | 0.00 |
30 minutes ago | 41.9 | 9.2 | 11.5 | NW | 75 | 30.140 | 0.00 |
45 minutes ago | 42.2 | 9.2 | 11.5 | NW | 75 | 30.137 | 0.00 |
60 minutes ago | 42.3 | 11.5 | 11.5 | NW | 76 | 30.137 | 0.00 |
75 minutes ago | 42.5 | 11.5 | 16.1 | NW | 74 | 30.133 | 0.00 |
90 minutes ago | 42.3 | 15.0 | 16.1 | NW | 76 | 30.127 | 0.00 |
105 minutes ago | 41.8 | 13.8 | 18.4 | NW | 77 | 30.124 | 0.00 |
120 minutes ago | 41.5 | 13.8 | 17.3 | NW | 79 | 30.123 | 0.00 |
RAIN | RAIN HISTORY | ||
Today | ( last hour) | Today | 4 day(s) since last rain on |
Yest. | Week | inches of rain in last 7 days. | |
Month | (0 rainy day(s) this month) | Month | inches of rain last month. |
Year | (20 rainy day(s) so far) | Year | inches of rain last year at this time. |
TEMPERATURE HIGHS | HOT DAYS THIS MONTH | ||
Today | at | Max > | 0 day(s) |
Yest. | at | Max > | 0 day(s) |
Month | on | Warmest day | |
Year | on | Warmest night | |
TEMPERATURE LOWS | COLD DAYS THIS MONTH | ||
Today | at | Min < | 0 day(s) |
Yest. | at | Min < | 0 day(s) |
Month | on | Coldest day | |
Year | on | Coldest night | |
BAROMETER HIGHS | WIND CHILL LOWS | ||
Today | at | Today | at |
Yest. | at | Yest. | at |
Month | on | Month | on |
Year | on | Year | on |
EVAPOTRANSPIRATION | RAIN | ||
Today | Today | ||
Yest. | Yest. | ||
Month | Month | ||
SOLAR HIGHS | UV HIGHS | ||
Today | 0 W/m2 at | Today | 0.0 index at |
Yest. | 0.0 W/m2 at | Yest. | 0.0 index at |
CURRENT | ![]() |
|
Now | NW | |
Gust | NW | |
Gust/hr | ||
WIND GUST HIGHS | ||
Today | NW at | |
Yest. | at | |
Month | on | |
Year | on | |
WIND GUST AVERAGE HIGHS | ||
Today | NW at | |
Yest. | at | |
Month | on | |
Year | on | |
WIND RUN | ||
Today | ||
Month | ||
Year |