Author Topic: Support of the "Leuven" Forecast scripts  (Read 87233 times)

0 Members and 1 Guest are viewing this topic.

Offline Weatherstation De Hout

  • Member
  • *
  • Posts: 20
    • Weatherstation De Hout Alkmaar
Re: Support of the "Leuven" Forecast scripts
« Reply #225 on: April 23, 2025, 03:20:34 PM »
Quote
The link to the demo-site (pwswd.be/wsfct4/)  is often used for all kind of tests.
Please post a link to your own weather-website with a similar problem, so i can take a look into this.
Here it is: https://www.alkmaarweer.nl/wsfct4/wsFctmetnoSmall4.php

Note that I've slightly tweaked it, so was a bit hesitant to post it.
The original version (lastest) does show the same issue though.

Derk
« Last Edit: April 23, 2025, 03:25:42 PM by Weatherstation De Hout »
CU1 | Weather Station Website: https://www.alkmaarweer.nl | Davis Vantage Pro2+ FARS

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #226 on: April 23, 2025, 03:34:11 PM »
The first complete weather-data in the graph is for 02:00
The scripts currently show the day-name if the data is from the day before up-to 01:00  today.

The metno data used comes  in 3 hour parts.
Will not be easy to adept this "very old" code.

Wim
« Last Edit: April 23, 2025, 04:00:03 PM by wvdkuil »

Offline Weatherstation De Hout

  • Member
  • *
  • Posts: 20
    • Weatherstation De Hout Alkmaar
Re: Support of the "Leuven" Forecast scripts
« Reply #227 on: April 23, 2025, 04:15:22 PM »
Will not be easy to adept this "very old" code.

No worries Wim.
I can live with it.

Derk
CU1 | Weather Station Website: https://www.alkmaarweer.nl | Davis Vantage Pro2+ FARS

Offline Meteoensevilla

  • Contributor
  • ***
  • Posts: 130
    • Meteoensevilla
Re: Support of the "Leuven" Forecast scripts
« Reply #228 on: May 12, 2025, 12:38:49 PM »
Hi Wim

I've had your wxsim script running for a while.

https://www.meteoensevilla.es/wx_lvn_wxsimD.php

It was working fine, but a couple of days ago I decided to download your script again because I had updated it to PHP 8. I have four languages ​​selectable on the website, and it's still working fine, but it doesn't translate into English or Spanish. It does in French and German. If I force the cache with English selected, it works in English, but it stops working in Spanish, and vice versa.

I know the script works perfectly, but I'm not doing something right.

If I force a cache refresh with Spanish selected, it does, but then the text in English will be displayed in Spanish. I've tried the previous version, but it doesn't happen.

https://www.meteoensevilla.es/wx_lvn_wxsimD.php?force=wxsim

What do you think?

Thanks
« Last Edit: May 12, 2025, 07:36:01 PM by Meteoensevilla »

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #229 on: May 13, 2025, 06:07:37 AM »
I have four languages ​​selectable on the website, and it's still working fine, but it doesn't translate into English or Spanish. It does in French and German. If I force the cache with English selected, it works in English, but it stops working in Spanish, and vice versa.

Hi,

Sorry for the delay but it takes some time to find a cause in these rare problems.

I therefor added the es-language by copying your two language files and modifying line 252 to contain 'es'.
When using the default 4 languages and the added 'es' language
-> I could not confirm your problem at the demo website https://pwswd.be/wsfct4/.


Problem is, I can not exactly test your situation as the default language at the test-site should remain 'en' for the other visitors.

The only "problem / difference" I could find are in lines  162-165 in your ./wsfct4/_metric_settings.php
They read
Code: [Select]
#-----------------------------------------------
# Multilanguage support
#-----------------------------------------------
$lang = 'en'; #default language to use

But line 165 should be in your case
Code: [Select]
$lang = 'es'; #default language to use
Succes,
Wim

Offline Meteoensevilla

  • Contributor
  • ***
  • Posts: 130
    • Meteoensevilla
