PHP Extraction of WD Avg/Ext HTM Files

Hi again Mike

Thanks - didnt see that :oops:

I have noticed for a while that the graph of the last day always is the day before the last day - ie. if you click the graphs for day 4 of April - you see the graph from April 3rd.

Same thing with all the monhts.

http://www.buskelundtoften.dk/vejret/english/rapporter.php?report=200804&size=1

What can be the problem?

Best regards,

Henrik

I would have to see the code from your AvgExtract.php file because I think the problem is in it.
Probably caused something you changed because my site does not have that problem
http://www.carmosaic.com/weather/monthly-stats.php

Hi Mike

Thanks for your reply.

Would you have a look at my script?

Its attached as a .txt file. (My English version)

Your help is very much appreciated.

Best regards,

Henrik


avgextract.php.txt (13.8 KB)

Hi Mike i’m have the same problem
i am use the script as it was posted here

http://98.215.242.116:8080/wx11.php
thanks Beau

I’d kind of hold off a lot of script changes until the changes to the new output file is finished.

There are still some issues with the update that I assume Brian is going to address and when he does, the format of the output page may change further.

There still are some very basic HTML tags missing and in the wrong order that could make parsing an issue.

In a way, it would be nice if the output was simply a plain text file (April2008.txt) with no HTML in it at all. It would make parsing it a lot easier and then the user can format the output the way they want to using their own style settings.

Henrik,

here is a possible fix for your file, i also added in the compatibility changes you need for the latest WD.
Kevin is correct, more changes in WD might break something, but for now, try this.

Edit: removed the attachment because it was a special version just for Henrik and he already downloaded it.

Hi Mike and Kevin

I agree with you - lets not make any more changes to the script until Brian has finished the changes to the av/ext reports.

But - I just installed your (Mike) attached scripts and its working real fine now - both in Danish and English

Thank you very much for your help.

Best regards,

Henrik

One more small fix for Maximum humidity on the daily reports, the problem was the word humidity was showing up on the side where the values are.
I only changed one line
array(‘Maximum humidity’,4), # mchallis 04/06/08 (WD 10.37j-01 fix) changed 3 to 4

#edit, I removed the attachment, see later post for latest AvgExtract.php attachment

Hi Mike

Thanks for the update - havent noticed yet.

Its working perfect.

Best regards,

Henrik

I updated AvgExtract.php to version 1.03

mchallis Version 1.03 04/08/08 Added support for rain totals in mm

In AvgExtract.php I replaced


$level2 = array(
            array(',ET', 2),
            array('Sunshine hours month to date',6),
            array('Sunshine hours year to date',6),
            array('in. on day',0),
            array('in.  on day',0), # mchallis added 04/04/08 (WD 10.37j-01 fix)
            );

with


$level2 = array(
            array(',ET', 2),
            array('Sunshine hours month to date',6),
            array('Sunshine hours year to date',6),
            array('in. on day',0),
            array('in.  on day',0), # mchallis added 04/04/08 (WD 10.37j-01 fix)
            array('mm on day',0),  # mchallis added 04/08/08 support for rain in mm
            array('mm  on day',0), # mchallis added 04/08/08 support for rain in mm (WD 10.37j + fix)
            );

It will automatically print the correct rain totals no matter if you use inches or mm for rain.


AvgExtract.php.txt (11.5 KB)

Hi

I have notised that my:

Day, Sunshine hours, ET, max solar, max uv

are presented 2 times a day like this:

01 05.0hrs ET :1.4 mm 694.0 W/M

[quote author=jwwd link=topic=28547.msg250485#msg250485 date=1207803244]
Hi

I have noticed that my:

Day, Sunshine hours, ET, max solar, max uv

are presented 2 times a day like this:

01 05.0hrs ET :1.4 mm 694.0 W/M

Hi Mike

Thanks - avgextract.php.txt attached.

Best regards,

Henrik


avgextract.php.txt (14.3 KB)

Change:


$level2 = array(
            array(",ET", 2),
            array("Sunshine hours month to date",6),
            array("Sunshine hours year to date",6),
            array(" mm ",0),
            );

To:


$level2 = array(
            array(",ET", 2),
            array("Sunshine hours month to date",6),
            array("Sunshine hours year to date",6),
            array('mm on day',0),   # mchallis added 04/08/08 support for rain in mm
            array('mm  on day',0),  # mchallis added 04/08/08 support for rain in mm (WD 10.37j + fix)
            );

The array(" mm ",0), must be something you added, it was interfering with the rain total “mm”


avgextract.phphenrik.txt (14.5 KB)

Hi Mike

Thanks for your help (again)

Its working but now my rain totals are missing :frowning:

http://www.buskelundtoften.dk/vejret/english/rapporter.php?report=200804&size=1

Best regards,

Henrik

Try this then


$level2 = array(
            array(",ET", 2),
            array("Sunshine hours month to date",6),
            array("Sunshine hours year to date",6),
            array('mm 1',0),
            array('mm 2',0),
            array('mm 3',0),
            array('mm 4',0),
            array('mm 5',0),
            array('mm 6',0),
            array('mm 7',0),
            array('mm 8',0),
            array('mm 9',0),
            );



avgextract.phphenrik.txt (14.5 KB)

Hi again Mike

Wow you are fast!

One more problem now (I think the problem have been there before the changes) - when I choose another month its always April 2008 which is presented.

What might be the problem?

Best regards,

Henrik

Here is my forms page attached - could the problem be there?

Best regards,

Henrik


rapporter.php.txt (7.38 KB)

Try this diagnostic version, it will print the date it gets from your form input so I can see if the problem comes from there or not.

I added this, you can take it out or comment it out later.


    # test print diagnostic info
    echo "<p>date_to_process: $date_to_process
";
    echo 'Month File: ' . $mnthname[$monthnum -1 ] . $yearnum . '.htm</p>';


avgextract.phphenrik.txt (14.7 KB)

Hi again

Ok - seems that April2008.htm always is presented:

http://www.buskelundtoften.dk/vejret/english/rapporter.php?report=200801&size=1

Best regards,

Henrik