Modifications to WxSIM 3in1 Forecast Script

After upgrading to the latest version of the WxSIM 3in1 Forecast script, I noticed several items that didn’t appear “tailor-able”. After digging through portions of the script, I believe I’ve found where making slight changes to the code has made the output more like I wanted. I thought I’d share my findings if you’re interested.

  1. The first item I noticed was that forecast graph showed only 3 days. I found where the number of hours displayed on the graph is set in wxall.lastret.php on line 414. The current value of 74 represents 74 hours (slightly more than 3 days). If you want a longer timeframe shown, simply change 74 to a value of your liking.

The next items apply to those using Farenheit degrees and inches of barometric pressure.
2) On the right side of the forecast graph where the barometric pressure is shown, it appears “hpa” is hard-coded even though the units used is inches. This can be changed by going into the wxsim.js file and changing "hpa’ to “in” on lines 124 and 148.
3) In this same portion of the graph, the range shown for barometric pressure is not only excessive, but the values are impossible to reach. To have a much more reasonable range, go into the wxsim.js file to line 137 and change the value for allowDecimals to “true”.

The final items have to do with the Compare tab. This graph compares WxSim forecasts to YR.NO forecasts. Unfortunately, my WxSim forecasts are shown in Farenheit and the YR.NO forecasts are shown in Celsius, making the comparison pretty useless. So far, I’ve not been able to find a way to get the YR.NO forecast in Farenheit, so I’ve chosen to just turn off the Compare function. Here’s what I did.
4) In wxall.lastret.php on line 660, I simply deleted this entire line. This removes the Compare tab from the graph.
5) I determined that wxall.lastret.php reads the YR.NO data from a cache file if it is recent, otherwise, it gets the latest data from YR.NO. The default refresh period for the cache file is 1 hour (3600 seconds) that is set in line 790 of wxall.lastret.php. Since I have no need for the YR.NO data being current, I’ve set the value for $fetchSeconds to be 604800. That way the cache isn’t getting updated but once a week since it’s not used at all. I’m sure I could have completely disabled getting any data from YR.NO, but I was trying to modify only values instead of changing code if possible.

You can see the results of these changes on my test page here:http://www.tylertexasweather.com/ttwfcast2.htm

Steve

Thanks for the heads up about these issues, Steve.

I’ve been able to display up to 144 hours, but no more by modifying wxall.lastret.php’s $hr1<xxx parameter. There is another instance of $hr1<72 which I also changed to $hr1<144.

The other mods are very useful and sorely needed because of the absence of some optional units configuration and a marginally helpful barometric range.

Thanks to you my Compare tab is gone, and I’ve set the cache to refresh after 2592000 seconds, 30 days, since it isn’t used.

Still missing the precipitation bar graph :frowning:

I have been trying to display Precipitation since January using the Late Dec 14 version 3 in 1 script.

I pushed it out to 173 hrs in January but could not display Precipitation past the 74 hr mark.

Finally worked it out see what you think;

New (Standalone) : http://hrvistaweather.com/wxsim_wxall/sivu2.php and in Saratoga : http://hrvistaweather.com/wxsimforecastall.php - uses Lastret.txt
Old (Saratoga) : http://hrvistaweather.com/wxsimforecastSA.php - uses Lastret.txt
Original (Standalone) : http://hrvistaweather.com/wxsim_meteo.php - uses Latest.csv
Old (WXSIM2GRAPH) : http://hrvistaweather.com/wxsimgraph.php - uses Latest.csv

I love the older original though as it uses Latest.csv, which during DST throws it out 1 hour which I’ve not got around to looking at yet.

New (Saratoga WsWxsim) : http://hrvistaweather.com/wxsimforecast2.php - using Latest.csv


Have you noticed that when you scroll over the precip it goes from 0 to whatever the amount is, it keeps showng the 0
amount, it does it on all that i have seen

Hi Bashy,

Yes been all over that, not found a fix yet. At least it ends after the 3 hr Bar period showing the Precip Correctly for the previous 3 hr period.

Off to bed now too late - may look at it over weekend, would really prefer to push the Latest.csv or Lastret.txt into MySql and run the Highcharts via views / queries same as I do with other site data including Soil and Temp Compare data.

Had a few goes at it but failed each time, will keep trying.

Extended it out a little further.


Mine has rectified itself re the precip showing on and off, Must be a setting i have changed in wret???

How did ya manage to get all those days to fit in nicely, when i added a week i think it was all the wind
arrows were too close :confused:

Hi Bashy,

In “wxall.lastret.php”

Line: 344 and 347 From;


    if(date("i",$line[time])=="00"&&$hr1<74){
      $jst = (($line[time]+$utcdiff)*1000);
      $precjson[]= array($jst,round($line[prectot],1));
      $prectip[(string)$jst-7400000]= round($line[prectot],1);
      $prectip[(string)$jst-360000]= round($line[prectot],1);
      $prectip[(string)$jst]= round($line[prectot],1);

To whatever you want; Below 222 does 9 Days (WXSIM has to be changed to 9 Days - although it only optimises 144hrs)


    if(date("i",$line[time])=="00"&&$hr1<222){
      $jst = (($line[time]+$utcdiff)*1000);
      $precjson[]= array($jst,round($line[prectot],1));
      $prectip[(string)$jst-22200000]= round($line[prectot],1);
      $prectip[(string)$jst-360000]= round($line[prectot],1);
      $prectip[(string)$jst]= round($line[prectot],1);

and Line 414 From;


  if(date("i",$line[time])=="00"&&$hr1<74){

To same as above change;


  if(date("i",$line[time])=="00"&&$hr1<222){

regards,

Cheers Tony, strangely it didnt change the graph :o
http://www.suffolkweather.info/index.php?p=918&lang=en

Hi Bashy,

Not sure how you will go with this I use 99% for main width.

On Line 36;


# widths
$mainwidth = "99%";					# width of whole container

Hi everybody

My website http://bestpalm.pl/pogoda/wxnewpage.php
J have read this post and try to see precipitation on my graph but still no raining on the graph, enclosed my wxall.lastret.php. What can be wrong?


wxall.lastret.txt (36.8 KB)

Hi Fuzzy,

In the 3in1 package there should be a graphic image of wret settings - looks like you have not checked all boxes correctly in wret.exe

The Precipitation you see on your “overview” page below the meteogram is obtained from the “Plaintext.txt” file that’s ok and working, but the meteogram and other hour by hour pages etc obtain data from the “lastret.txt” file which in your case is missing PTOT “Precipitation Total” because you obviously do not have it checked in Wret.exe

Jerry,

I believe I’ve finally figured out how to get precipitation to show on the graph. I’ve replaced the code in wxsim.js starting at line 126 through 138:


  var tempoptions = {
    chart:{renderTo: "placeholder",spacingTop:4},
    xAxis: globalX,
    yAxis: [{ // Temperature
      title: {text: null},labels: {format: '{value}

Thanks, Steve!

I changed the precipitation section of ‘var tempoptions = {’ from

    },{ // precipitation axis
      title: {text: null},labels: {enabled: false},gridLineWidth: 0,min:0,minRange:10,tickLength: 0

to your code

    },{ // precipitation axis
      title: { text: preciptitle,offset: 10,align: 'high',rotation: 0,style: yTitles,textAlign: 'right',y:-5},
	  labels: {enabled: true,style: yLabels,y: 5,x: -8},gridLineWidth: 0,min:0,tickLength: 0,allowDecimals: true,tickInterval:0.1

and Voila!, the bar graphs now appear! =D>

Thanks a lot for help. It was my mistake. On wret was unclick precipitation.