Re: Support of the "Leuven" Forecast scripts
« Reply #230 on: May 13, 2025, 12:34:10 PM »
Hi Wim, first of all, thank you for your response. It didn't take long at all. Your time is valuable, and that's something to understand.

I understand the complexity of what I've requested, and although I made the change you suggested and spent several hours on the case, I haven't been able to find the solution, so I've reverted to version wsfct4-2023-05-03, which works perfectly for me.

However, I've left the most up-to-date version at https://www.meteoensevilla.es/wsfct4.new/

If you need to access my website, I have no problem providing you with access to my FTP server. I have complete confidence in you, as I could not otherwise.

Thank you very much for everything.

Offline Tln7559

  • Slangenbeek
  • Senior Member
  • **
  • Posts: 55
    • Weather&PV Hengelo_Slangenbeek
Re: Support of the "Leuven" Forecast scripts
« Reply #231 on: May 17, 2025, 04:53:33 AM »
Probably just 2 'minor' things, but searching the scripts themselves, this thread and the related readme-file for the scripts did not find an answer.

1. Setup of displaywindow-size
In the html-script the call to the 'small'-HWA-script is inserted in the following way 'under' the 4day-meteogram of HWA:
Code: [Select]
<a href="https://vannwnhzn.nl/wsfct4/wsFctHwaSmall4.php"><img src="https://www.hetweeractueel.nl/includes/custom/mosimage.php?id=603" title="Klik voor 10dagen-meteogram" style="width: 500px" ALIGN=LEFT /></a>
Would like to 'shrink' the picture from the 'small'-HWA-script to completely fit on the screen (unrelated to number of pixels and actual screen), but do not see a grip to get that effect:
looking for something comparable to the width-command as used for the 4day-meteogram.
Tried that structure, but that does not work for the 'small'-script:
what is the proper way to setup the 'small'-HWA-script to get a smallersize display?
Perhaps a complication, but would like to keep 'unlimited, full-size' result of
Code: [Select]
https://vannwnhzn.nl/wsfct4/wsFctHwaPage4.php.

2. Setup of weblink
At the left bottom corner of the display a weblink should connect to my website, but instead get an error telling that url is not found.
The text over the weblink showing hint that it is directly linked to the info coming from the HWA-account, but clicking the weblink, it shows an url which obviously does not get a useful result.
Code: [Select]
https://vannwnhzn.nl/wsfct4/Hengelo%20(Slangenbeek)Same is applicable when running
Code: [Select]
https://vannwnhzn.nl/wsfct4/wsFctHwaPage4.phpWhere/how to correct?
« Last Edit: May 17, 2025, 06:32:23 AM by Tln7559 »
Sensors: TFA_Nexus + LaCrosse_WS7000 + Tempest + Ecowitt + DIY
Software: WsWin + WeeWX + Domoticz + GW1000 + Meteobridge

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #232 on: May 17, 2025, 06:41:35 AM »
. . .
Would like to 'shrink' the picture from the 'small'-HWA-script to completely fit on the screen
. . .
Perhaps a complication, but would like to keep 'unlimited, full-size' result of . . .zn.nl/wsfct4/wsFctHwaPage4.php
The default width of a "complete" forecast is set in the XX_settings.php, in the metric version on line 108
Code: [Select]
$yourDisplayWidth= '1200px';             # number of pixels for display width of  forecasts.If you want to use different widths on different html pages, just change the line which set the width of the body.
In wsHwaSmall.php it is line 178 which loads the wirdth from the settings. That lines now reads
Code: [Select]
<body style="width: '.$yourDisplayWidth.'; margin: 0 auto; ">'.PHP_EOL;} Change that if you want a fix width in pixels to f.i.
Code: [Select]
<body style="width:800px; margin: 0 auto; ">'.PHP_EOL;} Or if it is a correct html page with an enclosing frame
Code: [Select]
<body style="width:100%; margin: 0 auto; ">'.PHP_EOL;}
Or even more flexibel for future changes, set line 108 in your metric_settings.php to
Code: [Select]
$yourDisplayWidth= '100%';             # number of pixels for display width of  forecasts.
Quote
2. Setup of weblink
At the left bottom corner of the display a weblink should connect to my website, but instead get an error telling that url is not found.
The text over the weblink showing hint that it is directly linked to the info coming from the HWA-account, but clicking the weblink, it shows as url
Code: [Select]
https://vannwnhzn.nl/wsfct4/Hengelo%20(Slangenbeek), which obviously does not get a usueful result.
Same is applicable when running
Code: [Select]
https://vannwnhzn.nl/wsfct4/wsFctHwaPage4.phpWhere/how to correct?
Please use the test website awhen you encounter a problem. There you see a correct URL to the users website:
Code: [Select]
<span style="float: left;">Weather forecast for
<a href="http://www.weerstation-herent.be" target="_blank"> Herent.</a>&nbsp;&nbsp;&nbsp;Weatherforecast from HetWeerActueel using met.no data</span>
So it should not be a link to a special page in the ./wsfct4/ folder.

