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

New PW-forecast.php script for international/multilingual forecasts

Discussion of Ken True's web site templates

Moderator: saratogaWX

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

New PW-forecast.php script for international/multilingual forecasts

Post by saratogaWX »

As you likely know, after Apple bought DarkSky, the ability to get new DarkSky API keys vanished, and the API itself is soon to be withdrawn from availability. Fortunately, a PhD student has cobbled together an API using public weather data (GFS, GEFS, HRRR) on Amazon Web Services and is offering a free API in the DarkSky format. WooHoo, said I. So I've adapted my existing (and soon to be obsolete) DS-forecast.php to use the new API.

The site offering the API is https://pirateweather.net/ ('pirate' because HRRR sounds like the ARRRR that pirates supposedly used).

The new API is not quite as full-featured as the real DarkSky API:
1) English text responses only (but the PW-forecast.php handles multilingual translations built-in)
2) Sparse 'conditions' text.. usually only one word.
3) Alerts are just titles.. no link to details

I'll be adding the offering to the Base-World template set next week. The script set is available from two sources:

https://saratoga-weather.org/scripts-PWforecast.php and https://github.com/ktrue/PW-forecast

See the demo at https://saratoga-weather.org/PW-forecast-demo.php
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by ConligWX »

Thanks again for all your hard work Ken. Much appreciated.

hoping someone from the cumulus community could write a Forecast page for the CumulusMX website too.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
User avatar
dazza1223
Posts: 867
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by dazza1223 »

ConligWX wrote: Tue 17 Jan 2023 10:03 am Thanks again for all your hard work Ken. Much appreciated.

hoping someone from the cumulus community could write a Forecast page for the CumulusMX website too.
that be so good if that can happen :lol:
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by jlmr731 »

First, Thanks to Ken with all the work very nicely done.

All i did was to knock out the tables from index.htm and put in a php include to the PW-forecast.php so edit the name if you have changed anything.
I zipped up my example web page and also the menu.js file if you want a link pointing to forecast menu.js is in the js directory

My example is here https://wickliffeweather.com/forecast.php
You do not have the required permissions to view the files attached to this post.
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by ConligWX »

excellent. Thanks for the file.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
Nossie
Posts: 360
Joined: Tue 16 Aug 2022 8:01 pm
Weather Station: Ecowitt 2551
Operating System: Raspberry Pi5 Debian Bookworm
Location: Stewarton, East Ayrshire UK
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by Nossie »

I loved DarkSky prior to apple taking them over, such a shame - but no surprise I guess.

Will need to check this out! Thank you, everyone involved!
Ian.

http://www.StewartonWeather.com
Containerised Cumulus[MX] 3.28.0 (build: 3269) ● CumulusUtils Version 6.23.0● Ecowitt 2551/WH65/T&HP/WH57/WH45/3x WH51 ● Pi 5 8GB ● Debian Bookworm ● Ubuntu Server Host
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by ConligWX »

saratogaWX wrote: Sun 15 Jan 2023 2:34 am As you likely know, after Apple bought DarkSky, the ability to get new DarkSky API keys vanished, and the API itself is soon to be withdrawn from availability. Fortunately, a PhD student has cobbled together an API using public weather data (GFS, GEFS, HRRR) on Amazon Web Services and is offering a free API in the DarkSky format. WooHoo, said I. So I've adapted my existing (and soon to be obsolete) DS-forecast.php to use the new API.

See the demo at https://saratoga-weather.org/PW-forecast-demo.php
Ken I has just added the standalone page to my website. I am using Aerisweather Forecast in my Settings as the default Forecast for Saratoga Templates. I also have DS setup as a standalone. when I add PW as a standalone my webpage background colour changes from dark to light.

AerisWeather https://www.conligwx.org/wxforecast.php
DarkSky https://www.conligwx.org/wxforecastds.php
PirateWeather https://www.conligwx.org/wxforecastpw.php

Any thoughts?
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
User avatar
saratogaWX
Posts: 1202
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: New PW-forecast.php script for international/multilingual forecasts

Post by saratogaWX »

Just did a small update of PW-forecast.php to V2.51 of the script to automatically set the timeline display to ampm or 24hr time based on $timeFormat/$SITE['timeFormat']. (If the time format has 'g', then am/pm is used, otherwise 24hr time is used).

Available on the script page, the Template update tool page and on GitHub.

Best regards,
Ken
User avatar
saratogaWX
Posts: 1202
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: New PW-forecast.php script for international/multilingual forecasts

Post by saratogaWX »

ConligWX wrote: Thu 19 Jan 2023 12:50 pm
saratogaWX wrote: Sun 15 Jan 2023 2:34 am As you likely know, after Apple bought DarkSky, the ability to get new DarkSky API keys vanished, and the API itself is soon to be withdrawn from availability. Fortunately, a PhD student has cobbled together an API using public weather data (GFS, GEFS, HRRR) on Amazon Web Services and is offering a free API in the DarkSky format. WooHoo, said I. So I've adapted my existing (and soon to be obsolete) DS-forecast.php to use the new API.

