WXSIM "EWN-style"

[quote]
You mean the moon should need to be rotated 180

Hi
I am having the same problem runarbg and have tried various path configs but the best I get is the date and time of lastret.txt in my root folder
have spent 4 days trying to get it to work and even tried it on my hosted server http://www.hc-iom.co.uk/wxsim2/forecast.php but got the same result and the buttons do not work either not sure what else to try.

Zip updated

  • added check for UTF8 for the plaintext description-text. As i can’t re-produce this issue on my server is it a bit a shot in the dark :wink:
  • moon-icon rotated if $latitude < 0
  • new config $path_to_dataphp. I used a auto-detection for this but it seems it did not work on all servers (ie on my own it worked just fine). A guess, its this why it not worked for ie runarbg.

// Henkka

Henkka,
I tried the latest but still no description.
I load the files to /ewntest folder so I changed the config file to
$path_to_langfiles = “/home/shermanc/public_html/ewntest/wxsim/wxsim/”;

I assume the plaintext-parser-data.php is the language file I need?

Thanks,
Tom
Edit: Ran plaintext.php and I got these errors:
Notice: Undefined variable: path_to_lastret in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 10
Notice: Undefined variable: lang in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 12
Notice: Undefined variable: lang in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 12
Notice: Undefined variable: lang in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 22
Notice: Undefined variable: lang in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 23
Notice: Undefined variable: Status in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 23
Fatal error: Uncaught Error: Call to undefined function fixtemp() in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php:112 Stack trace: #0 {main} thrown in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 112

Edit2:
After some changes only error is:
Fatal error: Uncaught Error: Call to undefined function fixtemp() in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php:112 Stack trace: #0 {main} thrown in /home/shermanc/public_html/ewntest/wxsim/wxsim/plaintext.php on line 112

Thanks, Henkka. I will try it tomorrow. Already midnight here…

Hi
just tried the latest version but no joy
http://www.hc-iom.co.uk/wxsim2/forecast.php has lots of error text only on it
http://www.hc-iom.co.uk/wxsim2/forecast1.php has “error_reporting(0);” in the first line of php and that displays the page, some scripts require this to run on my hosts server.
if I run the plaintext.php http://www.hc-iom.co.uk/wxsim2/wxsim/plaintext.php I also get error text only on the page has full path in as in config
if I run the data.php http://www.hc-iom.co.uk/wxsim2/wxsim/data.php I get the option to download a data.json file which has data in it
have attached config file

Harold


config - Copy.txt (10.8 KB)

Henkka,
I changed my php version from 7 to 5.6 and the description works.

Thanks Henkka and Tony for all the help.

Tom

One thing I notice with rain on the graph with inches is so small it just has the value and too small to graph.
Can see on mine:
http://www.shermanctweather.org/ewn/wxsim/forecast.php

I installed the new version and it’s still only spinning, just like the previous version :frowning:

Hi guys,

I changed my php version from 7 to 5.6 and the description works.

GOOD found! Seems the darn PHP 7 gives some errors here. I have PHP 7 running on a dev-domain so lets do some testing on that. I runned euweather.eu on PHP7 for a moment too but it caused all kind of oddities so i reverted back to 5.6.

I installed the new version and it's still only spinning, just like the previous version

Runar, URL to the page?

I assume the plaintext-parser-data.php is the language file I need?

plaintext.php need it, yes.

I guess we have a problem with the darn error-reporting not being properly shut off (data.php have error_reporting(0)), recent versions of PHP pushes out an enormous amount of all kind of junk notices if it is not shut off.
Data.php can be called directly as it parses the data and send it as JSON to the script. Plaintext.php can not as it lies on some functions from data.php.

// Henkka

Here is my test page, Henkka. All paths looks to be working? http://runarweb.com/forecast_test.php

More testing. I have traced and I see that the javascript wxsim_frc_2017.js is run. But I’m not sure if data.php is run. At least no trace info is displayed. And the path to data.php looks very correct.

I

One thing I noticed with rain in inches is on forecast day shows amount of rain but on Overview doesn’t show any rain.
I’ve attached a picture of what I mean.

Tom


Zip updated again.

I maybe found the problem for “null” in descriptions. I runned it on PHP7 and it re-produced that error.

It loads data.php, but its empty. I got a such case once and at least my server generated an error_log in the wxsim-directory then what described the problem. This with error_reporting set to 0 in the scripts. My problem was that data.php did not found the lastret/plaintext. Do you get any error-reports?

