cloudy cloudy

Author Topic: WxSim Temperature Forecast Comparison Script  (Read 174339 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Global Moderator
  • Posts: 5,685
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
    • Saratoga Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #15 on: February 12, 2009, 03:22:00 AM »
I've got it working too .. used a crontab entry to fetch the log once daily (so there's only one entry in mine so far).

http://saratoga-weather.org/WXSIM-stats.php

After I get a few days of data, I'll add it to the menu .. been wanting to watch these stats for quite a while.

Thanks again Jim for the great script!

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline pinto

  • Posts: 766
  • Belgium
    • weather station Kampenhout
Re: WxSim Temperature Forecast Comparison Script
« Reply #16 on: February 12, 2009, 08:12:19 AM »
I'm having a little issue/trouble mainly with my mind and a little with the script. Trying to do an am/pm log and for now using the poor man's method of using the web address to update the log. I've made two fc-configs, one am one pm with corresponding logs and uploaded them. This morning's upload went smoothly but this afternoon' wiped this mornings data and said 'this forecast has already been run". I did run a new WXSIM forecast which now shows in both charts as 2:35pm.

So am I calling the script incorrectly? Here is a snippet of the code I'm using;

Code: [Select]
$_REQUEST['config'] = 'fc-configam.php';       // It will default to this one if this isn't included
$_REQUEST['lang'] = 'en';                   // This will default to English if not included
include("forecast-compare-include.php");

$_REQUEST['config'] = 'fc-configpm.php';       // It will default to this one if this isn't included
$_REQUEST['lang'] = 'en';                   // This will default to English if not included
include("forecast-compare-include.php");

So am I improperly calling the script or improperly calling the wrong web addresses?

Thanks,

Jack

Here is where the script is running....http://stillweather.com/nuforecast_compare.php



I'm testing this with am and pm.
notice, when you are running the latest version(1.1), you have to call the script with the allowed config-files.
in forecast-compare-include is the folowing(whitch you can edit)
Code: [Select]
$allowed = array (                 // You can add additional configuration file names here
  'am' => 'fc-configAM.php',
  'pm' => 'fc-configPM.php'
);
so, I'm calling the script like this:
Code: [Select]
forecast-compare-include.php?log&config=am
forecast-config-compare.php?log&config=pm
if you don't do it like this, you end up using fc-config.php, and not with the configurations you want.

you can call the different logs with:
Code: [Select]
$_REQUEST['config'] = 'pm';
$_REQUEST['lang'] = 'en';
include("forecast-compare-include.php");
      

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #17 on: February 12, 2009, 11:48:58 AM »
Jozef,

I'm calling for it to log with

forecast-compare-include.php?log&config=fc-configAM.php

and I thought it was working that way, but will double check today.  It could be that I misunderstood Ken's code and need a change in the documentation.  Your way is cleaner looking anyway.

Jack, if you're still having trouble try Pinto's forecast-compare-include.php?log&config=am

Thanks.  - Jim
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline BfdWx

  • Posts: 1,605
  • Branford Connecticut
    • Southern CT Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #18 on: February 12, 2009, 12:38:37 PM »
Code: [Select]
forecast-compare-include.php?log&config=am
forecast-config-compare.php?log&config=pm

Now I'm getting confused again...LOL. Looking at the above code there are two different ways "forecast-compare-include" and "forecast-compare-include"?

I just ran the forecast this am and for some reason it added an extra spot for today (am) which is blank. In order to get it to work this is what I had to do, and it's probably wrong. I made two "forecast-includes" one for am one for pm, so my code looks like this now;

Code: [Select]
    <td align="center">
        <h3>WxSim &amp; NWS Forecast Comparison AM</h3>
        National Weather Service (NW), Actual Observed (Act), WxSim Generated (WS)
        <br />
        <?php 
        $_REQUEST
['config'] = 'fc-configam.php';
        include(
"forecast-compare-includeam.php");
        
/*          
        echo "\n";
            $_REQUEST['config'] = 'fc-configWU.php';  // Example of how to force the use of an alternate configuration file
            include("forecast-compare-include.php");
        echo "\n";           
            $_REQUEST['config'] = 'fc-configEC.php';
            include("forecast-compare-include.php"); 
        */          
        
?>

 </td>
      </tr>
</table>
  <table style="border:0;margin-left:auto;margin-right:auto;">

      <tr class="table-top">


    <td align="center">
        <h3>WxSim &amp; NWS Forecast Comparison PM</h3>
        National Weather Service (NW), Actual Observed (Act), WxSim Generated (WS)
        <br />
        <?php 
        $_REQUEST
['config'] = 'fc-configpm.php';
        include(
"forecast-compare-includepm.php");
        
/*          
        echo "\n";
            $_REQUEST['config'] = 'fc-configWU.php';  // Example of how to force the use of an alternate configuration file
            include("forecast-compare-include.php");
        echo "\n";           
            $_REQUEST['config'] = 'fc-configEC.php';
            include("forecast-compare-include.php"); 
        */          
        
?>

It would only write to "forecast.log" without this change. So now I'm not sure about the above code, thanks for the help though Pinto, I'm sure we'll get this sorted!