When I check the  returned data for my test-station from HWA-server, the xml shows
Code: [Select]
<Plaats id="470" naam="Herent" alias="http://www.weerstation-herent.be">translated to
Code: [Select]
["info"]["id"]  => 470
["info"]["name"]  => Herent
["info"]["website"]  => http://www.weerstation-herent.be

Others can not read your data from the HWA server but your translated data has no URL:
Code: [Select]
["info"]["id"]  => 603
["info"]["name"]  => Hengelo (slangenbeek)
["info"]["website"]  => Hengelo (Slangenbeek)

Succes,
Wim


« Last Edit: May 17, 2025, 09:17:33 AM by wvdkuil »

Offline Weatherstation De Hout

  • Member
  • *
  • Posts: 20
    • Weatherstation De Hout Alkmaar
Re: Support of the "Leuven" Forecast scripts
« Reply #233 on: May 17, 2025, 08:23:33 AM »
At the left bottom corner of the display a weblink should connect to my website, but instead get an error telling that url is not found.
The text over the weblink showing hint that it is directly linked to the info coming from the HWA-account, but clicking the weblink, it shows an url which obviously does not get a useful result.
Code: [Select]
https://vannwnhzn.nl/wsfct4/Hengelo%20(Slangenbeek)Same is applicable when running
Code: [Select]
https://vannwnhzn.nl/wsfct4/wsFctHwaPage4.phpWhere/how to correct?

That is a faulty entry in the HWA database itself,  not in the forecast script. You can try to contact the HWA webmaster (Luc) to correct that.
The problem is that he does barely react on pm's at the HWA forum...
I can see the same issue with my HWA forecast, but I'm not showing the HWA version on my site. See: https://www.alkmaarweer.nl/wsfct4/wsFctHwaSmall4.php
It can be altered by hardcoding the correct URL somewhere in the script. I only forgot where exactly...
« Last Edit: May 17, 2025, 08:26:20 AM by Weatherstation De Hout »
CU1 | Weather Station Website: https://www.alkmaarweer.nl | Davis Vantage Pro2+ FARS

Offline Tln7559

  • Slangenbeek
  • Senior Member
  • **
  • Posts: 55
    • Weather&PV Hengelo_Slangenbeek
Re: Support of the "Leuven" Forecast scripts
« Reply #234 on: May 17, 2025, 04:04:56 PM »
Wim&Derk,
Thanks for the hints!

Clearly some more homework for me to process Wim's leads.
After some search found the probable location which houses the processing for the 'erroneous' stationweblink etc. as mentioned in my 'question-message': it is in script /wsfct4/wsIncHwaHtml4.php at lines 77 till 86.
To avoid the erroneous reading from the HWA-database perhaps suggestion
to change the download-file in line 77 to have a real credit-text like 'Meteogram gegenereerd door Leuven Forecast-script'.
Change line 80 for centred display of the text as a related, cosmetic improvement.

