Author Topic: ec-forecast.php V5.00 beta -- it's all XML parsing now :)  (Read 3925 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #25 on: September 26, 2017, 11:44:56 PM »
Ahh... great minds, and all that...

I've finished working on the 24 hour forecast part too, and also found the 'magic sauce' to display the "Abnormal temperature trend" indicator in the temperature displays.

Still V5.00 - 26-Sep-2017 and beta, but it looks like it's very close to release.

Package:  https://saratoga-weather.org/wxtemplates/Canada/ec-forecast-V5-beta.zip
Script   :  https://saratoga-weather.org/wxtemplates/Canada/ec-forecast-V5.php?sce=view

See it at https://saratoga-weather.org/wxtemplates/Canada/wxforecast.php in the template
« Last Edit: September 26, 2017, 11:58:10 PM by saratogaWX »
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 PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #26 on: September 27, 2017, 12:18:08 AM »
Hi Ken and thanks,
New update installed and looks great www.komokaweather.ca/wxforecast.php


One thing I've just noticed is that the Averages and extremes table uses a different period depending on the EC site...
For my area:
Averages and extremes
Highest temperature(1940-2002)
29.4 °C
1998
Lowest temperature(1940-2002)
-1.1 °C
1947
For St Catherines:
Averages and extremes
Highest temperature(1971-2000)
29.3 °C
1998
Lowest temperature(1971-2000)
4.1 °C
1978
For Toronto:
Averages and extremes
Highest temperature(1938-2012)
29.6 °C
1998
Lowest temperature(1938-2012)
-3.3 °C
1965

I know you can drill down and get to more recent periods but that requires some manual clicking...
Note that more recent Averages and Extremes information for this location may be available. Please visit the Historical Climate Data's Almanac Averages and Extremes page.

Regards,
Paul

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #27 on: September 27, 2017, 12:57:35 AM »
Yes, each forecast location comes with it's own <almanac> section in the XML (implying that there's a forecast office that's been keeping daily data for that location).  I'm just decoding what's there and displaying it from the XML feed for that location.

This is unlike the US NWS api.weather.gov beta API which required me to do 3 fetches to fill out the data about a specific point forecast (some like the metadata are fetched once and cached).  The EC has an English and a French XML file, so I only fetch one file (and cache it) for a specific location:language pair.

With this 26-Sep-2017 beta, I've decoded all the available XML they provide for a location forecast.

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 WpgWeather

  • Member
  • *
  • Posts: 23
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #28 on: October 15, 2017, 10:32:47 PM »
I tried it out and it works great.
Now to just get rid of those pesky tables and replace them with DIV and CSS.  :grin:
Many thanks for your work. Greatly appreciated today but even more so the next time EC changes their layouts.
- Dale

Offline WpgWeather

  • Member
  • *
  • Posts: 23
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #29 on: November 07, 2017, 11:18:14 AM »
I tried it out and it works great.
Now to just get rid of those pesky tables and replace them with DIV and CSS.  :grin:
Many thanks for your work. Greatly appreciated today but even more so the next time EC changes their layouts.
- Dale
I see today that we have a wind chill but the script doesn't show that in current conditions. Not in the XML perhaps?

Sent from my LG-H831 using Tapatalk


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-forecast.php V5.00 beta -- it's all XML parsing now :)
« Reply #30 on: November 07, 2017, 12:38:39 PM »
D'Oh... you're correct, that code was missing.  Since the work was finished during the summer, I'd tested humidex display, but forgot about windchill.

Now corrected in V5.01 of ec-forecast.php (7-Nov-2017)

Standalone: update from the script page
Saratoga Template: use the update tool with a query of Base-Canada, Plugin-*, 07-Nov-2017

Thanks for spotting the problem!
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