Regards,

Jack

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #19 on: February 12, 2009, 02:13:49 PM »
Ok, I just had my morning run and the logging part went fine the old way, but the display part did not.  So, Pinto is right ... as always and here's what we have to do.  These assume that properly named log files are in place.

For logging

forecast-compare-include.php?log                    - will log to forecast.log by default
forecast-compare-include.php?log&config=am     - to log to forecastAM.log
forecast-compare-include.php?log&config=pm     - to log to forecastPM.log

For display in your web page

include("forecast-compare-include.php");           - will show forecast.log in the default English

$_REQUEST['config'] = 'am';
include("forecast-compare-include.php");           - will show forecastAM.log

$_REQUEST['config'] = 'pm';
$_REQUEST['lang'] = 'xx';                             - optional language
include("forecast-compare-include.php");           - will show forecastPM.log

Hopefully I have this right now and I'll change the readme and test file later in the day.  Thanks Pinto and sorry Jack.  This is what happens when a non-programmer makes changes without fully testing, I should know better by now.

- Jim
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline BfdWx

  • Posts: 1,605
  • Branford Connecticut
    • Southern CT Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #20 on: February 12, 2009, 03:45:38 PM »
No need to be sorry Jim this is a great script and working bugs out is actually fun, plus slowly I learn a little bit more! So I have changed my page to your new script and wiped the log files. Ran the new 'am' script and it seems to have worked OK. I'll run another forecast this afternoon for the pm and we'll see what happens but this seems to be the answer so far!

Thanks for all your hard work!

Jack

Offline pinto

  • Posts: 766
  • Belgium
    • weather station Kampenhout
Re: WxSim Temperature Forecast Comparison Script
« Reply #21 on: February 12, 2009, 04:22:33 PM »
Code: [Select]
forecast-compare-include.php?log&config=am
forecast-config-compare.php?log&config=pm
Sorry Jack,
Was in a hurry, you are right,must be(like Jim says)
Code: [Select]
forecast-compare-include.php?log&config=am
forecast-compare-include.php?log&config=pm

Edit: now i did it again:copy & paste the same(wrong) code #-o
now it's better

« Last Edit: February 12, 2009, 04:26:33 PM by pinto »

Offline Stuntman

  • Posts: 776
  • Hemet, California USA
    • Hemet Weather
Comparison for dummies...
« Reply #22 on: February 12, 2009, 04:44:04 PM »
I have this working.. as it was/is in the original package.. using the test-fc.php page..

Could somebody post, exacly, what I need to do to get a page that displays a morning and afternoon comparison on the same page?  I've used AutoIT to create a script that is scheduled, so I can update a log once a day.. won't be hard to run the same script twice a day.. but I assume I have to change it a tad to create two forecast logs?

Anyhow, if somebody could post a 'new' test-fc.php page that containst two forecasts, as well as post how to generate them individually, I'd love to give this a try!  Adding it to the templates will be a must, once I get it working.. and I believe Ken said he is working on that too!  Fantastic!!!!

Thanks all!


Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #23 on: February 12, 2009, 10:42:41 PM »
Stuntman,

Glad it's kind of working for you and sorry that I didn't get a chance to update the readme yet.  I have to work every Thursday and that's today.  For the logging you'd use:

forecast-compare-include.php?log&config=am     - in one of your autoit scripts
forecast-compare-include.php?log&config=pm     - and this in the other. 

forecastAM.log and forecastPM.log must be on the server write enabled.

In your web page you'd have something like this

$_REQUEST['config'] = 'am';
include("forecast-compare-include.php");           <!-- will show forecastAM.log -->
<br />
$_REQUEST['config'] = 'pm';
include("forecast-compare-include.php");           <!-- will show forecastPM.log -->

Now since you already had it running and logging to forecast.log, you can replace one of the above with

forecast-compare-include.php?log                     - will default to logging to forecast.log

Then to display, replace either the am or pm above with

include("forecast-compare-include.php");           <!-- no $REQUEST required, will show the default forecast.log -->

I'm kind of thinking I should have left the default option out of the equation, but it's there now.

Let us know how it goes.

- Jim
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline Stuntman

  • Posts: 776
  • Hemet, California USA
    • Hemet Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #24 on: February 12, 2009, 11:24:20 PM »
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!

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #25 on: February 13, 2009, 12:25:04 AM »
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
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #26 on: February 13, 2009, 12:52:00 AM »
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
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline BfdWx

  • Posts: 1,605
  • Branford Connecticut
    • Southern CT Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #27 on: February 13, 2009, 02:49:18 AM »
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

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,799
  • Mauston, WI, USA
    • Juneau County Weather
Re: WxSim Temperature Forecast Comparison Script
« Reply #28 on: February 13, 2009, 04:12:07 AM »
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
Forum Search and Google can be your best friends

 Home of NSLog NexStorm Lightning Data Manager

Offline jwwd

  • WML testers
  • Posts: 3,692
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: WxSim Temperature Forecast Comparison Script
« Reply #29 on: February 13, 2009, 08:36:49 AM »
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
« Last Edit: May 06, 2013, 05:25:23 AM by jwwd »