Page 8 of 8

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Sun 22 Dec 2024 2:31 pm
by CarlosLSev
lse-cumulus wrote: Sun 22 Dec 2024 1:46 pm I have not been aware of Sager-Weathercaster before, but when browsing the forum this thread got my attention. I made some small modifications to bt-sager-cu.php (webtags) and sager_test.php and integrated bt-sager-wc.php succesfully in my PWS-Suttenbrunn Cumulus Utils page under PHP 5.3.x. as entries in CUsermenu.txt. All is working fine, the Sager forecast is more accurate than the standard CMX forecast, and on top of it, I added a Sager forecast html page in CURPT style.
https://leonas.ddns.net/Wetterstation.S ... nbrunn.php
https://leonas.ddns.net/Wetterstation.S ... r_test.php
Hi, very cool, would you share it? I found 2 versions, global and v2, there is even another much older one, I am testing and comparing it, I am using both on the same page to test them. https://www.meteoviso.es/script/bt-sager/index.php

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Sun 22 Dec 2024 3:54 pm
by lse-cumulus
my version is based on the zipfile from page-1 of this thread here: bt-sagerV2.zip; Modified bt-sager files 19/03/2019
Please find attached my modifications from 22-Dec-2024 and my CURPT style additional php output file.

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Mon 23 Dec 2024 9:59 pm
by CarlosLSev
Thank you

PHP Script V3 for combined Sager/Zambretti Weathercaster for CMX and CU

Posted: Thu 26 Dec 2024 10:09 am
by lse-cumulus
I made some further modifications to the PHP scripts from BT for Sager and Zambretti weathercast (generate ouput code and try to map to original forecast text) and then included BOTH weathercaster into one (1) html page that can be used in a user report style for Cumulus Utils or as a standalone webpage.
https://leonas.ddns.net/Wetterstation.S ... bretti.php
Please find attached the zip file with the code and a readme.txt file.
27.12.2024: updated zip file with fix in file bt-sager-wc.php for php 8.x and usage of function join/implode parameters seperator, array

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Thu 26 Dec 2024 1:00 pm
by De Hout
I am following this with great interest. Missed this discussion before.

The V2 script has been running standalone on my server for a few days, but it is not integrated in the website yet.
https://www.alkmaarweer.nl/sager_test.php

At the moment, the Sager forecast is not very accurate here. Atmospheric pressure is very high (highest of 2024) and there is almost no wind, so it is obvious that the forecast is 'fair'. The real circumstances are different. It is overcast, with RH >98%. It does not feel like 'fair' but it's not 'unsettled' either. 'Stable' would be more appropriate. Sager does not have the 'stable' option. Zambretti does. That's why the combination of Sager and Zambretti isn't such a bad idea.

Keep up the good work!

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Thu 26 Dec 2024 2:25 pm
by TheBridge
It has been a couple of years since I filled around with this code HOWEVER I recall I modified the variable $PO which offsets to barometric pressure it reads from my Davis weather station. This line is on the same code file (sorry I don’t recall the which sager file name was off the top of my head) as the one where you set the local airport code so the sager code can fetch the METAR reading. The $PO is right below that setting and described in text. I recall some general warning in the comment text such as ‘DON’T CHANGE THIS’ which of course I ignored and kept changing until I generally got the forecast that reflects much closer to actual conditions.

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Thu 26 Dec 2024 4:05 pm
by De Hout
CarlosLSev wrote: Wed 18 Dec 2024 3:31 pm Hi, it's working now. In case it helps anyone, I had to modify line 173 of bt-sager-wc.php. I run php 8.4.1, maybe it will work in other versions.

Code: Select all

// Change this line:
$pattern = "/[-+]?(" . join ($pcodes, "|") . ")/";

// With this one:
$pattern = "/[-+]?(" . implode("|", $pcodes) . ")/";
https://www.meteoviso.es/script/bt-sage ... r_test.php
The above modification works, thanks Carlos.

@Leo, what version of PHP are you using on your webserver?

[edit] I see in your page source: <!-- server running PHP ver 5.3.27 -->

You might consider using a more recent version of PHP, especially because you are developing the Sager script which will not work with the newest and common used PHP versions 8.x. (says the man who still uses CU1 :roll: )

Re: PHP Script V3 for combined Sager/Zambretti Weathercaster for CMX and CU

Posted: Thu 26 Dec 2024 10:02 pm
by CarlosLSev
lse-cumulus wrote: Thu 26 Dec 2024 10:09 am I made some further modifications to the PHP scripts from BT for Sager and Zambretti weathercast (generate ouput code and try to map to original forecast text) and then included BOTH weathercaster into one (1) html page that can be used in a user report style for Cumulus Utils or as a standalone webpage.
https://leonas.ddns.net/Wetterstation.S ... bretti.php
Please find attached the zip file with the code and a readme.txt file.
Hi, that's great. I'll soon be able to publish a forecast similar to the one Davis does but with Cumulus, Sager and Zambretti. It's looking better and better. The one based on Metar is easier to translate than the one from Zambretti, but very good work.

https://www.meteoviso.es/script/bt-sage ... bretti.php

I will continue testing

fixed V3 version for PHP 8.X

Posted: Fri 27 Dec 2024 12:03 pm
by lse-cumulus
Derk, Carlos,
thx for the hint about the codeline of function join/implode that has not been working for PHP 8.x. I overlooked the older post already pointing that out when I created the new version V3. Fixed in an updated version of my zip file in the post before.
I try to keep my php scripts compatible from PHP 5.x up to 8.x. It is much more work/fun to get scripts downgraded for PHP 5.x while having the upgrade to 8.x on my backlog to do list (my PHP version is bundled with the OS and that waits for a HW change of my webserver).

Re: BT's Sager PHP Script V2 - For Cumulus

Posted: Sat 28 Dec 2024 3:43 pm
by De Hout
Thanks for you answer Leo!