Author Topic: WC-forecast.php script under development  (Read 3039 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WC-forecast.php script under development
« Reply #25 on: March 01, 2019, 04:17:03 PM »
Sure.. just run the script with ?force=1 to reload the cache.
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 miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4109
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: WC-forecast.php script under development
« Reply #26 on: March 02, 2019, 09:25:15 AM »
Is there a way to have the ajax-dashboard.php use the WC-forecast data instead of NWS? I tried changing things in the ajax page, but it kept showing the NWS data no matter what I did.

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WC-forecast.php script under development
« Reply #27 on: March 02, 2019, 11:35:31 AM »
Yep.. the updates to ajax-dashboard.php and wxforecast.php needed are included in the update tool distribution:

https://saratoga-weather.org/wxtemplates/updates.php  query for Base-World, Plugin-* 01-Mar-2019

BTW.. I updated the WC-forecast.php script to V1.01 this morning.  ConligWX had reported some odd display issues on his site.  Turns out I'd not completed the renaming of some variables from *WU to *WC so the $..WC control variables for HTML generation were not working correctly .. the result was full HTML generation (with <!DOCTYPE...><html><head>...</head><body..>... </body></html> wrapping the output even when $doIncludeWC was set.   D'Oh...  Now fixed in V1.01
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 ConligWX

  • Forecaster
  • *****
  • Posts: 843
  • #conligwx
    • conligwx.org
Re: WC-forecast.php script under development
« Reply #28 on: March 02, 2019, 02:11:41 PM »
Thanks Ken. All updated and working correctly.
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4109
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: WC-forecast.php script under development
« Reply #29 on: March 02, 2019, 02:48:46 PM »
I think that I am all set now. Thanks Ken.  [tup]

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline marko30

  • Member
  • *
  • Posts: 12
Re: WC-forecast.php script under development
« Reply #30 on: March 22, 2019, 04:01:32 AM »
Hello. I have also set it up.

The only error I notice is  degree sign (°).

In Slovenian, my native language it is showing ?
In English, there is no character
Only in Italian is working correctly.

Any thoughts?

my webpage: https://okroglovreme.com/wxforecast.php

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WC-forecast.php script under development
« Reply #31 on: March 22, 2019, 11:43:30 AM »
Ok, this was a fun one to track down.  In short, the TWC/WU API is returning the WRONG UTF-8 character for the degree sign.

They are using \xc2\xba instead of the expected \xc2\xb0.

From the UTF-8 definitions:
\xc2\xba is º MASCULINE ORDINAL INDICATOR (HTML º · &ordm;) (superscript letter o used in abbreviating words; varies with the font and sometimes underlined)
while
\xc2\xb0 is ° DEGREE SIGN (HTML ° · &deg;)

The two different characters may look alike, but iconv() function may not have the translation for the \xc2\xb2 symbol, so shows as a ?

Here's the fix -- change WC-forecast.php
Code: [Select]
$WCforecasttext[$n] = trim($FCpart['narrative'][$i]);
if($doIconv) {$WCforecasttext[$n] = iconv($charsetInput,$charsetOutput.'//TRANSLIT',$WCforecasttext[$n]);}
to
Code: [Select]
$WCforecasttext[$n] = trim($FCpart['narrative'][$i]);
$WCforecasttext[$n] = str_replace("\xc2\xba","\xc2\xb0",$WCforecasttext[$n]); // fix wrong degree symbol
if($doIconv) {$WCforecasttext[$n] = iconv($charsetInput,$charsetOutput.'//TRANSLIT',$WCforecasttext[$n]);}
and that should do it.
« Last Edit: March 22, 2019, 12:23:29 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 saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WC-forecast.php script under development
« Reply #32 on: March 22, 2019, 12:30:00 PM »
I've released WC-forecast.php V1.04 22-Mar-2019 with this fix.

Thanks Marko for spotting this subtle error.
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 weather34

  • Forecaster
  • *****
  • Posts: 1068
    • https://weather34.com/homeweatherstation
Re: WC-forecast.php script under development
« Reply #33 on: March 29, 2019, 12:57:44 AM »


thank you for this I had been using this image listing to create all the icons ..very useful many thanks Brian