WXSIM "EWN-style"

Is there any possibility to display an additional warning triangle, whenever the forecast indicates to severe weather conditions?

Hi,
As I have no live website, just thought I would share my mods.
WXSIM “EWN-style” incorporated into Meteotemplate as a Block as i have to use Lastret.txt due to DST issues with Latest.csv.
Image 1: More Button closed
Image 2: More Button open
Thanks Henkka and Jachym.
regards,


Hi if you are like me and prefer to see the Snow Cast highlighted in Blue on the “Overview” see code addition below;

The code provided already allows for this in the initial files, however all that is missing is a setting in the config.php

Add a new line in config.php : $snow1color = true;

that’s it…


Guys,

I’m having a problem with addition spacing being added in the top part of the table. http://www.bearsbythesea.co.uk/wxsimforecast2.php

I have used one of my standard templates and just used include (‘wxsim/forecast.php’); in order to ensure the paths are correct (all my web page address are in the root folder).

I’m guessing its a template issue, but I cant work out why it is doing this?

Andy pointers as to whats wrong?

Many thanks

Andy

By using that stand-alone script inside your template page there are two sets of head and body definitions.
You can check yourself by (example with Chrome browser) right-click select show source.
This is the end of your menu html directly followed by an extra <html head and body tags.


      </div><!-- end leftSidebar -->
</div><!-- end doNotPrint -->	
<!-- end of menubar -->
 
  <!DOCTYPE HTML>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="//static.nordicweather.net/css/leaflet-0.7.3.min.css" rel="stylesheet"/>
