Author Topic: WXSIM Chart  (Read 3275 times)

0 Members and 1 Guest are viewing this topic.

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 244
WXSIM Chart
« on: April 24, 2023, 05:55:30 PM »
I have this old script that I would love to keep using but it's getting the following deprecated errors. Can anyone help me fix the issues?

PHP Deprecated:  substr(): Passing null to parameter #1 ($string) of type string is deprecated in C:\inetpub\weathercat\wxsimchart\meteogram\highchart.wxsim.php on line 354
PHP Deprecated:  substr(): Passing null to parameter #1 ($string) of type string is deprecated in C:\inetpub\weathercat\wxsimchart\meteogram\highchart.wxsim.php on line 355
PHP Deprecated:  substr(): Passing null to parameter #1 ($string) of type string is deprecated in C:\inetpub\weathercat\wxsimchart\meteogram\highchart.wxsim.php on line 356

Here are the 3 lines of code.
var snowdata = ['.substr($snowjson, 0, -1).'];
var sleetdata = ['.substr($sleetjson, 0, -1).'];
var frzdata = ['.substr($frzjson, 0, -1).'];

http://www.weathercat.net/wxsimchart/
« Last Edit: April 24, 2023, 05:57:44 PM by Forever »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9722
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WXSIM Chart
« Reply #1 on: April 25, 2023, 12:39:37 PM »
It seems that the three variables aren't being set in prior code, so are empty values.
Try changing
Code: [Select]
var snowdata = ['.substr($snowjson, 0, -1).'];
var sleetdata = ['.substr($sleetjson, 0, -1).'];
var frzdata = ['.substr($frzjson, 0, -1).'];
to
Code: [Select]
var snowdata = ['.@substr($snowjson, 0, -1).'];
var sleetdata = ['.@substr($sleetjson, 0, -1).'];
var frzdata = ['.@substr($frzjson, 0, -1).'];
to suppress those Deprecated messages.

A better approach would be to preprocess the values, then you don't need to suppress the error messages

Code: [Select]
var snowdata = ['.empty($snowjson)?"":substr($snowjson, 0, -1).'];
var sleetdata = ['. empty($sleetjson)?"":substr($sleetjson, 0, -1).'];
var frzdata = ['.empty($frzjson)?"":substr($frzjson, 0, -1).'];
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 Forever

  • Senior Contributor
  • ****
  • Posts: 244
Re: WXSIM Chart
« Reply #2 on: April 25, 2023, 05:40:58 PM »
Thanks for the help Ken.

I'm getting the following when I try the better approach.

PHP Fatal error:  Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in C:\inetpub\weathercat\wxsimchart\meteogram\highchart.wxsim.php on line 333

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9722
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WXSIM Chart
« Reply #3 on: April 26, 2023, 02:30:20 PM »
Ok... try
Code: [Select]
var snowdata = ['.(empty($snowjson)?"":substr($snowjson, 0, -1)).'];
var sleetdata = ['. (empty($sleetjson)?"":substr($sleetjson, 0, -1)).'];
var frzdata = ['.(empty($frzjson)?"":substr($frzjson, 0, -1)).'];
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 Forever

  • Senior Contributor
  • ****
  • Posts: 244
Re: WXSIM Chart
« Reply #4 on: April 26, 2023, 06:21:50 PM »
Thank You, that worked. :)

Offline meteothes.gr

  • meteothes.gr Administrator
  • Member
  • *
  • Posts: 31
    • Weather Live! at Thessaloniki Historical Center
Re: WXSIM Chart
« Reply #5 on: April 27, 2023, 03:55:10 PM »
Hi,

Where I can find the full script to download?

Thanks!
Weather Live! at the Historical Center of Thessaloniki
Central Macedonia - Northern Greece

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 244
Re: WXSIM Chart
« Reply #6 on: April 27, 2023, 07:01:09 PM »
The source for this old version disappeared long ago. Here is the link to the developers current offerings. https://www.nordicweather.net/phpscripts.php?en

I'm not sure if I'm allowed to zip up what I have to share it.

« Last Edit: April 27, 2023, 07:03:29 PM by Forever »

Offline meteothes.gr

  • meteothes.gr Administrator
  • Member
  • *
  • Posts: 31
    • Weather Live! at Thessaloniki Historical Center
