Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Davis Weather Forecast question

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
actioman
Posts: 118
Joined: Sat 20 Mar 2010 1:01 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows XP SP3
Location: Elvas, Portugal
Contact:

Davis Weather Forecast question

Post by actioman »

Hi there any chance of automatic translate Davis Weather Forecast?

Thanks! ;)
Kind Regards, Manuel.

Image
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Davis Weather Forecast question

Post by steve »

I know this question is about the Saratoga templates, but I would say that's going to be very difficult as Cumulus only supplies the text of the forecast, as that's all it has. Each forecast does have an identifier, but Cumulus doesn't have access to that. So you would have to do it by actually comparing the text. And I seem to remember that the wind directions in the text actually change depending on your location, so that makes it harder still.
Steve
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Davis Weather Forecast question

Post by mcrossley »

Perhaps on a web site you could programmatically send the text off via PHP to Google translate and let that mangle it for you?
User avatar
actioman
Posts: 118
Joined: Sat 20 Mar 2010 1:01 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows XP SP3
Location: Elvas, Portugal
Contact:

Re: Davis Weather Forecast question

Post by actioman »

Hummm... ok!

Is too much for me. I asked because I thought there would be some solution already created.
Thank you both, for your clarification! 8-)

Regards.
Kind Regards, Manuel.

Image
kapo
Posts: 246
Joined: Thu 03 Jan 2013 1:59 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Vihtavuori, Laukaa, Finland

Re: Davis Weather Forecast question

Post by kapo »

Can anybody give some advice, and tell me from where / which directory that forecast comes? I should try to translate it to finnish ... with little steps in a day / night... :?: :arrow: :roll:

-kapo-
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Davis Weather Forecast question

Post by steve »

It comes from the Davis DLL which Cumulus uses, and Cumulus puts it into a web tag. There's a list of them in this thread: https://cumulus.hosiene.co.uk/viewtopic.php?f=6&t=4140

Note that as I said above, I believe that the wind directions may not be the same as listed there, depending on where you are.
Steve
kapo
Posts: 246
Joined: Thu 03 Jan 2013 1:59 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Vihtavuori, Laukaa, Finland

Re: Davis Weather Forecast question

Post by kapo »