Derk's version of the 'small'-script and it's application as part of <iframe> at his website very useful as guidance for upgrade of the meteo-section of my own website:
my mistake to try using img instead of iframe for embedding of the meteogram-picture in the html-code.
« Last Edit: May 19, 2025, 07:58:24 AM by Tln7559 »
Sensors: TFA_Nexus + LaCrosse_WS7000 + Tempest + Ecowitt + DIY
Software: WsWin + WeeWX + Domoticz + GW1000 + Meteobridge

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #235 on: June 27, 2025, 04:37:44 AM »
Are there any changes to Environment Canada xml data?

The standard link to obtain Curentconditions and forecast using Province+area|_code returns 404 errors.
Code: [Select]
https://dd.meteo.gc.ca/citypage_weather/xml/ON/s0000646_e.xmlOne can not browse the xml folder either, als0 a 404 error

The folder now contains all of today with a time stamp
Code: [Select]
https://dd.meteo.gc.ca/citypage_weather/ON/08/20250627T080143.425Z_MSC_CitypageWeather_s0000646_en.xml
Any clues how to obtain the latest xml ?

Thanks,
Wim

Offline Weatherstation De Hout

  • Member
  • *
  • Posts: 20
    • Weatherstation De Hout Alkmaar
Re: Support of the "Leuven" Forecast scripts
« Reply #236 on: June 27, 2025, 08:59:56 AM »
CU1 | Weather Station Website: https://www.alkmaarweer.nl | Davis Vantage Pro2+ FARS

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #237 on: June 27, 2025, 09:52:59 AM »
Wim,
It seems the API has moved.
Read this: https://dd.meteo.gc.ca/citypage_weather/docs/README_citypage_weather.txt

Derk

Hi Derk,

Yes, I read that.
Those are all "historical" files ordered by  /Province/hour/
The filenames use UTC timezone, the data itself has the "local time" also.

To use that set of folders the scripts need to
  • access and load the html hour page, example:  dd.weather.gc.ca/citypage_weather/ON/13/
    That hourly file can have hundreds of lines
  • do a "html" -> "code" conversion to find the latest forecast
  • 1 access to load the xml if there is one for this hour
  • and extra code to make sure the file is available in the previous hour and if not
  • use a cached version of the previous day file
  • a.s.o.

There always has been another location containing only the latest file which could be loaded with 1 html access.

- - - -

I have no idea  how many  Leuven/pwsWD users  use the Environment Canada version of my scripts.
If no one is using it there is no need to adept the scripts.

Just hope some knowledgable Canadian user can post and could ask Environment Canada how to get 1 forecast with 1 access.

Regards,
Wim
« Last Edit: June 27, 2025, 10:09:02 AM by wvdkuil »

Offline blainec

  • Senior Member
  • **
  • Posts: 75
    • Weather YYC
Re: Support of the "Leuven" Forecast scripts
« Reply #238 on: June 27, 2025, 08:19:13 PM »
I use EC and as of yet not figured out how to get the data.
Still investigating...

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9722
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Support of the "Leuven" Forecast scripts
« Reply #239 on: June 28, 2025, 04:56:25 PM »
Back in October, 2024, I'd switched ec-forecast.php from using XML Citypage data to the same JSON data that the main EC sites use.

Quote
    if($Lang == 'fr') {
      $ECURL = "https://meteo.gc.ca/api/app/fr/Location/$latlon?type=city";
      $PGURL = "https://meteo.gc.ca/fr/location/index.html?coords=$latlon";
      $Status .= "<!-- using $ECURL for French forecast -->\n";
      $Status .= "<!-- using $PGURL for page -->\n";
    }
    if($Lang == 'en') {
     $ECURL = "https://weather.gc.ca/api/app/en/Location/$latlon?type=city";
     $PGURL = "https://weather.gc.ca/en/location/index.html?coords=$latlon";
     $Status .= "<!-- using $ECURL for English forecast -->\n";
     $Status .= "<!-- using $PGURL for page -->\n";
    }
