Saratoga Base-World templates switch to DarkSky forecast before WU API shutdown

For all the Base-World template users, make sure you switch to using DarkSky for forecasts before the [b]planned 15-Feb-2019 shutdown[/b] of the WeatherUnderground API (at which time your WU-forecast.php scripts will cease operation).

The easiest way to switch is to use the update tool page with a query of Base-World, Plugin-*, 02-Dec-2018 to get all the needed files. Follow the instructions in the included Settings-DarkSky-README.txt file to change your Settings.php to add the DarkSky API key and forecast locations to your site. The ajax-dashboard.php and wxforecast.php scripts have also been updated for DarkSky support.

If you’re using the ajax-dashboard6.php, please see this post for details on what to modify. I’ve also updated the legacy script page with 6.95a of Scott’s alternative ajax-dashboard6.php script (just the one file was updated).

WU has revealed the future API replacement and said it would be free for low-volume PWS data submitters to use, but has not offered any API keys for the new API yet – the new API is INCOMPATIBLE with the existing WU-forecast.php, so you’ll have to change to DarkSky.net forecasts before they shut off the old API. I’ll try a rewrite of WU-forecast for the new API as soon as keys are available – right now they’re only talking about a 5 day forecast period (instead of the current 7 day forecast). DarkSky provides a 7 day forecast, but only for 24hr periods (so only 7 icons).

I’ll keep you posted about developments for the WU API replacement – in the meantime, DO update your sites to use DarkSky forecasts NOW.

Best regards,
Ken

So those of us running the USA base don’t need to make any changes…yet…?

Correct, Dan. The Base-USA template uses advforecast2.php (either the older V4 or the ‘beta’ V5 script) which depends on the NWS for data.
Likewise, the Base-Canada template uses ec-forecast.php for forecast data from Environment Canada.
No changes to DarkSky are needed for either USA or Canada users.

Only the Base-World template used WU-forecast.php and must switch to using DS-forecast.php for DarkSky before 15-Feb-2019 when the WU API is planned to be shutdown. The same applies to any standalone user of WU-forecast (switch to DS-forecast.php).

Hi Ken
Thanks very much for the update.
After updating the files, I have some issues with the translations, first its LTR instead of RTL and some is translating to Hebrew and some are not.
I would appreciate it very much if you can have a look on it
http://evweather.info/wxforecast.php
Thanks
Eli

Hi Eli,
It appears that despite the $lang=‘he’ setting, the script is loading with lang=en so only the English shows for the forecast. I had included Hebrew as a supported language in DS-forecast-lang.php , I’ll have to do some local investigation and get back with you on this. Thanks for spotting the problem.

BTW… let me know if the Hebrew translations in the rest of the page display are working or not… I can have you change the Hebrew translation table for me to make it correct :slight_smile:

Best regards,
Ken

Ahh… found it in DS-forecast.php in a lookup array. Find

'he' => 'en',

and replace it with

'he' => 'he',

then the rest of the text should be in Hebrew. You need to add ?force=1 to the wxforecast.php url to force a cache refresh after the script change.

#-o sorry for the script typo.

Hi Ken
Thanks, that solved the translation problem (so you can keep the table :D), but still the page orientation is left to right instead of RTL (All other pages are ok)

Hi Ken

Thx for update, i have a question about the update time. its always show Updated: 05/01/2019 00:00, is there some thing i have forgot to do?

Svein Ove

Hi Eli,
Since I don’t read Hebrew, can you draw on the Hebrew image below and show what is not RTL as you expect? I’ve included the English for the same forecast as a separate image.

Hi Svein,
DarkSky.net does not offer a ‘forecast updated’ time in their JSON (I have suggested it to them). So, the timestamp for the first period forecast (which is always midnight local time) is used for the forecast updated time… it’s the only data they provide.


Hi

Eventually you will :slight_smile:

Its strange, your Hebrew page comes perfect, so I guess the problem is me. I have attached a pic with what I get, the days (bold) are on the left side and the script is aligned with it, it should be as in yours


Eli,
I found the issue … try using this version (1.06).


DS-forecast-V1.06.zip (18.4 KB)

Thanks very much Ken , working perfectly

Thanks for the problem spotting and testing the fix, Eli. I’ve pushed the V1.06 to the Base-World distribution and standalone script page.

I’ve done an update to the DarkSky forecast script (DS-forecast.php V1.09, DS-forecast-lang.php V1.06) that adds a tabbed display of the Daily and Hourly(24hrs) forecasts. Including scripts also need to add some CSS to format the tabbed display.

Standalone: https://saratoga-weather.org/scripts-DSforecast.php (the scripts and CSS addition are available there)

Template: https://saratoga-weather.org/wxtemplates/updates.php with query 23-Jan-2019, Base-World, Plugin-*
which updates DS-forecast.php, DS-forecast-lang.php and wxforecast.php scripts (the latter has the needed CSS included)

Thanks again for the good work !

Excellent work Ken! Up and running!

http://www.meteothes.gr/wxDSforecast.php

Thank you!

Thanos

Hi Thanos,
Thanks for the kind words!

Don

Looking good Ken, thanks for your hard work!

http://www.sandhurstweather.org.uk/wx11.php