<link href="//static.nordicweather.net/css/bootstrap_ewn.css?2017.03" rel="stylesheet"/>
<link rel="stylesheet" href="css/wxsim_2017.css?2017.03" />
<link rel="stylesheet" href="css/weather-icons.min.css?2017.03" /> <style>
body {background: #fff;color: #555555;font-family: "Ubuntu","Lucida Grande",Verdana,Helvetica,sans-serif;font-size: 13px;font-weight:300;line-height:1.25em;margin:0}
:focus {outline:0}

I think for less a browser is confused and does not know what you want.

Solution:
Us an iFrame and use this url http://www.bearsbythesea.co.uk/wxsim/forecast.php as the link in the iframe.
Than both your saratoga page and the wxsim page are handled indepently and both will display correctly.

Wim

P.S. The blank lines come from this directive somewhere in the EWN code

<div style="clear:both"></div>

If used inside a template page it forces the remaining html to start below the menu.
It should read

<div style="clear:right"></div>

when used in a Saratoga template.
But as I do not have the script itself, I do not know where that html code is located.
And there can be multiple other influences between Saratoga CSS and EWN css, Better use an iframe in these cases.

Thank you Wim. Followed your advice and used an iframe. Working now :grinning:

hi
I’ve a problem about transltaion from english to italian.
I’ve tried many settings but teh problem persists.
I’m using PHP 5.6.3
Below is reported a part of config.php
Have you any ideas
Thanks in advance

$wxsimlocation = "Genova Molassana"; # Your location $latitude = 44.46; $longitude = 8.97; $tzabb = "Europe/Rome"; $datestyle = "d.m.Y"; $timeFormat = "d.m.Y H:i"; # Timeformat $updatehrs = array(3,5,8,11,14,17,20); # Hours when wxsim runs $updateminute = 47; # minutes past full hour for upload time $jqueryload = true; # Should we load JQuery? (Set to false if your site loads it by default) $bootstrapload = true; # Should we load Bootstrap? (Set to false if your site loads it by default) $mainwidth = "100%"; // Use 100% for responsivity

$path_to_langfiles = “lang/”;
$path_to_lastret = “lastret.txt”;
$path_to_dataphp = “./wxsim/”;
$path_to_js = “…/wxsim/js/”;
$path_to_css = “…/wxsim/css/”;

$wxsimversion = 2017.03; # internal version

this is the link of the page; http://www.meteo-molassana.info/wxtest1/wxsim/forecast.php

Afasol3

Hi
I’ve solved the previous problem (added $lang=“it”; into the config.php ) but now have a new problem about precipitation.
Forecast precipitation for Wednesday is over 60mm but no value appears (NaN) and no mention is reported into the description section. (see attachment).
Have you any suggestion?
Thanks in advance
Afasol3


Hi Afasol,
i’ve already wrote to developer but i have no answer yet.
I’ve the same issue when rain forecasted is >50mm

https://i.imgur.com/9BvbcTR.png

Cheers,

Alessandro

Hello,

For several weeks I have been trying to configure the EWN forecast version for Wxim, but it does not work for me !!

I’m giving it a lot of thought and I can not find the solution, could someone help me, please?

The forecast page looks like this: http://meteohila2.esy.es/wxsim1/forecast.php

nothing appears!

I have installed the WXSIM folder in the root and I had to rename it with WXSIM1, since I have another folder with the same name

Next I indicate the link of my txt files:
[ http://meteohila2.esy.es/pronostico%20mxsim/lastret.txt](http:// http://meteohila2.esy.es/pronostico%20mxsim/lastret.txt)
http://meteohila2.esy.es/pronostico%20mxsim/plaintext.txt

Here I indicate my configuration of the config file:

$ wxsimlocation = “Xert, Valenciana”; # Your location
$ latitude = 40.52;
$ longitude = 0.15;
$ tzabb = “Europe / Madrid”;
$ datestyle = “d.m.Y”;
$ timeFormat = “d.m.Y H: i”; # Timeformat
$ updatehrs = array (5,10,15,20); # Hours when wxsim runs
$ updateminute = 14; # minutes past full time for upload time
$ jqueryload = true; # Should we load JQuery? (Set to false if your site loads it by default)
$ bootstrapload = true; # Should we load Bootstrap? (Set to false if your site loads it by default)
$ mainwidth = “100%”; // Use 100% for responsivity

$ path_to_langfiles = “wxsim / lang /”;
$ path_to_lastret = “/ home / u291478535 / public_html / forecast mxsim / lastret.txt”;
$ path_to_dataphp = “/ home / u291478535 / public_html / wxsim1 / wxsim”;
$ path_to_js = “js /”;
$ path_to_css = “css /”;

$ wxsimversion = 2017.03; # internal version

$ adblock = ‘’; # Box for showing ads on forecast front-tab.

IMPORTANT! Units in use, temperature, precip, wind, pressure, snowdepth, visibility

$ uoms = array (‘C’, ‘mm’, ‘kmh’, ‘hPa’, ‘cm’, ‘km’);

$ uoms = array (‘C’, ‘mm’, ‘km / h’, ‘hPa’, ‘cm’, ‘km’);

$ uoms = array (‘F’, ‘in’, ‘mph’, ‘inHg’, ‘in’, ‘my’);

Experimental POP-multiplier (POP in lastret * this value = POP).

Seems POP in lastret have low values ​​between 0 and 10. For “better” value of we multiple it with this value.

Change if needed.

$ popmulti = 10;

I do not understand too much about configurations, but I think the links in the files are fine …

Can you review it for me?

Next I indicate my url of the file data.php, where the errors can be observed:
http://meteohila2.esy.es/wxsim1/wxsim/data.php

thanks in advance,

Hi hila,

Please remove the spaces in the path of those lines. I just reproduced the cycling error, when I added spaces to path_to_js. Maybe that could be part of the problem.

EDIT: I also just noticed that your lastret time settings are ending on xx:58 and xx:28. I think that wxsim expects the time settings xx:00 and xx:30, to process futher with the script. But that is easy to fix. Please add in the data.php on the line 80

||is_substr($t,':00:58')||is_substr($t,':28'))

Maybe it will also work when you just add the first part with :00:58 or the :28 part, it

Hello,

thanks Marco for the answer

I have tried to remove the spaces in:

$ path_to_langfiles =“wxsim/lang /”;
$ path_to_lastret =“/home/u291478535/public_html/forecast mxsim/lastret.txt”;
$ path_to_dataphp =“/home/u291478535/public_html/wxsim1/wxsim”;
$ path_to_js =“js/”;
$ path_to_css =“css/”;

in the line: $ path_to_lastret = “/home/u291478535/public_html/forecast mxsim/lastret.txt”; (between the words I forecast mxsim) if you put a “_” does not work and you put a “% 20” does not work either I have to leave it so that you can see on the forecast screen the latest update …

I’ve also inserted this in line 80 of the data.php but I’m still the same …


config.txt (10.8 KB)

Use Chrome => right click => select inspect => check tab console

This is the error

Not Found
The requested URL /home/u291478535/public_html/wxsim1/wxsim/data.php was not found on this server.

This setting should be changed first

$path_to_dataphp = "/home/u291478535/public_html/wxsim1/wxsim";

You should first try

$path_to_dataphp =  "./wxsim/";

Wim

thanks Wim

I have already modified the path of the file:
$ path_to_dataphp = “./wxsim/”;

I attach the config document

it still does not work …


config.txt (10.8 KB)

That previous error is gone., data.php has run
Now the next one: Chrome => right click => inspect => console

forecast.php:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at wxsim_frc_2017.js?2017.03:104
    at XMLHttpRequest.request.onload (wxsim_frc_2017.js?2017.03:640)

These are the javascript lines

function getData(){
  var dpath = ewnpath+"/data.php?wunit="+wiset+"&lang="+lang;
  wget([dpath], function(points) {
    strData=JSON.parse(points);
    twidth=$("#plaintblhead").width();

The error message above tels us that /data.php has returned data with an Unexpected token <

That is for sure as when we test that call to data.php ourselves (all from the inspect window) : http://meteohila2.esy.es/wxsim1/wxsim//data.php?wunit=kmh&lang=en ,
this data is retuned (i removed a few more errors after the first ones):



<b>Notice</b>:  Use of undefined constant lang - assumed 'lang' in <b>/home/u291478535/public_html/wxsim1/wxsim/config.php</b> on line <b>62</b>




<b>Notice</b>:  Undefined index: ewnwunit in <b>/home/u291478535/public_html/wxsim1/wxsim/config.php</b> on line <b>285</b>



<b>Notice</b>:  Undefined variable: wxsimtype in <b>/home/u291478535/public_html/wxsim1/wxsim/config.php</b> on line <b>289</b>

{"plaintext":[{"time":"Tonight","temp":"4","tempRoundedColor":"rgb(167, 233, 50)","wdir":337,"wspd":0.83,"bft":1,"prec":"0","pop":0,"uv":"00","icon":"nt_clear","txt":"Clear. "},{"time":"Monday","temp":"14","tempRoundedColor":"rgb(244, 192, 11)","wdir":337,"wspd":1.11,"bft":1,"prec":"0","pop":0,"uv":"02","icon":"clear","txt":"Sunny. "},{"time":"Monday 

So you should find the setting which sets all messages on.
It are not errors, but notices and they can not be interpreted by the JSON.parse javascript.
If you switch error reporting off there will be no errors and the javascript will get the data starting with {“plaintext” and will parse it.

Up to the next problem.

Wim

ok thanks Wim,

Deactivated the error report, now in the data.php the description of the plaintext appears

http://meteohila2.esy.es/wxsim1/wxsim/data.php

It still does not work !! :frowning:

I can’t seem to get mine to work. All I see is a spinning circle
Any ideas?

http://wxcalgary.com/meteotemplate/wxsim/forecast.php

Same type of problem as above, but with warnings this time, check http://wxcalgary.com/meteotemplate/wxsim/wxsim/data.php?wunit=kmh&lang=en
Use Chrome => right click => choose inspect => tab console => check for errors.
You can use another browser, it will take different steps to get at the errors. After you solved the problem below, set error reporting to false.

In your case the data.php script is not returning data, at the bottom there should be a large chunk of JSON data.
This is the message:
Warning: file(…/wdUpload/plaintext.txt): failed to open stream:
No such file or directory in /home/wxcalg5/public_html/meteotemplate/wxsim/wxsim/plaintext.php on line 86

It tells us that good old plaintext.php could not load the plaintext.txt file.
Check the link to your plaintext.txt file, it probably is now …/wdUpload/plaintext.txt => “one step back from the executing script” / “folder wdUpload”

You have to add another …/ to that setting as the file is not one step back from
[font=courier]http://wxcalgary.com/meteotemplate/wxsim/wxsim/plaintext.php[/font] in
http://wxcalgary.com/meteotemplate/wxsim/wdUpload/plaintext.txt but two steps back in
[font=courier]http://wxcalgary.com/meteotemplate/wdUpload/plaintext.txt[/font]

Hang in for a while more, it will work as with others,
Wim

Oh yes :slight_smile: , it works partly already, just click on the tab “OVERVIEW” on your page http://meteohila2.esy.es/wxsim1/forecast.php
That tab displays the plaintext.txt data , check the attached screenshot of your site.

The other tabs should display the lastret.txt data and they are still empty as there seems no single line correct in your lastret.txt
The script processed all the lines and found no valid ones.

IF this is the file: http://meteohila2.esy.es/pronostico%20mxsim/lastret.txt
The reason for the empty tabs is clear: No single line ends at :00 as already explained by @tornadochaser
The scripts can only use the lines ending at the WHOLE hour. All other lines are skipped.

So change the settings in the wxsim programs to generate such data or ask Thomas Ehrensperger, the author of WXSIM, how to do that.
If that does not work for you, we can modify the script a little bit but I hate to change scripts of other authors.

But this will make the full page appear: wxsim/wxsim/data.php lines 22-24 reads now

$wxd = file_get_contents($path_to_lastret);
 
$prec6h=0;

change that line 23 so that those three lines read

$wxd = file_get_contents($path_to_lastret);
$wxd =  str_replace (':28',':00',$wxd); 
$prec6h=0;

[/color]

Then all data should be correctly displayed, see attached jpg with your plaintext.txt and lastret.txt on a users test-server.

Wim


Hi all,

I had the same problems but in one or another way I had it running. :slight_smile:
Very good explanations, Wim thanks.

What I still could not manage is the date at update (bijgewerkt) still 01/01/1970 (cannot find I suppose) see att.
http://www.weersverwachtingen.eu/clientraw/wd-ajax-ml/wxsim_ewn.php

Can you please give me a hint, Wim ?

Thanx so far !