Thank You wery much Steve ! I`ll try to found those when I have more time.


-kapo-
User avatar
actioman
Posts: 118
Joined: Sat 20 Mar 2010 1:01 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows XP SP3
Location: Elvas, Portugal
Contact:

Re: Davis Weather Forecast question

Post by actioman »

Kapo hello!

I saw that you got already translating the weather forecasts from Davis to your website. Can you share here how. Since no one has yet had.

Thank you! ;)
Kind Regards, Manuel.

Image
kapo
Posts: 246
Joined: Thu 03 Jan 2013 1:59 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Vihtavuori, Laukaa, Finland

Re: Davis Weather Forecast question

Post by kapo »

Answered via email...

-kapo-
User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Davis Weather Forecast question

Post by saratogaWX »

I think a more generalized solution to the translation of the VP forecast is needed.

I've put together a small test program (attached) which will translate using the language-LL.txt entries.


The function is

Code: Select all

<?php
// Function to process VPforecast string and 
// translate from English if needed
//  
  function fixupVPforecast( $inCond ) {
    global $DebugMode;
	
	$Cond = trim($inCond);
	$dt = '';
	
	$vals = array();
	if(strpos($Cond,'.') !==false) {  // split into sentences for processing
		$vals = explode(".",$Cond.'.');
	}
	$scnt = count($vals);
	if($scnt < 1) { return(langtransstr($Cond)); }
	foreach ($vals as $k => $v) { // process each sentence for translation
	  $v = trim($v);
	  $vals[$k] = langtransstr($v); 
	}
	
	reset($vals);
	// remove extra null 'sentence' if needed
	if(strlen($vals[$scnt-1]) < 1) {$junk = array_pop($vals); }
	
	$t = join('. ',$vals);
	$t = trim($t);
	
    if($DebugMode) {
      $t = "<!-- fixupVPforecast in='$inCond' out='$t' scnt='$scnt' -->" . $t;
	}
    return($t);
  
  }
?>
and the language-LL.txt entries needed are

Code: Select all

langlookup|MOSTLY CLEAR AND COOLER|MOSTLY CLEAR AND COOLER|
langlookup|MOSTLY CLEAR WITH LITTLE TEMPERATURE CHANGE|MOSTLY CLEAR WITH LITTLE TEMPERATURE CHANGE|
langlookup|MOSTLY CLEAR FOR 12 HOURS WITH LITTLE TEMPERATURE CHANGE|MOSTLY CLEAR FOR 12 HOURS WITH LITTLE TEMPERATURE CHANGE|
langlookup|MOSTLY CLEAR FOR 12 TO 24 HOURS AND COOLER|MOSTLY CLEAR FOR 12 TO 24 HOURS AND COOLER|
langlookup|PARTLY CLOUDY AND COOLER|PARTLY CLOUDY AND COOLER|
langlookup|PARTLY CLOUDY WITH LITTLE TEMPERATURE CHANGE|PARTLY CLOUDY WITH LITTLE TEMPERATURE CHANGE|
langlookup|MOSTLY CLEAR AND WARMER|MOSTLY CLEAR AND WARMER|
langlookup|INCREASING CLOUDS AND WARMER|INCREASING CLOUDS AND WARMER|
langlookup|PRECIPITATION POSSIBLE WITHIN 24 TO 48 HOURS|PRECIPITATION POSSIBLE WITHIN 24 TO 48 HOURS|
langlookup|INCREASING CLOUDS WITH LITTLE TEMPERATURE CHANGE|INCREASING CLOUDS WITH LITTLE TEMPERATURE CHANGE|
langlookup|PRECIPITATION POSSIBLE WITHIN 24 HOURS|PRECIPITATION POSSIBLE WITHIN 24 HOURS|
langlookup|PRECIPITATION POSSIBLE WITHIN 12 HOURS|PRECIPITATION POSSIBLE WITHIN 12 HOURS|
langlookup|INCREASING WINDS|INCREASING WINDS|
langlookup|PRECIPITATION POSSIBLE WITHIN 48 HOURS|PRECIPITATION POSSIBLE WITHIN 48 HOURS|
langlookup|PRECIPITATION POSSIBLE WITHIN 12 TO 24 HOURS|PRECIPITATION POSSIBLE WITHIN 12 TO 24 HOURS|
langlookup|WINDY|WINDY|
langlookup|PRECIPITATION POSSIBLE WITHIN 6 TO 12 HOURS|PRECIPITATION POSSIBLE WITHIN 6 TO 12 HOURS|
langlookup|PRECIPITATION LIKLEY|PRECIPITATION LIKLEY|
langlookup|CLEARING AND COOLER|CLEARING AND COOLER|
langlookup|PRECIPITATION ENDING WITHIN 6 HOURS|PRECIPITATION ENDING WITHIN 6 HOURS|
langlookup|MOSTLY CLOUDY AND COOLER|MOSTLY CLOUDY AND COOLER|
langlookup|PRECIPITATION CONTINUING|PRECIPITATION CONTINUING|
langlookup|PRECIPITATION LIKELY|PRECIPITATION LIKELY|
langlookup|MOSTLY CLOUDY WITH LITTLE TEMPERATURE CHANGE|MOSTLY CLOUDY WITH LITTLE TEMPERATURE CHANGE|
langlookup|INCREASING CLOUDS AND COOLER|INCREASING CLOUDS AND COOLER|
langlookup|PRECIPITATION POSSIBLE AND WINDY WITHIN 6 HOURS|PRECIPITATION POSSIBLE AND WINDY WITHIN 6 HOURS|
langlookup|PRECIPITATION POSSIBLE WITHIN 12 TO 24 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|PRECIPITATION POSSIBLE WITHIN 12 TO 24 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|PRECIPITATION POSSIBLE WITHIN 6 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|PRECIPITATION POSSIBLE WITHIN 6 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|PRECIPITATION ENDING WITHIN 12 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|PRECIPITATION ENDING WITHIN 12 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|POSSIBLE WIND SHIFT TO THE W, NW, OR N|POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|PRECIPITATION POSSIBLE WITHIN 24 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|PRECIPITATION POSSIBLE WITHIN 24 HOURS POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|CLEARING, COOLER AND WINDY|CLEARING, COOLER AND WINDY|
langlookup|WINDY WITH POSSIBLE WIND SHIFT TO THE W, NW, OR N|WINDY WITH POSSIBLE WIND SHIFT TO THE W, NW, OR N|
langlookup|PRECIPITATION POSSIBLE WITHIN 12 HOURS, POSSIBLY HEAVY AT TIMES|PRECIPITATION POSSIBLE WITHIN 12 HOURS, POSSIBLY HEAVY AT TIMES|
langlookup|PRECIPITATION ENDING IN 12 TO 24 HOURS|PRECIPITATION ENDING IN 12 TO 24 HOURS|
langlookup|PRECIPITATION CONTINUING, POSSIBLE HEAVY AT TIMES|PRECIPITATION CONTINUING, POSSIBLE HEAVY AT TIMES|
langlookup|PRECIPITATION CONTINUING, POSSIBLY HEAVY AT TIMES|PRECIPITATION CONTINUING, POSSIBLY HEAVY AT TIMES|
langlookup|PRECIPITATION LIKELY, POSSIBLY HEAVY AT TIMES|PRECIPITATION LIKELY, POSSIBLY HEAVY AT TIMES|
langlookup|PRECIPITATION POSSIBLE WITHIN 6 HOURS|PRECIPITATION POSSIBLE WITHIN 6 HOURS|
langlookup|PRECIPITATION POSSIBLY HEAVY AT TIMES AND ENDING WITHIN 12 HOURS|PRECIPITATION POSSIBLY HEAVY AT TIMES AND ENDING WITHIN 12 HOURS|
langlookup|PRECIPITATION POSSIBLE WITHIN 6 TO 12 HOURS, POSSIBLY HEAVY AT TIMES|PRECIPITATION POSSIBLE WITHIN 6 TO 12 HOURS, POSSIBLY HEAVY AT TIMES|
langlookup|PRECIPITATION ENDING WITHIN 12 HOURS|PRECIPITATION ENDING WITHIN 12 HOURS|
langlookup|FORECAST REQUIRES 3 HOURS OF RECENT DATA|FORECAST REQUIRES 3 HOURS OF RECENT DATA|
Use it in the dashboard to replace

Code: Select all

		      print '		   	   <b>Davis VP+ ' . langtransstr('forecast') . ':</b> <span style="color: green; font-size:9pt">' . ucfirst($vpforecasttext) . "</span>"; 
with

Code: Select all

		      print '		   	   <b>Davis VP+ ' . langtransstr('forecast') . ':</b> <span style="color: green; font-size:9pt">' . fixupVPforecast($vpforecasttext) . "</span>"; 
and include the above function into your ajax-dashboard.php

You can fix the Capitalization issue by making the second entries in the langlookup lines have the proper case for your language.

Hope this helps...

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
User avatar
actioman
Posts: 118
Joined: Sat 20 Mar 2010 1:01 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows XP SP3
Location: Elvas, Portugal
Contact:

Re: Davis Weather Forecast question

Post by actioman »

Very good Ken. As usual. :clap:

I will then translate it to Portuguese and Spanish, which are the only languages ​​that have some feel free to do so.

Invite other Saratoga Templates users to translate these davis forecast strings for their own language and thus help Ken to have here another good update for this great Templates.

Thank you very much for this great piece of code! :)
Kind Regards, Manuel.

Image
Post Reply