Re: WXSIM Chart
« Reply #7 on: April 27, 2023, 11:56:34 PM »
Unfortunately, this script is no longer available, and the other scripts that I'm already using from Nordicweather no longer work in PHP 8. xx.

In PHP 7. xx are already working with many warnings and errors. The author is not around anymore to update the code, so I'm looking for something else to fix the meteogramm which is very nice and popular!

Anyway, thanks for the answer!

Thanos

https://meteothes.gr
Weather Live! at the Historical Center of Thessaloniki
Central Macedonia - Northern Greece

Offline vinesweather

  • Forecaster
  • *****
  • Posts: 382
    • The Vines Weather
Re: WXSIM Chart
« Reply #8 on: October 13, 2024, 01:37:08 AM »
Hi
Is there an updated script anywhere for WXSIM graphs please?
Thanks
Chris

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: WXSIM forecast with charts
« Reply #9 on: October 13, 2024, 05:55:11 AM »
Hi
Is there an updated script anywhere for WXSIM graphs please?
Thanks
Chris
There are multiple discussions on the "other" forum about WXSIM and the graphical scripts for WXSIM.
The following 2 links point to the 8.x versions of the NordicWeather wxsim scripts:
WXSIM "EWN-style" for php8

Wx3in1 Script Running on PHP 8.x

Also my own Leuven forecast scripts include a WXSIM plaintext a graphical version version using latest.csv or lastret.txt
All Leuven forecast scripts  are PHP 8.2 & HighCharts 11.3 compatible.
Check the demo and download at: Leuven v4.14 forecast scripts 2024-08-07

Succes,
Wim
« Last Edit: October 14, 2024, 10:40:46 AM by wvdkuil »

Offline meteothes.gr

  • meteothes.gr Administrator
  • Member
  • *
  • Posts: 31
    • Weather Live! at Thessaloniki Historical Center
Re: WXSIM Chart
« Reply #10 on: October 15, 2024, 12:53:21 AM »
Thanks Wim!

Everything works fine now (php 8.1.30)!

Your scripts are great! One thing only. The scripts work only when the wxsim files, are located at the root path (../) only, not another directory like ../wxsim/!

I've even used the full absolute path like /home/user/public_html/wxsim/ with no result! It should work! :roll:

Thanos
Weather Live! at the Historical Center of Thessaloniki
Central Macedonia - Northern Greece

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 2082
    • My PWS at Leuven Belgium Europe
Re: WXSIM Chart
« Reply #11 on: October 15, 2024, 04:04:59 AM »
The scripts work only when the wxsim files, are located at the root path (../) only, not another directory like ../wxsim/!
Yes, it was assumend in the early days of WSIM scripts that tall data and scripts were located in the root.

It should work if you modify the lines which points to the location.
Script wsFctWxsimDPage.php for the complete page with the grpahs.
Script wsFctWxsimPPage.php for the plaintext page

Line 39 now reads
Code: [Select]
$wxsim_files_dir        = '../';    Change that to
Code: [Select]
$wxsim_files_dir        = '../wxsim/';     
But  a  modified version of the Saratoga WXSIM plaintext-parser from Ken True is used.
I forgot   :shock: to update the location in that script also. Script ./wsfct4/pp/plaintext-parser.php line 132 now reads
Code: [Select]
$plaintextFile = '../../plaintext.txt';  ######     // location of the WXSIM plaintext.txtChange that to
Code: [Select]
$plaintextFile = '../'.$wxsim_files_dir.'plaintext.txt';  ######  2024-10-15   // location of the WXSIM plaintext.txtI attached a zip of that script.  Unzip and replace the currenty version in the ./wsfct4/pp/  folder.

Succes,
Wim


« Last Edit: October 15, 2024, 04:06:48 AM by wvdkuil »

Offline meteothes.gr

  • meteothes.gr Administrator
  • Member
  • *
  • Posts: 31
    • Weather Live! at Thessaloniki Historical Center
Re: WXSIM Chart
« Reply #12 on: October 15, 2024, 04:47:51 AM »
Thanks Wim!

That did the trick!!!  [tup]

Thanos
Weather Live! at the Historical Center of Thessaloniki
Central Macedonia - Northern Greece

 

anything