See the demo at https://saratoga-weather.org/PW-forecast-demo.php
Ken I has just added the standalone page to my website. I am using Aerisweather Forecast in my Settings as the default Forecast for Saratoga Templates. I also have DS setup as a standalone. when I add PW as a standalone my webpage background colour changes from dark to light.

AerisWeather https://www.conligwx.org/wxforecast.php
DarkSky https://www.conligwx.org/wxforecastds.php
PirateWeather https://www.conligwx.org/wxforecastpw.php

Any thoughts?
You're generating a dynamic background to the page of your website.
Somehow, the merry-timeline is causing the CSS of 'background-color: #212121;' to be suppressed in the browser, yielding a 'white' background.
I do know that merry-timeline does modify background colors for the hour-sliced display to indicate the weather/sky condition.
I've not messed about with dynamically produced replicating backgrounds like you have, so have no additional advice on how to fix.. sorry!

Edit: Try fixing the body CSS in weather-screen-narrow-black.css to have

Code: Select all

 background-color:#212121 !important;
instead of just

Code: Select all

 background-color:#212121;
.. works to restore background using Firefox debugger :)
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by ConligWX »

saratogaWX wrote: Thu 19 Jan 2023 5:39 pm
You're generating a dynamic background to the page of your website.
Somehow, the merry-timeline is causing the CSS of 'background-color: #212121;' to be suppressed in the browser, yielding a 'white' background.
I do know that merry-timeline does modify background colors for the hour-sliced display to indicate the weather/sky condition.
I've not messed about with dynamically produced replicating backgrounds like you have, so have no additional advice on how to fix.. sorry!

Edit: Try fixing the body CSS in weather-screen-narrow-black.css to have

Code: Select all

 background-color:#212121 !important;
instead of just

Code: Select all

 background-color:#212121;
.. works to restore background using Firefox debugger :)

Much Appreciated Ken! :clap:
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by jlmr731 »

your new merry-timeline looks much better, give a nice clean look and much easier to read
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by ConligWX »

jlmr731 wrote: Tue 17 Jan 2023 10:37 pm First, Thanks to Ken with all the work very nicely done.

All i did was to knock out the tables from index.htm and put in a php include to the PW-forecast.php so edit the name if you have changed anything.
I zipped up my example web page and also the menu.js file if you want a link pointing to forecast menu.js is in the js directory

My example is here https://wickliffeweather.com/forecast.php
I found you needed also to change the main PW-forecast.php code (mine is PWcmx-forecast.php)

from:

Code: Select all

<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; background-color:#FFFFFF">
to

Code: Select all

<body style="font-family:'Rosario', sans-serif; font-size:15px; background-color:#FFFFFF">
so the Forecast page has the same font/sizing. I'm using the standard PW-forecast.php for Saratoga Templates and a cloned one (PWcmx-forecast.php) for CumulusMX Web page Templates.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by jlmr731 »

That works out nicely thanks, also if you want the daily forecast to be hoverable like the rest of the site, (I didnt like the look on the new hourly page),
on line or about line 1381 you can add that class to it like

Code: Select all

<table style="border: 0" width="640px" class="PWforecast w3-table w3-hoverable">
Mapantz
Posts: 1822
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: New PW-forecast.php script for international/multilingual forecasts

Post by Mapantz »

Hi Ken

I've just noticed that the sunrise and sunset times in the current conditions are not taking daylight savings in to account.
Image
User avatar
saratogaWX
Posts: 1202
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: New PW-forecast.php script for international/multilingual forecasts

Post by saratogaWX »

The sunrise/sunset times come from Pirateweather and are formatted by

Code: Select all

 if(isset($JSON['daily']['data'][0]['sunriseTime']) and 
	   isset($JSON['daily']['data'][0]['sunsetTime']) ) {
	  $PWcurrentConditions .= 
	  $tranTab['Sunrise'].': <b>'. 
		   date($tFMT,$JSON['daily']['data'][0]['sunriseTime']) . 
			 "</b><br/>\n" .
		$tranTab['Sunset'].': <b>'.
	     date($tFMT,$JSON['daily']['data'][0]['sunsetTime']) . 
			 "</b><br/>\n" ;
	}
Sounds like an API bug to me.

The API doc just saysat https://pirateweather.net/en/latest/API/
sunriseTime

Only on daily. The time when the sun rises for a given day represented in UNIX time.
sunsetTime

Only on daily. The time when the sun sets for a given day represented in UNIX time.
I suggest you open an issue at https://github.com/alexander0042/pirateweather/issues/ and see what the author of the API has to say. My code assumed the data was the UTC unix timestamp and the date() function (along with your timezone setting) would correctly display the data.
Post Reply