WxSim Temperature Forecast Comparison Script

Wow… that really confused me! Not much of a web programmer I guess! Can you package one that has this all configured… an am/pm and a test-fc.php page that shows both? All I’d need to change is timezone… I’ve tried what you posted but I get either an error stating the config doesn’t exist or that it has already logged… neither of which should be the case as I do have the log files and it has never logged…

I’m sure I’m just missing something simple, but not being a coder, I don’t see it!

Thanks… and sorry to be a pain!

Stuntman,

I’ve just put a new readme.txt and test-fc.php in the .zip file along with a new language file that has a minor change to it. I’m hesitant to clutter up the .zip file with extraneous configs and logs because that will probably confuse things further.

Make two copies of forecast.log and name one forecastAM.log, the other forecastPM.log and upload those to the server. They will overwrite any old ones that you might have on there.

Then make two copies of fc-config.php and name one fc-configAM.php and the other fc-configPM.php. In fc-configAM.php change $fcstLog = “forecast.log”; to $fcstLog = “forecastAM.log”; and in fc-configPM.php do the same, but make it “forecastPM.log”.

Upload those then use the new code in test-fc.php to put in your web page and all should work.

Let’s see how that goes.

  • Jim

Stuntman,

I changed my mind and added those files to the .zip, and test-fc.php (or the code in it) should work along with them.

  • Jim

Hi Jim,

One minor issue I’m trying to overcome, the ole validation problem. On your regular page your site validates, on the sample in the package you get the same errors I’m getting. It appears calling the script in the page twice screws things up. I’ve actually found a work around which validates but it involves uploading the forecast-compare-include script just with a different name, but I think this will be confusing to others as it changes the log call too! So anyway what is your trick on your page that allows it to validate?

Thanks,

Jack

Jack,

I’m not sure, I’ll have to take a look. I’m having some different problems which may be what is happening to Stuntman that I have to figure out too. I tried to add two more forecasts, and am now having trouble getting any other than the very first to display. I suspect all of this may be related. Might need a little sleep first, but we’ll get it.

Thanks. - Jim

Hi Jim

Im not sure the script is working correct - it seems that WXSIM (SL) and Wunderground (WU) MAX and MIN are in the wrong place.

MAX should be MIN and vice versa.

Would you take a look here and see if you agree with me:

http://www.silkeborg-vejret.dk/english/sammenlign.php

Thanks

Best regards,

Henrik

Henrik mine is the correct way round, however mine are all positive numbers so I wonder if the script is not correc tly checking the negative values?

On a slightly different thought, I have asked Brian (in suggestions) for a new %mintempovernight% tag which is from 6pm to 6am (the current one if for folks with 9am reset which runs from 9pm to 9am) so we can use it in the compare script. The reason for this is that I do have overall min temps which happen in daytime especially in winter and that’s not a fair comparison with a forecast which is predicting an overnight low…

Stuart

Henrik,

I just looked at your data for today and it appears that the WU highs/lows are correct, but the WxSim ones are backwards. Is that what you’re seeing? Is it possible that you’re running this script before the new plaintext.txt has been uploaded to the server? If that were the case, the first item found from plaintext-parser would be a low and things would be out of sync. The differences from actual seem to be calculated correctly with the negative temps, so that is good.

That makes me realize something though, right now this is a “daytime forecast only” script.

Thanks. - Jim

Hi Jim

Thanks for your reply.

You are right - its my WXSIM that are backwards.

I upload plaintext.txt 6 times a day - and I have setup a cronjob to run the compare script every night at 23.11 (1 hour after last upload of plaintext.txt)

I upload plaintext.txt at 04,07,10,13,16,19 and 22 hour.

Am I doing something wrong?

Best regards,

Henrik

Jack,

I figured out what this problem is, we can’t use the selectors more than once on a page, so you’ll have to turn them off in one of your configs. That’s ok because both of the scripts will react to the selector values anyway. Another possibility might be to put each of them in a different iframe. I haven’t tried that, but then they should be discreet I would think. The fixed size of the iframe might be a problem though unless you want scroll bars to show up.

  • Jim

Hi Jim,

Ok, I might use my “other” solution which is to rename the forecast compare include and then I just changed the id on the selectors. I’ll have to try your solution too. Thanks.

Jack

Henrik,

That won’t work because this script will only look at the current forecasts that the two systems are showing at that partucular time. You should set this logging to happen shortly after one of your plaintext.txt files has been uploaded. You can, however, set up to track more than one of these forecasts and we’re getting the bugs worked out of that. I hope to have an update out soon after I review the changes that I’ve made which are mostly documentation.

  • Jim

Hi Henrik,
May I say, it is not correct to do so.
First thing you have to know is: When is the forecast made for your location by WU.
Then you know at what time you have to run WXSIM and after that make the log.
Otherwise you are comparing a forecast made at say 01:00 with one made at 13:00
You have to make sure the two are made around the same time, else your comparison is not correct.

Hi Jim and Josef

Thanks for your replies - I will find a time that WU is updated and adjust my WXSIM to that time and then shortly after -I will run the cronjob.

In that way if should work - right?

Best regards,

Henrik

in my opinion, yes
BTW I’m trying to find the correct time to do so myself.

I set up a second logfile that logs everything every hour, so I can see when WU changes, then I will run WXSIM at that time and make the logfile

And you can also see that if I pick the right time, I can easily cheat 8O

When I enter the URL I use in the script for WU and display the page in a browser it shows at the top of the forecast the last updated time so it should be easy to sort out. In my case right now at 17:15 GMT it says last updated at 12:00 PM GMT.

Stuart

New version 1.2 has been posted to the .zip. It mostly clarifies the documentation and examples, and gets rid of the “vanilla” forecast.log example which was confusing to us all. That log is still supported in the script however. It won’t hurt to update your forecast-compare-include.php so we’re sure we’re all on the same sheet of music. I don’t think I made any changes to it other than a couple comments though.

Stuntman, can you give this a try when you get a chance? You’re really helping me debug the hardest part, the documentation. The documentation didn’t transition very well when I added the capability for multiple forecasts.

Two questions for those interested:

With multiple forecasts on a page, one selector set that changes all the forecasts on the page the same way (as it is now), or just change that particular forecast and leave the rest stay as they were? I think I can code it so they each use unique id’s so only that one would change, and also send a unique value so the page could return to a named anchor on the calling page if that were desired.

Is anyone going to want to track night forecasts? If so, I could swap the High and Low headings at a certain time if we know when the various forecasts transition.

  • Jim

Thanks for the extra work! Your extra notes and comments helped a LOT!!! I believe I have it working now (Will run @ 10:55 and 14:55) today… I’ll need to consider what are the best times for “Morning” and “Afternoon”… I’ll let you know how it goes!

Thanks again!

Jim,

I would go/stay with the one selector for all. I’m not sure the average visitor will mess with that too much anyway, would think the page owner will be doing most of the digging so to speak. I think I am going to make an unpublished page that will show the entire chart any way. It seems most that use the templates will have issues with showing huge charts too! Just my opinion its such a cool script that I look forward to filling the charts and looking at the data myself. BTW I would think the author of wxsim (Tom) would be interested in this script and the sites using it too!

Regards,

Jack

I agree with Jack over public pages, I dont intend to have one. I’ll be the one using the script to check on how my WXSim forecasts measure up, especially as I do have some WXSim forecast problems because of my location. I agree that this is something we should bring to Tom’s attention and maybe those of us who dont have publicly linked pages could let him have details if he wishes to access it.

Stuart