Davis vantage forecast-rule. **solved**

This section covers the Meteobridge PRO units exclusively

Moderator: Mattk

Post Reply
36260
Senior Boarder
Senior Boarder
Posts: 47
Joined: Sun Feb 17, 2008 11:17 am
Location: Saint Pierre de Jards - France

Davis vantage forecast-rule. **solved**

Post by 36260 »

Hello,
I'm doing my second transition. NSLU --> Raspberry and now Meteobridge Nano HD. Meteohub exposes fc data (wheather icon), that seems not to be reported anymore in the live data of Meteobridge neither in templates. Instead it seems that forecast-rule replaces it. What are the values that can be taken by this variable and their meaning? Is there a way to get fc?
Thank you

User avatar
wvdkuil
Platinum Boarder
Platinum Boarder
Posts: 458
Joined: Sun Jul 24, 2011 8:00 pm
Location: Belgium
Contact:

Re: Davis vantage forecast-rule

Post by wvdkuil »

36260 wrote:
Wed May 20, 2020 11:56 am
Hello,
I'm doing my second transition. NSLU --> Raspberry and now Meteobridge Nano HD. Meteohub exposes fc data (wheather icon), that seems not to be reported anymore in the live data of Meteobridge neither in templates. Instead it seems that forecast-rule replaces it. What are the values that can be taken by this variable and their meaning? Is there a way to get fc?
Thank you
A list of rule# -> fc-text can be found here:
https://www.wxforum.net/index.php?topic ... 4#msg15424

The Meteobridge can also supply the corresponding text im multiple languages
https://www.meteobridge.com/wiki/index.php/Templates -> Forecast Variables

There are scripts who use the rule# to translate to an icon, I could not find one yet.

There are some scripts which translate the rule-text to an icon, this is an example as used in the console scripts.

Code: Select all

# ------------------------------------------------------------------------------
# Determine forecast icon from Davis forecast string $vpforecast_en
# ------------------------------------------------------------------------------
#
function c_get_fcsticon($vpforecast_en) {
	$DC_fcsttmp = "DC_{$vpforecast_en}";  // Station forecast string
	$DC_fcsttmp = strtolower ($DC_fcsttmp);
	
# ------------------------------------------------------------------------------
# WARNING              DO NOT CHANGE ANY OF THESE STRING TESTS !!!
#                      TESTS and ORDER CRITICAL !!!
# ------------------------------------------------------------------------------
	if     (preg_match('/mostly clear/i',                       		$DC_fcsttmp) ) {$fcsticon = "mclr.png";}     
	elseif (preg_match('/increasing clouds and warmer/i',        		$DC_fcsttmp) ||   
		preg_match('/warmer. precipitation possible within 24/i', 	$DC_fcsttmp) ||  
		preg_match('/increasing clouds with/i',              		$DC_fcsttmp) ||
		preg_match('/partly cloudy/i',                       		$DC_fcsttmp) )  {$fcsticon = "pcld.png";} 
	elseif (preg_match('/cooler. precipitation possible within 12/i', 	$DC_fcsttmp) ||
		preg_match('/cooler. precipitation likely. windy/i', 		$DC_fcsttmp) )  {$fcsticon = "rain.png";} 
	elseif (preg_match('/precipitation ending within 6/i',       		$DC_fcsttmp) ||  
		preg_match('/clearing, cooler and windy/i',          		$DC_fcsttmp) ||
		preg_match('/mostly cloudy and cooler/i',            		$DC_fcsttmp) ||
		preg_match('/mostly cloudy with/i',                 		$DC_fcsttmp) ||
		preg_match('/change. possible wind shift/i',         		$DC_fcsttmp) ||
		preg_match('/likely/i',                              		$DC_fcsttmp) ||
		preg_match('/change. precipitation possible within 24/i', 	$DC_fcsttmp) ||
		preg_match('/precipitation likely possibly/i',       		$DC_fcsttmp) ||
		preg_match('/precipitation possible within 24/i',    		$DC_fcsttmp) ||
		preg_match('/precipitation possible within 48/i',    		$DC_fcsttmp) )  {$fcsticon = "mcld.png";} 
	elseif (preg_match('/precipitation continuing/i',       $DC_fcsttmp) ||
		preg_match('/windy within 6/i',                 $DC_fcsttmp) ||
		preg_match('/possible within 12/i',             $DC_fcsttmp) ||
		preg_match('/possible within 6/i',              $DC_fcsttmp) ||
		preg_match('/ending in/i',                      $DC_fcsttmp) ||
		preg_match('/ending within 12/i',               $DC_fcsttmp) )	{$fcsticon = "rain.png";} 
	elseif (preg_match('/partialy cloudy, Rain possible/i', $DC_fcsttmp) )  {$fcsticon = "pcldrain.png";}
	elseif (preg_match('/mostly cloudy, Rain possible/i',   $DC_fcsttmp) )	{$fcsticon = "mcldrain.png";} 
	elseif (preg_match('/partialy cloudy, Snow/i',          $DC_fcsttmp) )	{$fcsticon = "pcldsnow.png";} 
	elseif (preg_match('/mostly cloudy, Snow/i',            $DC_fcsttmp) )	{$fcsticon = "mcldsnow.png";} 
	elseif (preg_match('/rain and/i',                       $DC_fcsttmp) )	{$fcsticon = "rainsnow.png";} 
	elseif (preg_match('/clear/i',                          $DC_fcsttmp) ||
		preg_match('/sunny/i',                          $DC_fcsttmp) )  {$fcsticon = "mclr.png";}
	elseif (preg_match('/cloudy/i',                         $DC_fcsttmp) )  {$fcsticon = "mcld.png";}
	elseif (preg_match('/rain/i',                           $DC_fcsttmp) )  {$fcsticon = "rain.png";}
	elseif (preg_match('/snow/i',                           $DC_fcsttmp) )	{$fcsticon = "snow.png";}
	elseif (preg_match('/forecast/i',                       $DC_fcsttmp) )  {$fcsticon = "grid.png";} // FORECAST REQUIRES 3 HOURS OF RECENT DATA
	elseif (preg_match('/data will be reloaded/i',          $DC_fcsttmp) )  {$fcsticon = "grid.png";} // Data will be reloaded   
	else { $DC_fcsttmp = "$DC_fcsttmp|grid.png|\n";          					  // forecast not found !!
		 $fcsticon = "grid.png";
	}
#	echo '<!-- test  $vpforecast_en = '.$vpforecast_en.' - $DC_fcsttmp = '.$DC_fcsttmp.' -->'.PHP_EOL;
	return $fcsticon;
} // eo function  get_fcsticon
Wim
Support for Leuven-Template & Scripts at https://support.leuven-template.eu/
Support for the PWS_Dashboard (HWS-template) https://pwsdashboard.com/

36260
Senior Boarder
Senior Boarder
Posts: 47
Joined: Sun Feb 17, 2008 11:17 am
Location: Saint Pierre de Jards - France

Re: Davis vantage forecast-rule

Post by 36260 »

Thanks Wim I've got everything I need to go forward.

Post Reply