There is someting wrong (or intended(?) with the wind speed in the shortforecast and also in the table view for the specific day. As you can see in the overview, we are expecting windy weather the next couple of days. The windspeeds showing in the overview are matching to the plaintext forecast, but the shortforecast above, is showing lower speeds. Is this value an average?

Strange error, it looks like overview winds are multiplied twice. It gots also “fixed” if change wind-unit in the unit-gear. Could you post your lastret+plaintext and i will give it a try to get that oddity re-produced?

One thing I noticed with rain in inches is on forecast day shows amount of rain but on Overview doesn't show any rain. I've attached a picture of what I mean.

A guess, plaintext.txt have no precip while lastret.txt have a trace of it, enough to show up in the data.

Sure, here they are.


plaintext.txt (3.35 KB)

lastret.txt (72.6 KB)

Hennka,
I’m assuming the overview section is taken from plaintext.txt.
You can see from picture that a quarter inch rain only shows .01 precipitation.
Tom


Hi Henkka,
If it’s of any use, in order to get mine running at the start I found the following issues and modified as follows: (maybe others are having the same).

In the latest version I kept all changes except for :
1: frc.php about line (88) retained the original str_replace as the new “$path_to_dataphp = “wxsim”;” in config.php and ewnpath=“‘.$path_to_dataphp.’” in frc.php did not work for me.

$ewnfooter.='
  name="'.$wxsimlocation.'",lang="'.$lang.'",tzabb = "'.$tzabb.'",version='.$wxsimversion.',ewnpath="'.str_replace($_SERVER["DOCUMENT_ROOT"],'', str_replace('\\','/',__DIR__ ) ).'",latitude='.$latitude.';

2: frc.php Lines about lines (66,67,93) I found also did not work from the start so I hard coded the paths to my locations (‘.$path_to_css.’) and (‘.$path_to_css.’) and (‘.$path_to_js.’). Must be a php version thing !

<link rel="stylesheet" href="'.$path_to_css.'wxsim_2017.css?'.$wxsimversion .'" />
<link rel="stylesheet" href="'.$path_to_css.'weather-icons.min.css?'.$wxsimversion .'" />';

<script src="'.$path_to_js.'wxsim_frc_2017.js?'.$wxsimversion .'"></script>

3: I noticed some users who have the script running now that UVi is included, do not have UV checked in wret, they get UV on the Overview tab ok as it comes from the plaintext.tx , though nothing is displayed on their tables as it comes from the Lastret.txt.

4: Thank you so much for the Southern Hemisphere Moon Rotation, I admin I am not knowledgeable about the calculations, though the result in my case was incorrect in that the fraction / phase image once rotated was not correct. so I played with it and although may be way wrong with what I changed (does display from current out 9 days correctly).
I have added the change I made below (again may well be wrong) but works thus far for me. Would appreciate an expert give some context.
In data.php from Line (213), I added Latitude switch for Southern Hemisphere.


  $moonphase = $sunmoon->getMoonIllumination();
  if($latitude>0){
  $ma=round($moonphase[phase]*28)-1;
  }else{
  $ma=round($moonphase[phase]*28)+1;
  }
  if($ma==28){$ma=27;}
  $ddata[$da]["moonage"] = $ma;

  date_default_timezone_set("UTC");

  $temps=$clouds=$wspds=$wdirs=$pops=$tsrisks=$ics12h=$icno12h=$ics12hna=$icno12hna=array();
  $precs=0;
  date_default_timezone_set($tzabb);
  $day++;
}

Kind regards,

I'm assuming the overview section is taken from plaintext.txt. You can see from picture that a quarter inch rain only shows .01 precipitation.

Aah, didn’t read the description…Hmmm…I guess the parser do not read that quarter as rain at all.

Tom,

Good stuff. What you described are the “big problem” with scripts like this, there are many templates and many home-brew sites and all use at least somewhat different setup. One thing works for some and not work for some. One reason for why i concentrated all css,js,etc-files to around top of, in this case frc.php, are so its easy to modify/manage them.

Thank you so much for the Southern Hemisphere Moon Rotation, I admin I am not knowledgeable about the calculations, though the result in my case was incorrect in that the fraction / phase image once rotated was not correct. so I played with it and although may be way wrong with what I changed (does display from current out 9 days correctly).

The phase output of the sunmoon-script are from 0 to 1 and because the css for the moon-icon are from 0 to 27 had i to do that chewing-gum conversation :wink:
btw. i found an issue with that script when tryed to add it to the EWN-forecast and tested it for this place. $moontimes[“moonset”]->format(‘H:i’); cause a fatal error when moonset are after midnight at 03. March. When looked deeper in the output of the script was there no moonset defined at all for that day…Hmmm…

That is correct, there is no moonset on March 3rd :lol: The moon is a very tricky thing to reduce to a simple graphic :frowning:

When I turn on errors, these are the only ones that I see:

Notice: Use of undefined constant lang - assumed ‘lang’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/config.php on line 61
Notice: Undefined index: lang in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/config.php on line 61
Notice: Use of undefined constant ewnwunit - assumed ‘ewnwunit’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/config.php on line 313
Notice: Undefined index: ewnwunit in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/config.php on line 313
Notice: Undefined variable: uploadupdate in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 24
Notice: Use of undefined constant lang - assumed ‘lang’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 43
Notice: Use of undefined constant ewnwunit - assumed ‘ewnwunit’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 56
Notice: Undefined index: ewnwunit in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 56
Notice: Undefined variable: ewnfooter in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 73
Notice: Use of undefined constant SNOB - assumed ‘SNOB’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 90
Notice: Use of undefined constant RRATE - assumed ‘RRATE’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 90
Notice: Undefined variable: alt in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 99
Notice: Use of undefined constant COMPAREDESC - assumed ‘COMPAREDESC’ in /customers/0/a/0/runarweb.com/httpd.www/wxsim_ewn/wxsim/frc.php on line 236