That JSON data works just fine.  Their recent change of XML data to incorporate timestamps without a symlink to the most-recent one just means that XML data is likely not usable for forecast scripts anymore.  :(
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #240 on: June 29, 2025, 02:50:48 AM »
Back in October, 2024, I'd switched ec-forecast.php from using XML Citypage data to the same JSON data that the main EC sites use.
. . .
That JSON data works just fine.  Their recent change of XML data to incorporate timestamps without a symlink to the most-recent one just means that XML data is likely not usable for forecast scripts anymore.  :(

Hi Ken,

Thanks for the information.
Currently,  I am not aware of any EC / Canadian users of the "Leuven" forecast scripts.

I checked the .json file format and it will take considerabel time to convert the current "Leuven-xml" scripts to the .json format.
If any Canadian user contact me, I will advise to switch to your forecast scripts.

Will use my spare time next weekend to convert the EC-forecast for PWS_Dashboard users.
Maybe there is even more than 1 user for that forecast.   :evil:

Best regards,
Wim

Offline KapitainOne

  • Senior Contributor
  • ****
  • Posts: 262
    • Sanford Weather
Re: Support of the "Leuven" Forecast scripts
« Reply #241 on: June 29, 2025, 10:29:27 AM »
I too am using the EC forecast! Guess I'll have to look into using Ken's forecast in another template!
Bill

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #242 on: June 29, 2025, 10:39:50 AM »
I too am using the EC forecast! Guess I'll have to look into using Ken's forecast in another template!
Bill

Hi Bill,
This discussion topic is about old "Leuven" scripts which do not work anymore.

As I check you avatar you are using PWS_Dashbaord at https://www.sanfordweather.com/pwsWD/index.php
That is fully supported and has multiple forecasts available, also you are using EC forecast and it seems to work at your place.

I emptied my agenda for next weekend to check all PWS_Dashboard code and make sure the scripts continue to work.

Wim
« Last Edit: June 29, 2025, 10:46:01 AM by wvdkuil »

Offline KapitainOne

  • Senior Contributor
  • ****
  • Posts: 262
    • Sanford Weather
Re: Support of the "Leuven" Forecast scripts
« Reply #243 on: June 29, 2025, 10:45:09 AM »
If you look closely at the screen shot you posted the forecast shows today, tonight, then Thursday!!! should it not be Monday???I believe it has cached the data the last time it collected the xml back on Wed.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #244 on: June 29, 2025, 10:47:53 AM »
If you look closely at the screen shot you posted the forecast shows today, tonight, then Thursday!!! should it not be Monday???I believe it has cached the data the last time it collected the xml back on Wed.

Yes, you are right.
If it is old data, switch to another forecast for now f.i. WU or yr.no
I need free time to check the scripts.

Regards,
Wim

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #245 on: June 30, 2025, 09:55:35 AM »
The "Leuven" forecasts for EnvironmentCanada are adapted to the json data.
Some features are missing compared to the xml data, but there will be new features  as the json data contains also more items.

The scripts will be in BETA-test for ma week or so, to iron out possible problems. Test them here https://pwswd.be/wsfct4/

If you are a "Leuven" forecast users and want to replace you non-functioning EC-xml scripts,  sent me a personal message with the URL to the website.
I will test your "settings" and if OK I will sent you the zip.

- - -

Now its time to rewrite the EC-forecast scripts for PWS_Dashboard.

Wim


Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: Support of the "Leuven" Forecast scripts
« Reply #246 on: July 01, 2025, 12:10:57 PM »


Now its time to rewrite the EC-forecast scripts for PWS_Dashboard.

Wim

The EC-forecast for PWS_Dashboard are in test also.
Visit the discussion here: https://discourse.weather-watch.com/t/ec-forecast-not-working/75469/7

Regards,
Wim