Xert casco antiguo, vista Oeste more information Xert casco antiguo, vista Oeste


Xert, Vista Sur more information Xert, Vista Sur


Thunder radar more information blitzortung!


Rain radar  rain snow radar


Visita nuestra red de sitios de meteo:

Template documentation
and downloads

El Tiempo en XertWeb Principal

Meteotemplate: El tiempo en XertPlantilla Meteotemplate

SaratogaWeather: El tiempo en XertPlantilla V34

PWS Dashboard: El tiempo en XertPlantilla GraphWeather



Display key values and files

scriptsDW/tagsWLCOM.php - dated: 03-06-2020 21:47

    1 | <?php 	#ini_set('display_errors', 'On');   error_reporting(E_ALL);	
    2 | #-----------------------------------------------------------------------
    3 | # display source of script if requested so
    4 | #-----------------------------------------------------------------------
    5 | if (isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
    6 |    $filenameReal = __FILE__;
    7 |    $download_size = filesize($filenameReal);
    8 |    header('Pragma: public');
    9 |    header('Cache-Control: private');
   10 |    header('Cache-Control: no-cache, must-revalidate');
   11 |    header("Content-type: text/plain");
   12 |    header("Accept-Ranges: bytes");
   13 |    header("Content-Length: $download_size");
   14 |    header('Connection: close');
   15 |    readfile($filenameReal);
   16 |    exit;
   17 | }
   18 | $pageName	= 'tagsWLCOM.php';
   19 | if (!isset($SITE)){echo "<h3>invalid call to script $pageName</h3>";exit;}
   20 | $pageVersion	= '3.04 2017-04-12';
   21 | $SITE['wsModules'][$pageName] = 'version: ' . $pageVersion;
   22 | $pageFile = basename(__FILE__);			// check to see this is the real script
   23 | if ($pageFile <> $pageName) {$SITE['wsModules'][$pageFile]	= 'this file loaded instead of '.$pageName;}
   24 | echo '<!-- module '.$pageFile.' ==== '.$SITE['wsModules'][$pageFile]." -->".PHP_EOL;
   25 | #-----------------------------------------------------------------------
   26 | # 3.02 2016-10-22 2.7 release version  adapted for error in cache file name
   27 | # 3.03 2017-04-12 adapted for extra empty ? line at start of xml + extra code to check xml 
   28 | # --------------------------------------- version ----------------------
   29 | $ws['tags_processed']	= $pageName.'-'.$pageVersion;
   30 | $ws['tags_originated']	= 'wl.com-user'.$SITE['wlink_key'];
   31 | $ws['tags_today']	= $ws['tags_originated'];
   32 | $ws['tags_yday']	= $SITE['ydayTags'];
   33 | $ws['tags_yday_time']	= 'n/a';
   34 | #
   35 | $tagsWLCOM      = $pageName;
   36 | $test           = false;
   37 | if ($test) {echo '<pre>Start test'.PHP_EOL;}
   38 | #
   39 | if ($test) {
   40 |         $startEcho      = '';           $endEcho        = '';
   41 | } else {$startEcho      = '<!-- ';      $endEcho        = ' -->';
   42 | }
   43 | $url            = 'http://api.weatherlink.com/v1/NoaaExt.xml?user='.$SITE['wlink_key'].'&pass='.$SITE['wlink_pw'];
   44 | $url_fake       = 'https://api.weatherlink.com/v1/NoaaExt.xml?user=001D0A006738&pass=HILARIET';
   45 | $uomTemp	= $SITE['uomTemp'];
   46 | $uomBaro	= $SITE['uomBaro'];
   47 | $uomRain	= $SITE['uomRain'];
   48 | $uomSnow	= $SITE['uomSnow'];
   49 | $uomDistance    = $SITE['uomDistance'];
   50 | $uomWind	= $SITE['uomWind'];
   51 | $uomPerHour	= $SITE['uomPerHour'];
   52 | $uomHeight	= $SITE['uomHeight'];
   53 | $fileToLoad     = $SITE['wsTags'];
   54 | $uoms		= $uomTemp.$uomBaro.$uomWind.$uomRain.$uomSnow.$uomDistance.$uomPerHour.$uomHeight;
   55 | $from		= array('/',' ','°','.php');
   56 | $to		= '';
   57 | $cachefileWLC	= $SITE['cacheDir'].'uploadDW'.str_replace ($from, $to, $SITE['wlink_key'].'_'.$fileToLoad.'_'.$uoms);  // add uoms  // 2016-10-22
   58 | $cachefileWLC	= $SITE['cacheDir'].str_replace ($from, $to,$fileToLoad.$uoms);  // add uoms  // 2016-10-22
   59 | 
   60 | #echo $cachefileWLC; exit;
   61 | $loaded_current = false;
   62 | $cacheAllowed   = $SITE['cacheDW'];     // 2016-10-22
   63 | $diff           = 0;                    // 2016-10-22
   64 | $local_current  = './uploadDW/weatherlink3.xml';
   65 | if ($SITE['wlink_key'] == 'HILARIET') {$test = true;}	
   66 | #
   67 | if (isset($_REQUEST['force']) && strtolower($_REQUEST['force']) == 'wlc') {
   68 |         echo $startEcho.$tagsWLCOM.': data freshly loaded while "force" was used.'.$endEcho.PHP_EOL;
   69 |         $loaded_current =  false;
   70 | }elseif (file_exists($cachefileWLC) ){
   71 | 	$file_time      = filemtime($cachefileWLC);
   72 | 	$now            = time();
   73 | 	$diff           = ($now-$file_time);
   74 | #	$cacheAllowed   = $SITE['cacheDW'];
   75 |         echo  "<!-- 
   76 | $tagsWLCOM ($cachefileWLC)
   77 |         cache time   = ".date('c',$file_time)." from unix time $file_time
   78 |         current time = ".date('c',$now)." from unix time $now 
   79 |         difference   = $diff (seconds)
   80 |         diff allowed = $cacheAllowed (seconds) -->".PHP_EOL;		
   81 | 	if ($diff <= $cacheAllowed){
   82 | 		$ws     =  unserialize(file_get_contents($cachefileWLC));
   83 |                 echo $startEcho.$tagsWLCOM.': data loaded from '.$cachefileWLC.$endEcho.PHP_EOL;
   84 |                 $loaded_current =   true;
   85 |  #               print_r ($ws); # exit;
   86 |                 return;         // ?????
   87 | 	} else {
   88 | 		echo $startEcho.$tagsWLCOM.": data to old, will be loaded from url ".$endEcho.PHP_EOL;
   89 | 	}
   90 | }
   91 | if ($test) {
   92 |         echo $startEcho.$tagsWLCOM.': data loaded from test-file at '.$local_current.$endEcho.PHP_EOL;
   93 |         $string = file_get_contents($local_current);
   94 |         $loaded_current = false;
   95 | }elseif ($loaded_current == false) {
   96 |         echo $startEcho.$tagsWLCOM.': data loaded from url: '.$url_fake.$endEcho.PHP_EOL;
   97 |         $ch = curl_init();
   98 |         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   99 |         curl_setopt ($ch, CURLOPT_URL, $url);
  100 |         curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  101 |         curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 4);
  102 |         curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
  103 |         $string = trim(curl_exec ($ch) );
  104 |  #       echo $string; exit;
  105 |         curl_close ($ch);
  106 | }
  107 | 
  108 | function dw_isXML($xml){
  109 |     libxml_use_internal_errors(true);
  110 |     $doc        = new DOMDocument('1.0', 'utf-8');
  111 |     $doc->loadXML($xml);
  112 |     $errors     = libxml_get_errors();
  113 |     if (empty($errors)) {       return 'OK';}
  114 |     $error      = $errors[0];
  115 |     if($error->level < 3){      return 'OK';}
  116 |     $explodedxml= explode(PHP_EOL, $xml);
  117 |     $badxml     = $explodedxml[($error->line)-1];
  118 |     $message = $error->message . ' at line ' . $error->line . '. Bad XML: ' . htmlentities($badxml);
  119 |     return $message;
  120 | }
  121 | $return = dw_isXML($string);
  122 | if ($return <> 'OK') { 
  123 |         echo $startEcho.$tagsWLCOM.'error no valid data loaded => '.$return.$endEcho.PHP_EOL; 
  124 |         $string = '';
  125 | }
  126 | 
  127 | if ($loaded_current == false && $string == '') {
  128 | 	if ($diff <= 10* $cacheAllowed){                // 2016-10-22
  129 | 		$ws     =  unserialize(file_get_contents($cachefileWLC));
  130 |                 echo $startEcho.$tagsWLCOM.': data loaded from '.$cachefileWLC.' after upping cache time'.$endEcho.PHP_EOL;
  131 |                 $loaded_current =   true;
  132 |  #               print_r ($ws); # exit;
  133 |                 return;         // ?????
  134 |         }
  135 |         echo '<H3 input file from wl.com has no valid contents - program ends, please reload page </h3>'; return;
  136 | }
  137 | $davis  = new SimpleXMLElement($string);
  138 | $xml    = $davis->davis_current_observation;
  139 | #$ws = array();          // ????
  140 | $ws_date_ft = 'YmdHis';
  141 | # --------------------------------------- conditions--------------------
  142 | 
  143 | $ws['actTime']	= date($ws_date_ft,strtotime ((string) $davis->observation_time_rfc822)) ;   //'<observation_time_rfc822>Fri, 24 Oct 2014 09:01:16 +0200</observation_time_rfc822>';
  144 | $ymd            = substr($ws['actTime'],0,8);
  145 | $ws['tags_today_time']	= $ws['actTime'];
  146 | 
  147 | # ------------------------------------------ temperature ---------------
  148 | #                               NO yesterday values  !
  149 | $to 	= $SITE['uomTemp'];
  150 | $from	= 'F';
  151 | # ------------   temp outside
  152 | #$ws['tempAct']		= wsConvertTemperature((string)$davis->temp_c, $from);          // <temp_c>11.6</temp_c> 
  153 | $ws['tempAct']		= wsConvertTemperature((string)$davis->temp_f, $from);          // <temp_f>52.8</temp_f>
  154 | $ws['tempDelta'] = 0;
  155 | 
  156 | $ws['tempMinToday']	= wsConvertTemperature((string)$xml->temp_day_low_f, 	$from); // <temp_day_low_f>51.7</temp_day_low_f>
  157 | $ws['tempMinMonth']	= wsConvertTemperature((string)$xml->temp_month_low_f, 	$from); // <temp_month_low_f>44.6</temp_month_low_f>
  158 | $ws['tempMinYear']	= wsConvertTemperature((string)$xml->temp_year_low_f, 	$from); // <temp_year_low_f>31</temp_year_low_f>
  159 | $ws['tempMinTodayTime']	= wdDate((string)$xml->temp_day_low_time);                      // <temp_day_low_time>2:40pm</temp_day_low_time>
  160 | 
  161 | $ws['tempMaxToday']	= wsConvertTemperature((string)$xml->temp_day_high_f, 	$from); // <temp_day_high_f>57.2</temp_day_high_f>
  162 | $ws['tempMaxMonth']	= wsConvertTemperature((string)$xml->temp_month_high_f, $from); // <temp_month_high_f>77.3</temp_month_high_f>
  163 | $ws['tempMaxYear']	= wsConvertTemperature((string)$xml->temp_year_high_f, 	$from); // <temp_year_high_f>96.4</temp_year_high_f>
  164 | $ws['tempMaxTodayTime']	= wdDate((string)$xml->temp_day_high_time);                     // <temp_day_high_time>12:00am</temp_day_high_time>
  165 | # ------------   temp inside
  166 | $ws['tempActInside']	        = wsConvertTemperature((string)$xml->temp_in_f, 	$from);         // <temp_in_f>77.1</temp_in_f>
  167 | $ws['tempInAct']                = $ws['tempActInside'];
  168 | 
  169 | $ws['tempInMinToday']           = wsConvertTemperature((string)$xml->temp_in_day_low_f, $from);         // <temp_in_day_low_f>76.7</temp_in_day_low_f>  
  170 | $ws['tempInMinMonth']           = wsConvertTemperature((string)$xml->temp_in_month_low_f, $from);       // <temp_in_month_low_f>76.3</temp_in_month_low_f>  
  171 | $ws['tempInMinYear']            = wsConvertTemperature((string)$xml->temp_in_year_low_f, $from);        // <temp_in_year_low_f>68</temp_in_year_low_f> 
  172 | $ws['tempInMinTodayTime']       = wdDate((string)$xml->temp_in_day_low_time);                           // <temp_in_day_low_time>2:34pm</temp_in_day_low_time>  
  173 | 
  174 | $ws['tempInMaxToday']           = wsConvertTemperature((string)$xml->temp_in_day_high_f, $from);        // <temp_in_day_high_f>78.6</temp_in_day_high_f>  
  175 | $ws['tempInMaxMonth']           = wsConvertTemperature((string)$xml->temp_in_month_high_f, $from);      //<temp_in_month_high_f>86.4</temp_in_month_high_f> 
  176 | $ws['tempInMaxYear']            = wsConvertTemperature((string)$xml->temp_in_year_high_f, $from);       // <temp_in_year_high_f>106</temp_in_year_high_f>
  177 | $ws['tempInMaxTodayTime']       = wdDate((string)$xml->temp_in_day_high_time);                          // <temp_in_day_high_time>10:33am</temp_in_day_high_time>  
  178 | # ------------   temp extra 1
  179 | if (isset ($xml->temp_extra_1) ) {
  180 | $ws['tempActExtra1']	        = wsConvertTemperature((string)$xml->temp_extra_1, 	$from);	        // <temp_extra_1>61</temp_extra_1>
  181 | $ws['tempE1Act']                = $ws['tempActExtra1'];
  182 | 
  183 | $ws['tempE1MinToday']           = wsConvertTemperature((string)$xml->temp_extra_1_day_low, 	$from);	// <temp_extra_1_day_low>61</temp_extra_1_day_low>
  184 | $ws['tempE1MinMonth']           = wsConvertTemperature((string)$xml->temp_extra_1_month_low, 	$from);	// <temp_extra_1_month_low>61</temp_extra_1_month_low>
  185 | $ws['tempE1MinYear']            = wsConvertTemperature((string)$xml->temp_extra_1_year_low, 	$from);	// <temp_extra_1_year_low>61</temp_extra_1_year_low>
  186 | $ws['tempE1MinTodayTime']       = wdDate((string)$xml->temp_extra_1_day_low_time);	                // <temp_extra_1_day_low_time>4:13am</temp_extra_1_day_low_time>
  187 | 
  188 | $ws['tempE1MaxToday']           = wsConvertTemperature((string)$xml->temp_extra_1_day_high, 	$from);	// <temp_extra_1_day_high>62</temp_extra_1_day_high>
  189 | $ws['tempE1MaxMonth']           = wsConvertTemperature((string)$xml->temp_extra_1_month_high, 	$from);	// <temp_extra_1_month_high>67</temp_extra_1_month_high>
  190 | $ws['tempE1MaxYear']            = wsConvertTemperature((string)$xml->temp_extra_1_year_high, 	$from);	// <temp_extra_1_year_high>86</temp_extra_1_year_high>
  191 | $ws['tempE1MaxTodayTime']       = wdDate((string)$xml->temp_extra_1_day_high_time);	                // <temp_extra_1_day_high_time>12:00am</temp_extra_1_day_high_time>
  192 | }
  193 | else {  $ws['tempActExtra1'] = $ws['tempE1Act'] = '';
  194 | }
  195 | if (isset ($xml->temp_extra_2) ) {
  196 |         $ws['tempActExtra2']	= wsConvertTemperature((string)$xml->temp_extra_2, 	$from);	
  197 |         $ws['tempE2Act']        = $ws['tempActExtra2'];
  198 | 
  199 |         $ws['tempE2MinToday']   = wsConvertTemperature((string)$xml->temp_extra_2_day_low, 	$from);
  200 |         $ws['tempE2MinMonth']   = wsConvertTemperature((string)$xml->temp_extra_2_month_low, 	$from);	
  201 |         $ws['tempE2MinYear']    = wsConvertTemperature((string)$xml->temp_extra_21_year_low, 	$from);	
  202 |         $ws['tempE2MinTodayTime'] = wdDate((string)$xml->temp_extra_2_day_low_time);	
  203 | 
  204 |         $ws['tempE2MaxToday']   = wsConvertTemperature((string)$xml->temp_extra_2_day_high, 	$from);
  205 |         $ws['tempE2MaxMonth']   = wsConvertTemperature((string)$xml->temp_extra_2_month_high, 	$from);	
  206 |         $ws['tempE2MaxYear']    = wsConvertTemperature((string)$xml->temp_extra_2_year_high, 	$from);	
  207 |         $ws['tempE2MaxTodayTime']= wdDate((string)$xml->temp_extra_2_day_high_time);
  208 | } 
  209 | else {  $ws['tempActExtra2'] = $ws['tempE2Act'] = '';
  210 | }
  211 | # ------------   dewpoint
  212 | $ws['dewpAct']  	        = wsConvertTemperature((string)$davis->dewpoint_f, 	$from);         // <dewpoint_f>48</dewpoint_f>
  213 | $ws['dewpDelta'] = 0;
  214 | 
  215 | $ws['dewpMinToday']  	        = wsConvertTemperature((string)$xml->dewpoint_day_low_f, 	$from); // <dewpoint_day_low_f>46</dewpoint_day_low_f>
  216 | $ws['dewpMinMonth']  	        = wsConvertTemperature((string)$xml->dewpoint_month_low_f, 	$from); // <dewpoint_month_low_f>41</dewpoint_month_low_f>
  217 | $ws['dewpMinYear']  	        = wsConvertTemperature((string)$xml->dewpoint_year_low_f, 	$from); // <dewpoint_year_low_f>29</dewpoint_year_low_f>
  218 | $ws['dewpMinTodayTime']	        = wdDate((string)$xml->dewpoint_day_low_time);                          // <dewpoint_day_low_time>12:34pm</dewpoint_day_low_time>
  219 | 
  220 | $ws['dewpMaxToday']  	        = wsConvertTemperature((string)$xml->dewpoint_day_high_f, 	$from); // <dewpoint_day_high_f>53</dewpoint_day_high_f>
  221 | $ws['dewpMaxMonth']  	        = wsConvertTemperature((string)$xml->dewpoint_month_high_f, 	$from); // <dewpoint_month_high_f>64</dewpoint_month_high_f>
  222 | $ws['dewpMaxYear']  	        = wsConvertTemperature((string)$xml->dewpoint_year_high_f, 	$from); // <dewpoint_year_high_f>72</dewpoint_year_high_f>
  223 | $ws['dewpMaxTodayTime']	        = wdDate((string)$xml->dewpoint_day_high_time);                         // <dewpoint_day_high_time>12:00am</dewpoint_day_high_time>
  224 | # ------------   temp windchill	
  225 | $ws['chilAct']		        = wsConvertTemperature((string)$davis->windchill_f, 	$from);         // <windchill_f>53</windchill_f>
  226 | $ws['chilDelta']	        = '0';
  227 | 
  228 | $ws['chilMinToday']	        = wsConvertTemperature((string)$xml->windchill_day_low_f, 	$from); // <windchill_day_low_f>52</windchill_day_low_f>
  229 | $ws['chilMinMonth']	        = wsConvertTemperature((string)$xml->windchill_month_low_f, 	$from); // <windchill_month_low_f>43</windchill_month_low_f>
  230 | $ws['chilMinYear']	        = wsConvertTemperature((string)$xml->windchill_year_low_f, 	$from); // <windchill_year_low_f>31</windchill_year_low_f>
  231 | $ws['chilMinTodayTime']	        = wdDate((string)$xml->windchill_day_low_time);                          // <windchill_day_low_time>9:10am</windchill_day_low_time>';
  232 | # ------------   heat index	
  233 | $ws['heatAct']		= wsConvertTemperature((string)$davis->heat_index_f, 	$from);                 // <heat_index_f>53</heat_index_f>
  234 | 
  235 | $ws['heatMaxToday']	= wsConvertTemperature((string)$xml->heat_index_day_high_f, 	$from);         // <heat_index_day_high_f>57</heat_index_day_high_f>
  236 | $ws['heatMaxMonth']	= wsConvertTemperature((string)$xml->heat_index_month_high_f, 	$from);         // <heat_index_month_high_f>79</heat_index_month_high_f>
  237 | $ws['heatMaxYear']	= wsConvertTemperature((string)$xml->heat_index_year_high_f, 	$from);         // <heat_index_year_high_f>101</heat_index_year_high_f>
  238 | $ws['heatMaxTodayTime']	= wdDate((string)$xml->heat_index_day_high_time);                               // <heat_index_day_high_time>12:00am</heat_index_day_high_time>	
  239 | # ------------------------------------------ pressure / baro -----------
  240 | $to 	= $SITE['uomBaro'];
  241 | $from	= 'in';
  242 | $ws['baroAct'] 		= wsConvertBaro((string)$davis->pressure_in, 	$from);                         // <pressure_in>30.09</pressure_in>
  243 | $ws['baroDelta']        = (string) $xml-> pressure_tendency_string;                                     // <pressure_tendency_string>Steady</pressure_tendency_string>
  244 | $ws['baroTrend']        = (string) $xml-> pressure_tendency_string;  
  245 | 
  246 | $ws['baroMinToday']	= wsConvertBaro((string)$xml->pressure_day_low_in,   $from);                    // <pressure_day_low_in>30.079</pressure_day_low_in>
  247 | $ws['baroMinMonth']	= wsConvertBaro((string)$xml->pressure_month_low_in, 	$from);                 // <pressure_month_low_in>29.512</pressure_month_low_in>
  248 | $ws['baroMinYear'] 	= wsConvertBaro((string)$xml->pressure_year_low_in, 	$from);                 // <pressure_year_low_in>29.003</pressure_year_low_in>	
  249 | $ws['baroMinTodayTime']	= wdDate((string)$xml->pressure_day_low_time);                                  // <pressure_day_low_time>3:35pm</pressure_day_low_time>
  250 | 
  251 | $ws['baroMaxToday']	= wsConvertBaro((string)$xml->pressure_day_high_in, 	$from);                 // <pressure_day_high_in>30.174</pressure_day_high_in>
  252 | $ws['baroMaxMonth']	= wsConvertBaro((string)$xml->pressure_month_high_in, 	$from);                 // <pressure_month_high_in>30.206</pressure_month_high_in>
  253 | $ws['baroMaxYear'] 	= wsConvertBaro((string)$xml->pressure_year_high_in, 	$from);                 // <pressure_year_high_in>30.577</pressure_year_high_in>
  254 | $ws['baroMaxTodayTime']	= wdDate((string)$xml->pressure_day_high_time);                                 // <pressure_day_high_time>12:07am</pressure_day_high_time>
  255 | 
  256 | # ------------------------------------------ humidity  -----------------------------------
  257 | # ------------   humidity outside 
  258 | $ws['humiAct']		        = (string) $davis -> relative_humidity;                                 // <relative_humidity>83</relative_humidity>
  259 | $ws['humiDelta'] = 0;
  260 | 
  261 | $ws['humiMinToday'] 	        = (string) $xml -> relative_humidity_day_low;                           // <relative_humidity_day_low>80</relative_humidity_day_low>
  262 | $ws['humiMinMonth'] 	        = (string) $xml -> relative_humidity_month_low;                         // <relative_humidity_month_low>61</relative_humidity_month_low>
  263 | $ws['humiMinYear'] 	        = (string) $xml -> relative_humidity_year_low;                          // <relative_humidity_year_low>27</relative_humidity_year_low>
  264 | $ws['humiMinTodayTime']         = wdDate((string)$xml->relative_humidity_day_low_time);                 // <relative_humidity_day_low_time>12:34pm</relative_humidity_day_low_time>
  265 | 
  266 | $ws['humiMaxToday']	        = (string) $xml -> relative_humidity_day_high;                          // <relative_humidity_day_high>89</relative_humidity_day_high>
  267 | $ws['humiMaxMonth']	        = (string) $xml -> relative_humidity_month_high;                        // <relative_humidity_month_high>97</relative_humidity_month_high>
  268 | $ws['humiMaxYear']	        = (string) $xml -> relative_humidity_year_high;                         // <relative_humidity_year_high>99</relative_humidity_year_high>
  269 | $ws['humiMaxTodayTime']         = wdDate((string)$xml->relative_humidity_day_high_time);                // <relative_humidity_day_high_time>3:26am</relative_humidity_day_high_time>
  270 | # ------------   humidity ibside
  271 | $ws['humiInAct']		= (string) $xml -> relative_humidity_in;                                // <relative_humidity_in>83</relative_humidity_in>
  272 | $ws['humiInDelta'] = 0;
  273 | 
  274 | $ws['humiInMinToday'] 	        = (string) $xml -> relative_humidity_in_day_low;                        // <relative_humidity_in_day_low>33</relative_humidity_in_day_low>
  275 | $ws['humiInMinMonth'] 	        = (string) $xml -> relative_humidity_in_month_low;                      // <relative_humidity_in_month_low>31</relative_humidity_in_month_low>
  276 | $ws['humiInMinYear'] 	        = (string) $xml -> relative_humidity_in_year_low;                       // <relative_humidity_in_year_low>19</relative_humidity_in_year_low>
  277 | $ws['humiInMinTodayTime']       = wdDate((string)$xml->relative_humidity_in_day_low_time);              // <relative_humidity_in_day_low_time>9:34am</relative_humidity_in_day_low_time>
  278 | 
  279 | $ws['humiInMaxToday']	        = (string) $xml -> relative_humidity_in_day_high;                       // <relative_humidity_in_day_high>36</relative_humidity_in_day_high>
  280 | $ws['humiInMaxMonth']	        = (string) $xml -> relative_humidity_in_month_high;                     // <relative_humidity_in_month_high>40</relative_humidity_in_month_high>
  281 | $ws['humiInMaxYear']	        = (string) $xml -> relative_humidity_in_year_high;                      // <relative_humidity_in_year_high>54</relative_humidity_in_year_high>
  282 | $ws['humiInMaxTodayTime']       = wdDate((string)$xml->relative_humidity_in_day_high_time);             // <relative_humidity_in_day_high_time>3:10pm</relative_humidity_in_day_high_time>
  283 | 
  284 | 
  285 | # ------------------------------------------ rain  ---------------------
  286 | $to 	= $SITE['uomRain'];
  287 | $from	= 'in'; 
  288 | #
  289 | $ws['rainRateAct'] 	= wsConvertRainfall((string)$xml->rain_rate_in_per_hr,  $from);                 // <rain_rate_in_per_hr>0.0000</rain_rate_in_per_hr>
  290 | $ws['rainRateToday'] 	= wsConvertRainfall((string)$xml->rain_rate_in_per_hr,  $from);                 // ??  <rain_rate_in_per_hr>0.0000</rain_rate_in_per_hr>
  291 | 
  292 | $ws['rainToday']	= wsConvertRainfall((string)$xml->rain_day_in,          $from);                 // <rain_day_in>0.0000</rain_day_in>
  293 | $ws['rainMonth']	= wsConvertRainfall((string)$xml->rain_month_in,        $from);                 // <rain_month_in>0.7480</rain_month_in>
  294 | $ws['rainYear']		= wsConvertRainfall((string)$xml->rain_year_in,         $from) ;                // <rain_year_in>19.2756</rain_year_in>
  295 | 
  296 | # ----- ev test
  297 | $ws['etToday']		= wsConvertRainfall((string)$xml->et_day,               $from);                 // <et_day>0.007</et_day>
  298 | $ws['etMonth']		= wsConvertRainfall((string)$xml->et_month,             $from);                 // <et_month>0.46</et_month>
  299 | $ws['etYear']		= wsConvertRainfall((string)$xml->et_year,              $from);                 // <et_year>22.55</et_year>
  300 | # ------------------------------------------ wind  ---------------------
  301 | $to 	= $SITE['uomWind'];
  302 | $from	= 'mph'; 	
  303 | 
  304 | $ws['windActDeg']       = (string) $davis -> wind_degrees;                              // <wind_degrees>184</wind_degrees>
  305 | $ws['windAvgDir']       = $ws['windActDir'] = $ws['windActDeg'];
  306 | #$ws['windActDsc']	= (string) $davis -> wind_dir;                                  // <wind_dir>South</wind_dir>
  307 | $ws['windActDsc']	= wsConvertWinddir ($ws['windActDeg']);
  308 | 
  309 | $ws['windAct']		= wsConvertWindspeed((string)$xml->wind_ten_min_avg_mph,$from); // <wind_ten_min_avg_mph>1</wind_ten_min_avg_mph>
  310 | $ws['windBeafort']	= wsBeaufortNumber ((string)$xml->wind_ten_min_avg_mph, $from);
  311 | 
  312 | #$ws['gustAct']		= wsConvertWindspeed((string)$xml->wind_kt, 	        'kts'); // <wind_kt>1</wind_kt>
  313 | $ws['gustAct']		= wsConvertWindspeed((string)$xml->wind_mph, 	        $from); // <wind_mph>1</wind_mph>
  314 | 
  315 | $ws['gustMaxToday']	= wsConvertWindspeed((string)$xml->wind_day_high_mph, 	$from); // <wind_day_high_mph>9</wind_day_high_mph>
  316 | $ws['gustMaxMonth']	= wsConvertWindspeed((string)$xml->wind_month_high_mph, $from); // <wind_month_high_mph>22</wind_month_high_mph>
  317 | $ws['gustMaxYear']	= wsConvertWindspeed((string)$xml->wind_year_high_mph, 	$from); // <wind_year_high_mph>27</wind_year_high_mph>
  318 | 
  319 | $ws['gustMaxTodayTime']	= wdDate((string)$xml->relative_humidity_in_day_high_time);     // <wind_day_high_time>12:38am</wind_day_high_time>
  320 | 
  321 | if ($ws['gustAct'] <= $ws['windAct'])	{$ws['gustAct'] = $ws['windAct'];}
  322 | # ------------------------------------------  UV   ---------------------
  323 | $ws['uvAct']		= (string)$xml->uv_index;                               // <uv_index>0.0</uv_index>
  324 | if (isset($xml->uv_index_day_high) ) { 
  325 |         $ws['uvMaxToday']       = (string)$xml->uv_index_day_high;
  326 |         $ws['uvMaxTodayTime']   = wdDate((string)$xml->uv_index_day_high_time);}
  327 | else {  $ws['uvMaxToday']       = '-1';
  328 |         $ws['uvMaxTodayTime']   = '0';  }
  329 | $ws['uvMaxMonth']	= (string)$xml->uv_index_month_high;                    // <uv_index_month_high>2.1</uv_index_month_high>
  330 | $ws['uvMaxYear']	= (string)$xml->uv_index_year_high;                     // <uv_index_year_high>7.2</uv_index_year_high>
  331 | # ------------------------------------------ Solar  --------------------
  332 | $ws['solarAct']		= (string)$xml->solar_radiation;                        // <solar_radiation>7</solar_radiation>
  333 | $ws['solarMaxToday']	= (string)$xml->solar_radiation_day_high;               // <solar_radiation_day_high>116</solar_radiation_day_high>
  334 | $ws['solarMaxMonth']	= (string)$xml->solar_radiation_month_high;             // <solar_radiation_month_high>659</solar_radiation_month_high>
  335 | $ws['solarMaxYear']	= (string)$xml->solar_radiation_year_high;              // <solar_radiation_year_high>1264</solar_radiation_year_high>
  336 | 
  337 | $ws['solarMaxTodayTime']= wdDate((string)$xml->solar_radiation_day_high_time);  // <solar_radiation_day_high_time>12:18am</solar_radiation_day_high_time>
  338 | # ------------------------------------------ sun NO moon --------------
  339 | $ws['sunrise']		= wdDate((string)$xml->sunrise);                        //'<sunrise>7:59am</sunrise>';
  340 | $ws['sunset']		= wdDate((string)$xml->sunset);;                        //<sunset>6:55pm</sunset>';
  341 | # ------------------------------------------ some more -----------------
  342 | $ws['wsVersion']	= (string)$davis->credit;                               // <credit>Davis Instruments Corp.</credit>'; // <davis_current_observation version="1.0">
  343 | $ws['wsHardware'] 	= (string)$davis->station_id;                           // <station_id>wvdkuil</station_id>'; 
  344 | $ws['wsUptime']		= '0';
  345 | $ws['latitude']		= (string)$davis->latitude;                             //<latitude>50.8952</latitude>';
  346 | $ws['longitude']	= (string)$davis->longitude;                            //<longitude>4.6974</longitude>';
  347 | $ws['location']	        = (string)$davis->location;                             //<location>Wilsele, Vlaams Brabant, Belgium</location>';
  348 | # -------------------------------------- trends ------------------------
  349 | # -------------------------------------- soil moisture -----------------------------------
  350 | if ($SITE['soilUsed'] && $SITE['soilCount']*1.0 > 0) {
  351 |         $from	        = 'F';
  352 |         $i 		= 1;
  353 |  # Soil sensor 1 actual value
  354 |         if (isset ($xml -> temp_soil_1) )       { $string = (string) $xml -> temp_soil_1;}
  355 |         elseif (isset ($davis -> temp_soil_1) ) { $string = (string) $davis -> temp_soil_1;}
  356 |         else                                    { $string = (string) $xml -> temp_soil_1_day_high;}   
  357 |         $ws['soilTempAct'][$i]		= wsConvertTemperature($string, 	$from);
  358 |  # Soil sensor 1 max/min values and time
  359 |         $ws['soilTempMaxToday'][$i]	= wsConvertTemperature($xml -> temp_soil_1_day_high, 	$from);
  360 |         $ws['soilTempMaxMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_1_month_high, 	$from);
  361 |         $ws['soilTempMaxYear'][$i]	= wsConvertTemperature($xml -> temp_soil_1_year_high, 	$from);
  362 |         $ws['soilTempMaxTodayTime'][$i]	= wdDate((string)$xml->temp_soil_1_day_high_time);
  363 | 
  364 |         $ws['soilTempMinToday'][$i]	= wsConvertTemperature($xml -> temp_soil_1_day_low, 	$from);
  365 |         $ws['soilTempMinMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_1_month_low, 	$from);
  366 |         $ws['soilTempMinYear'][$i]	= wsConvertTemperature($xml -> temp_soil_1_year_low, 	$from);
  367 |         $ws['soilTempMinTodayTime'][$i]	= wdDate((string)$xml->temp_soil_1_day_low_time);     
  368 | # Moisture sensor 1 actual value
  369 |         if (isset ($xml -> soil_moisture_1) )           { $string = (string) $xml -> soil_moisture_1;}
  370 |         elseif (isset ($davis -> soil_moisture_1) )     { $string = (string) $davis -> soil_moisture_1;}
  371 |         else                                            { $string = (string) $xml -> soil_moisture_1_day_high;}   
  372 |         $ws['moistAct'][$i]		= $string;
  373 |  # Moisture sensor 1 max/min values and time
  374 |         $ws['moistMaxToday'][$i]	= (string) $xml -> soil_moisture_1_day_high;
  375 |         $ws['moistMaxMonth'][$i]	= (string) $xml -> soil_moisture_1_month_high;
  376 |         $ws['moistMaxYear'][$i]		= (string) $xml -> soil_moisture_1_year_high;
  377 |         $ws['moistMaxTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_1_day_high_time);
  378 | 
  379 |         $ws['moistMinToday'][$i]	= (string) $xml -> soil_moisture_1_day_low;
  380 |         $ws['moistMinMonth'][$i]	= (string) $xml -> soil_moisture_1_month_low;
  381 |         $ws['moistMinYear'][$i]		= (string) $xml -> soil_moisture_1_year_low;
  382 |         $ws['moistMinTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_1_day_low_time);
  383 | }       
  384 | if ($SITE['soilUsed'] && $SITE['soilCount']*1.0 > 1) {
  385 |         $i 		= 2;
  386 | # Soil sensor 1 actual value
  387 |         if (isset ($xml -> temp_soil_2) )       { $string = (string) $xml -> temp_soil_2;}
  388 |         elseif (isset ($davis -> temp_soil_2) ) { $string = (string) $davis -> temp_soil_2;}
  389 |         else                                    { $string = (string) $xml -> temp_soil_2_day_high;}   
  390 |         $ws['soilTempAct'][$i]		= wsConvertTemperature($string, 	$from);
  391 | # Soil sensor 1 max/min values and times
  392 |         $ws['soilTempMaxToday'][$i]	= wsConvertTemperature($xml -> temp_soil_2_day_high, 	$from);
  393 |         $ws['soilTempMaxMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_2_month_high, 	$from);
  394 |         $ws['soilTempMaxYear'][$i]	= wsConvertTemperature($xml -> temp_soil_2_year_high, 	$from);
  395 |         $ws['soilTempMaxTodayTime'][$i]	= wdDate((string)$xml->temp_soil_2_day_high_time);
  396 | 
  397 |         $ws['soilTempMinToday'][$i]	= wsConvertTemperature($xml -> temp_soil_2_day_low, 	$from);
  398 |         $ws['soilTempMinMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_2_month_low, 	$from);
  399 |         $ws['soilTempMinYear'][$i]	= wsConvertTemperature($xml -> temp_soil_2_year_low, 	$from);
  400 |         $ws['soilTempMinTodayTime'][$i]	= wdDate((string)$xml->temp_soil_2_day_low_time);
  401 | 
  402 | # Moisture sensor 2 actual value
  403 |         if (isset ($xml -> soil_moisture_2) )           { $string = (string) $xml -> soil_moisture_2;}
  404 |         elseif (isset ($davis ->  soil_moisture_2) )    { $string = (string) $davis -> soil_moisture_2;}
  405 |         else                                            { $string = (string) $xml -> soil_moisture_2_day_high;}   
  406 |         $ws['moistAct'][$i]		= $string;
  407 | # Moisture sensor 2 max values for today month and year alltime
  408 |         $ws['moistMaxToday'][$i]	= (string) $xml -> soil_moisture_2_day_high;
  409 |         $ws['moistMaxMonth'][$i]	= (string) $xml -> soil_moisture_2_month_high;
  410 |         $ws['moistMaxYear'][$i]		= (string) $xml -> soil_moisture_2_year_high;
  411 |         $ws['moistMaxTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_2_day_high_time);
  412 | 
  413 |         $ws['moistMinToday'][$i]	= (string) $xml -> soil_moisture_2_day_low;
  414 |         $ws['moistMinMonth'][$i]	= (string) $xml -> soil_moisture_2_month_low;
  415 |         $ws['moistMinYear'][$i]		= (string) $xml -> soil_moisture_2_year_low;
  416 |         $ws['moistMinTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_2_day_low_time);
  417 | }
  418 | if ($SITE['soilUsed'] && $SITE['soilCount']*1.0 > 2) {
  419 |         $i 		= 3;
  420 | # Soil sensor 1 actual value
  421 |         if (isset ($xml -> temp_soil_3) )       { $string = (string) $xml -> temp_soil_3;}
  422 |         elseif (isset ($davis -> temp_soil_3) ) { $string = (string) $davis -> temp_soil_3;}
  423 |         else                                    { $string = (string) $xml -> temp_soil_3_day_high;}   
  424 |         $ws['soilTempAct'][$i]		= wsConvertTemperature($string, 	$from);
  425 | # Soil sensor 1 max/min values and times
  426 |         $ws['soilTempMaxToday'][$i]	= wsConvertTemperature($xml -> temp_soil_3_day_high, 	$from);
  427 |         $ws['soilTempMaxMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_3_month_high, 	$from);
  428 |         $ws['soilTempMaxYear'][$i]	= wsConvertTemperature($xml -> temp_soil_3_year_high, 	$from);
  429 |         $ws['soilTempMaxTodayTime'][$i]	= wdDate((string)$xml->temp_soil_3_day_high_time);
  430 | 
  431 |         $ws['soilTempMinToday'][$i]	= wsConvertTemperature($xml -> temp_soil_3_day_low, 	$from);
  432 |         $ws['soilTempMinMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_3_month_low, 	$from);
  433 |         $ws['soilTempMinYear'][$i]	= wsConvertTemperature($xml -> temp_soil_3_year_low, 	$from);
  434 |         $ws['soilTempMinTodayTime'][$i]	= wdDate((string)$xml->temp_soil_3_day_low_time);
  435 | 
  436 | # Moisture sensor 2 actual value
  437 |         if (isset ($xml -> soil_moisture_3) )           { $string = (string) $xml -> soil_moisture_3;}
  438 |         elseif (isset ($davis ->  soil_moisture_3) )    { $string = (string) $davis -> soil_moisture_3;}
  439 |         else                                            { $string = (string) $xml -> soil_moisture_3_day_high;}   
  440 |         $ws['moistAct'][$i]		= $string;
  441 | # Moisture sensor 2 max values for today month and year alltime
  442 |         $ws['moistMaxToday'][$i]	= (string) $xml -> soil_moisture_3_day_high;
  443 |         $ws['moistMaxMonth'][$i]	= (string) $xml -> soil_moisture_3_month_high;
  444 |         $ws['moistMaxYear'][$i]		= (string) $xml -> soil_moisture_3_year_high;
  445 |         $ws['moistMaxTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_3_day_high_time);
  446 | 
  447 |         $ws['moistMinToday'][$i]	= (string) $xml -> soil_moisture_3_day_low;
  448 |         $ws['moistMinMonth'][$i]	= (string) $xml -> soil_moisture_3_month_low;
  449 |         $ws['moistMinYear'][$i]		= (string) $xml -> soil_moisture_3_year_low;
  450 |         $ws['moistMinTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_3_day_low_time);
  451 | }
  452 | if ($SITE['soilUsed'] && $SITE['soilCount']*1.0 > 3) {
  453 |         $i 		= 4;
  454 | # Soil sensor 1 actual value
  455 |         if (isset ($xml -> temp_soil_4) )       { $string = (string) $xml -> temp_soil_4;}
  456 |         elseif (isset ($davis -> temp_soil_4) ) { $string = (string) $davis -> temp_soil_4;}
  457 |         else                                    { $string = (string) $xml -> temp_soil_4_day_high;}   
  458 |         $ws['soilTempAct'][$i]		= wsConvertTemperature($string, 	$from);
  459 | # Soil sensor 1 max/min values and times
  460 |         $ws['soilTempMaxToday'][$i]	= wsConvertTemperature($xml -> temp_soil_4_day_high, 	$from);
  461 |         $ws['soilTempMaxMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_4_month_high, 	$from);
  462 |         $ws['soilTempMaxYear'][$i]	= wsConvertTemperature($xml -> temp_soil_4_year_high, 	$from);
  463 |         $ws['soilTempMaxTodayTime'][$i]	= wdDate((string)$xml->temp_soil_4_day_high_time);
  464 | 
  465 |         $ws['soilTempMinToday'][$i]	= wsConvertTemperature($xml -> temp_soil_4_day_low, 	$from);
  466 |         $ws['soilTempMinMonth'][$i]	= wsConvertTemperature($xml -> temp_soil_4_month_low, 	$from);
  467 |         $ws['soilTempMinYear'][$i]	= wsConvertTemperature($xml -> temp_soil_4_year_low, 	$from);
  468 |         $ws['soilTempMinTodayTime'][$i]	= wdDate((string)$xml->temp_soil_4_day_low_time);
  469 | 
  470 | # Moisture sensor 2 actual value
  471 |         if (isset ($xml -> soil_moisture_4) )           { $string = (string) $xml -> soil_moisture_4;}
  472 |         elseif (isset ($davis ->  soil_moisture_4) )    { $string = (string) $davis -> soil_moisture_4;}
  473 |         else                                            { $string = (string) $xml -> soil_moisture_4_day_high;}   
  474 |         $ws['moistAct'][$i]		= $string;
  475 | # Moisture sensor 2 max values for today month and year alltime
  476 |         $ws['moistMaxToday'][$i]	= (string) $xml -> soil_moisture_4_day_high;
  477 |         $ws['moistMaxMonth'][$i]	= (string) $xml -> soil_moisture_4_month_high;
  478 |         $ws['moistMaxYear'][$i]		= (string) $xml -> soil_moisture_4_year_high;
  479 |         $ws['moistMaxTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_4_day_high_time);
  480 | 
  481 |         $ws['moistMinToday'][$i]	= (string) $xml -> soil_moisture_4_day_low;
  482 |         $ws['moistMinMonth'][$i]	= (string) $xml -> soil_moisture_4_month_low;
  483 |         $ws['moistMinYear'][$i]		= (string) $xml -> soil_moisture_4_year_low;
  484 |         $ws['moistMinTodayTime'][$i]	= wdDate((string)$xml->soil_moisture_4_day_low_time);
  485 | }
  486 | if ($SITE['leafUsed'] && $SITE['leafCount']*1.0 > 0)  {
  487 | # leaf sensor 1
  488 |         $n = 1;
  489 |         if (isset ($xml -> temp_leaf_1) )       { $string = (string) $xml -> temp_leaf_1;}
  490 |         elseif (isset ($davis -> temp_leaf_1) ) { $string = (string) $davis -> temp_leaf_1;}
  491 |         else                                    { $string = (string) $xml -> temp_leaf_1_day_high;}   
  492 |         $ws['leafTempAct'][$n]	        = $string;
  493 | 
  494 |         if (isset ($xml -> leaf_wetness_1) )            { $string = (string) $xml -> leaf_wetness_1;}
  495 |         elseif (isset ($davis -> leaf_wetness_1) )      { $string = (string) $davis -> leaf_wetness_1;}
  496 |         else                                            { $string = (string) $xml -> leaf_wetness_1_day_high;}   
  497 |         $ws['leafWetAct'][$n]		= $string;
  498 |         $ws['leafWetMaxToday'][$n]	= (string) $xml -> leaf_wetness_1_day_high;
  499 |         $ws['leafWetMaxMonth'][$n]	= (string) $xml -> leaf_wetness_1_month_high;
  500 |         $ws['leafWetMaxYear'][$n]	= (string) $xml -> leaf_wetness_1_year_high;
  501 |         $ws['leafWetMaxTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_1_day_high_time);
  502 | 
  503 |         $ws['leafWetMinToday'][$n]	= (string) $xml -> leaf_wetness_1_day_low;
  504 |         $ws['leafWetMinMonth'][$n]	= (string) $xml -> leaf_wetness_1_month_low;
  505 |         $ws['leafWetMinYear'][$n]	= (string) $xml -> leaf_wetness_1_year_low;
  506 |         $ws['leafWetMinTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_1_day_low_time);
  507 | }
  508 | if ($SITE['leafUsed'] && $SITE['leafCount']*1.0 > 1) {
  509 | # leaf sensor 2
  510 |         $n = 2;
  511 |         if (isset ($xml -> temp_leaf_2) )       { $string = (string) $xml -> temp_leaf_2;}
  512 |         elseif (isset ($davis -> temp_leaf_2) ) { $string = (string) $davis -> temp_leaf_2;}
  513 |         else                                    { $string = (string) $xml -> temp_leaf_2_day_high;}   
  514 |         $ws['leafTempAct'][$n]	        = $string;
  515 | 
  516 |         if (isset ($xml -> leaf_wetness_2) )            { $string = (string) $xml -> leaf_wetness_2;}
  517 |         elseif (isset ($davis -> leaf_wetness_2) )      { $string = (string) $davis -> leaf_wetness_2;}
  518 |         else                                            { $string = (string) $xml -> leaf_wetness_2_day_high;}   
  519 |         $ws['leafWetAct'][$n]		= $string;
  520 |         $ws['leafWetMaxToday'][$n]	= (string) $xml -> leaf_wetness_2_day_high;
  521 |         $ws['leafWetMaxMonth'][$n]	= (string) $xml -> leaf_wetness_2_month_high;
  522 |         $ws['leafWetMaxYear'][$n]	= (string) $xml -> leaf_wetness_2_year_high;
  523 |         $ws['leafWetMaxTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_2_day_high_time);
  524 | 
  525 |         $ws['leafWetMinToday'][$n]	= (string) $xml -> leaf_wetness_2_day_low;
  526 |         $ws['leafWetMinMonth'][$n]	= (string) $xml -> leaf_wetness_2_month_low;
  527 |         $ws['leafWetMinYear'][$n]	= (string) $xml -> leaf_wetness_2_year_low;
  528 |         $ws['leafWetMinTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_2_day_low_time);
  529 | }
  530 | if ($SITE['leafUsed'] && $SITE['leafCount']*1.0 > 2) {
  531 | # leaf sensor 3
  532 |         $n = 3;
  533 |         if (isset ($xml -> temp_leaf_3) )       { $string = (string) $xml -> temp_leaf_3;}
  534 |         elseif (isset ($davis -> temp_leaf_3) ) { $string = (string) $davis -> temp_leaf_3;}
  535 |         else                                    { $string = (string) $xml -> temp_leaf_3_day_high;}   
  536 |         $ws['leafTempAct'][$n]	        = $string;
  537 | 
  538 |         if (isset ($xml -> leaf_wetness_3) )            { $string = (string) $xml -> leaf_wetness_3;}
  539 |         elseif (isset ($davis -> leaf_wetness_3) )      { $string = (string) $davis -> leaf_wetness_3;}
  540 |         else                                            { $string = (string) $xml -> leaf_wetness_3_day_high;}   
  541 |         $ws['leafWetAct'][$n]		= $string;
  542 |         $ws['leafWetMaxToday'][$n]	= (string) $xml -> leaf_wetness_3_day_high;
  543 |         $ws['leafWetMaxMonth'][$n]	= (string) $xml -> leaf_wetness_3_month_high;
  544 |         $ws['leafWetMaxYear'][$n]	= (string) $xml -> leaf_wetness_3_year_high;
  545 |         $ws['leafWetMaxTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_3_day_high_time);
  546 | 
  547 |         $ws['leafWetMinToday'][$n]	= (string) $xml -> leaf_wetness_3_day_low;
  548 |         $ws['leafWetMinMonth'][$n]	= (string) $xml -> leaf_wetness_3_month_low;
  549 |         $ws['leafWetMinYear'][$n]	= (string) $xml -> leaf_wetness_3_year_low;
  550 |         $ws['leafWetMinTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_3_day_low_time);
  551 | }
  552 | if ($SITE['leafUsed'] && $SITE['leafCount']*1.0 > 3) {
  553 | # leaf sensor 4
  554 |         $n = 4;
  555 |         if (isset ($xml -> temp_leaf_4) )       { $string = (string) $xml -> temp_leaf_4;}
  556 |         elseif (isset ($davis -> temp_leaf_4) ) { $string = (string) $davis -> temp_leaf_4;}
  557 |         else                                    { $string = (string) $xml -> temp_leaf_4_day_high;}   
  558 |         $ws['leafTempAct'][$n]	        = $string;
  559 | 
  560 |         if (isset ($xml -> leaf_wetness_4) )            { $string = (string) $xml -> leaf_wetness_4;}
  561 |         elseif (isset ($davis -> leaf_wetness_4) )      { $string = (string) $davis -> leaf_wetness_4;}
  562 |         else                                            { $string = (string) $xml -> leaf_wetness_4_day_high;}   
  563 |         $ws['leafWetAct'][$n]		= $string;
  564 |         $ws['leafWetMaxToday'][$n]	= (string) $xml -> leaf_wetness_4_day_high;
  565 |         $ws['leafWetMaxMonth'][$n]	= (string) $xml -> leaf_wetness_4_month_high;
  566 |         $ws['leafWetMaxYear'][$n]	= (string) $xml -> leaf_wetness_4_year_high;
  567 |         $ws['leafWetMaxTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_4_day_high_time);
  568 | 
  569 |         $ws['leafWetMinToday'][$n]	= (string) $xml -> leaf_wetness_4_day_low;
  570 |         $ws['leafWetMinMonth'][$n]	= (string) $xml -> leaf_wetness_4_month_low;
  571 |         $ws['leafWetMinYear'][$n]	= (string) $xml -> leaf_wetness_4_year_low;
  572 |         $ws['leafWetMinTodayTime'][$n]	= wdDate((string)$xml->leaf_wetness_4_day_low_time);
  573 | }
  574 | #echo '<pre>'.PHP_EOL; print_r ($ws);  exit;
  575 | #---------------------------------------------------------------------------
  576 | # retrieve missing moon entries
  577 | $skipMoonPage = true; include ($SITE['moonSet']); $skipMoonPage = false;
  578 | #
  579 | $ws['check_ok']         = '0.00';
  580 | #
  581 | $ws['tempMinYday'] = $ws['tempMaxYday'] = $ws['dewpMinYday'] = $ws['dewpMaxYday'] = $ws['chilMinYday'] = $ws['heatMaxYday'] = '';
  582 | $ws['baroMinYday'] = $ws['baroMaxYday'] = '';
  583 | $ws['rainRateYday']= $ws['rainYday']    = $ws['etYday']      = '';
  584 | $ws['gustMaxYday'] = '';
  585 | $ws['humiMinYday'] = $ws['humiMaxYday'] = '';
  586 | $ws['uvMaxYday']   = $ws['solarMaxYday']= '';
  587 | 
  588 | $ws['tempMinYdayTime']  = $ws['tempMaxYdayTime'] = $ws['dewpMinYdayTime']  = $ws['dewpMaxYdayTime']  = ''; 
  589 | $ws['chilMinYdayTime']  = $ws['heatMaxYdayTime'] = $ws['baroMinYdayTime']  = $ws['baroMaxYdayTime']  = ''; 
  590 | $ws['humiMinYdayTime']  = $ws['humiMaxYdayTime'] = $ws['gustMaxYdayTime']  = ''; 
  591 | $ws['uvMaxYdayTime']    = $ws['solarMaxYdayTime']= ''; 
  592 | #
  593 | if (!isset ($SITE['ydayTags']) || trim($SITE['ydayTags']) == '') {
  594 |         echo $startEcho.$tagsWLCOM.": no yesterday values present - generating placeholders ".$endEcho.PHP_EOL;
  595 | } 
  596 | else {  echo $startEcho.$tagsWLCOM.": yesterday values loaded from ".$SITE['ydayTags'].$endEcho.PHP_EOL;
  597 |         $arr    = file($SITE['ydayTags'],FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  598 |         $end    = count ($arr);
  599 |         for ($n = 0; $n < $end; $n++) {
  600 |                 $line   = trim ($arr[$n]);
  601 |                 if ($line  == '' ) {continue;}
  602 |                 $substr = substr($line,1,5);
  603 |                 if ($substr  == '-----')  {continue;}
  604 |                 if (substr($line,0,1) <> '|') {continue;}
  605 |                 list ($skip,$name, $content) = explode ('|',$line.'|');
  606 |                 $name   = trim($name);
  607 |                 $content= trim($content);
  608 |                 if ($content  == '' ) {
  609 |                         echo $startEcho.$tagsWLCOM.'('.__LINE__.'):empty line '.$n.' name '.$name .$endEcho.PHP_EOL; continue;}
  610 |                 $wx[$name]=$content;
  611 |         }
  612 |         $ws['tags_yday']	.= ' - '.$wx['pagenameYday'].' - '.$wx['versionYday'];
  613 |         $ws['tags_yday_time']	=                        $wx['datetimeYday'];
  614 |         $fromYday               =                        $wx['fromtempYday'];
  615 |         $ws['tempMinYday']      = wsConvertTemperature  ($wx['tempMinYday'],$fromYday);
  616 |         $ws['tempMinYdayTime']  =                        $wx['tempMinYdayTime'];   
  617 |         $ws['tempMaxYday']      = wsConvertTemperature  ($wx['tempMaxYday'],$fromYday);
  618 |         $ws['tempMaxYdayTime']  =                        $wx['tempMaxYdayTime'];
  619 |         $ws['dewpMinYday']      = wsConvertTemperature  ($wx['dewpMinYday'],$fromYday);
  620 |         $ws['dewpMinYdayTime']  =                        $wx['dewpMinYdayTime'];   
  621 |         $ws['dewpMaxYday']      = wsConvertTemperature  ($wx['dewpMaxYday'],$fromYday);
  622 |         $ws['dewpMaxYdayTime']  =                        $wx['dewpMaxYdayTime'];
  623 |         $ws['chilMinYday']      = wsConvertTemperature  ($wx['chilMinYday'],$fromYday);
  624 |         $ws['chilMinYdayTime']  =                        $wx['chilMinYdayTime'];
  625 |         $ws['heatMaxYday']      = wsConvertTemperature  ($wx['heatMaxYday'],$fromYday);
  626 |         $ws['heatMaxYdayTime']  =                        $wx['heatMaxYdayTime'];
  627 | 
  628 |         $fromYday               = $wx['frombaroYday'];
  629 |         $ws['baroMinYday']      = wsConvertBaro         ($wx['baroMinYday'],$fromYday);
  630 |         $ws['baroMinYdayTime']  =                        $wx['baroMinYdayTime'];
  631 |         $ws['baroMaxYday']      = wsConvertBaro         ($wx['baroMaxYday'],$fromYday);
  632 |         $ws['baroMaxYdayTime']  =                        $wx['baroMaxYdayTime'];
  633 |        
  634 |         $ws['humiMinYday']      =                        $wx['humiMinYday'];
  635 |         $ws['humiMinYdayTime']  =                        $wx['humiMinYdayTime'];
  636 |         $ws['humiMaxYday']      =                        $wx['humiMaxYday'];
  637 |         $ws['humiMaxYdayTime']  =                        $wx['humiMaxYdayTime'];
  638 |        
  639 |         $fromYday               = $wx['fromrainYday'];
  640 |         $ws['rainRateYday']     = wsConvertRainfall     ($wx['rainRateYday'],$fromYday);
  641 |         $ws['rainYday']         = wsConvertRainfall     ($wx['rainYday'],$fromYday);
  642 |         $ws['etYday']           = wsConvertRainfall     ($wx['etYday'],$fromYday);
  643 |         $fromYday               = $wx['fromwindYday'];
  644 |         $ws['gustMaxYday']      = wsConvertWindspeed    ($wx['gustMaxYday'],$fromYday);
  645 |         $ws['gustMaxYdayTime']  =                        $wx['gustMaxYdayTime'];
  646 |         
  647 |         $ws['uvMaxYday']        =                        $wx['uvMaxYday'];
  648 |         $ws['uvMaxYdayTime']    =                        $wx['uvMaxYdayTime'];
  649 |         $ws['solarMaxYday']     =                        $wx['solarMaxYday'];
  650 |         $ws['solarMaxYdayTime'] =                        $wx['solarMaxYdayTime'];
  651 |         
  652 |         $fromYday               = $wx['fromtempYday'];        
  653 |         if (isset ($SITE['soilUsed']) && $SITE['soilUsed'] && $SITE['soilCount']*1.0 > 0) {
  654 |                 $soils           = round($SITE['soilCount']);}
  655 |         else {  $soils           = 0; $leafs = 0; $SITE['leafCount'] = 0;}
  656 |         if ($soils > 4) {echo '<!-- reset nr of soil sensors from '.$SITE['soilCount'].' to max 4 -->'.PHP_EOL;$soils  = 4;}
  657 |         for  ($n = 1; $n <= $soils; $n++) {
  658 |                 $ws['soilTempMaxYday'][$n]      = wsConvertTemperature  ($wx['soilTempMaxYday_'.$n],$fromYday);
  659 |                 $ws['soilTempMaxYdayTime'][$n]  =                        $wx['soilTempMaxYdayTime_'.$n];
  660 |                 $ws['soilTempMinYday'][$n]      = wsConvertTemperature  ($wx['soilTempMinYday_'.$n],$fromYday);
  661 |                 $ws['soilTempMinYdayTime'][$n]  =                        $wx['soilTempMinYdayTime_'.$n];
  662 |                 $ws['moistMaxYday'][$n]         = $wx['moistMaxYday_'.$n];
  663 |                 $ws['moistMaxYdayTime'][$n]     = $wx['moistMaxYdayTime_'.$n];
  664 |                 $ws['moistMinYday'][$n]         = $wx['moistMinYday_'.$n];
  665 |                 $ws['moistMinYdayTime'][$n]     = $wx['moistMinYdayTime_'.$n];
  666 |         }
  667 |         $leafs = round($SITE['leafCount']);
  668 |         if ($leafs > 4) { echo '<!-- reset nr of leaf sensors from '.$SITE['leafCount'].' to max 4 -->'.PHP_EOL;$leafs  = 4;}        
  669 |         for  ($n = 1; $n <= $leafs; $n++) {
  670 |                 $ws['leafWetMaxYday'][$n]       = $wx['leafWetMaxYday_'.$n];
  671 |                 $ws['leafWetMaxYdayTime'][$n]   = $wx['leafWetMaxYdayTime_'.$n];
  672 |                 $ws['leafWetMinYday'][$n]       = $wx['leafWetMinYday_'.$n];
  673 |                 $ws['leafWetMinYdayTime'][$n]   = $wx['leafWetMinYdayTime_'.$n];
  674 |         }
  675 | }
  676 | #
  677 | #echo '<pre>'; print_r ($ws); exit;
  678 | if (!file_put_contents($cachefileWLC, serialize($ws))){   
  679 |         echo $startEcho.$tagsWLCOM.": <br />Could not save (".$cachefileWLC.") to cache. Please make sure your cache directory exists and is writable.".$endEcho.PHP_EOL;
  680 | } else {
  681 |         echo $startEcho.$tagsWLCOM.": $cachefileWLC saved to cache".$endEcho.PHP_EOL;
  682 | }
  683 | // end of tagsWLCOM.php
  684 | #echo '<pre>'.PHP_EOL; print_r ($ws);  exit;

uploadDW/tagsydayWLCOM.txt - dated: 18-04-2024 23:55

    1 | # generated at 18-04-2024 23:55 Europe/Madrid
    2 | |versionYday|3.02 2015-04-20|!
    3 | |pagenameYday|yesterday.php|!
    4 | |fromtempYday|°C|!
    5 | |datetimeYday|20240418235503|!
    6 | |tempMinYday|8.6|!
    7 | |tempMinYdayTime|20240418052500|!
    8 | |tempMaxYday|19.1|!
    9 | |tempMaxYdayTime|20240418164100|!
   10 | |dewpMinYday|1.1|!
   11 | |dewpMinYdayTime|20240418052500|!
   12 | |dewpMaxYday|4.4|!
   13 | |dewpMaxYdayTime|20240418000000|!
   14 | |chilMinYday|5.6|!
   15 | |chilMinYdayTime|20240418063500|!
   16 | |heatMaxYday|17.2|!
   17 | 
   18 | |frombaroYday| hPa|!
   19 | |baroMinYday|1014.6|!
   20 | |baroMinYdayTime|20240418170300|!
   21 | |baroMaxYday|1021.4|!
   22 | |baroMaxYdayTime|20240418235300|!
   23 | |humiMinYday|34|!
   24 | |humiMinYdayTime|20240418155700|!
   25 | |humiMaxYday|66|!
   26 | |humiMaxYdayTime|20240418011500|!
   27 | |fromrainYday| mm|!
   28 | |rainRateYday|0|!
   29 | |rainYday|0|!
   30 | |etYday|0|!
   31 | |fromwindYday| km/h|!
   32 | |gustMaxYday|51.5|!
   33 | |gustMaxYdayTime|20240418031700|!
   34 | |uvMaxYday|--|!
   35 | |uvMaxYdayTime|20240418235503|!
   36 | |solarMaxYday|--|!
   37 | |solarMaxYdayTime|20240418235503|!
   38 | |heatMaxYdayTime|20240418162000|!

Te das cuenta de información de tiempo también en:

UK Metoffice

WeatherCloud

Weather Underground

Xert, Pla de la Font

AWEKAS

WeatherlinkIP

Citizen Weather Observer Program (CWOP)

HAMweather, WeatherForYou, PWS Weather

Equipo usamos:

Weather-station
Davis Vantage VUE

Weather-program
Davis Weatherlink.Com

Weather-server
My Computer

Proveedor
Hostinger

Davis Vantage VUE

Davis Weatherlink.Com

My Computer

Hostinger