cloudy

Author Topic: PHP Extraction of WD Avg/Ext HTM Files  (Read 43951 times)

0 Members and 1 Guest are viewing this topic.

Offline BfdWx

  • Posts: 1,586
  • Branford Connecticut
    • Branford Weather
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #90 on: December 28, 2007, 10:39:37 PM »
Quote
I had to be in the hospital for a couple of days

Hope all is well now! Happy (Healthy) New Year to you too!

Jack

Offline Weather Display

  • Posts: 65,566
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #91 on: December 28, 2007, 11:52:43 PM »
the results look very good  :wink:
does the red/blue colour i added for the max/min temperature upset the parsing though?

Online TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #92 on: December 29, 2007, 02:42:35 AM »
They required a bit of a change but it wasn't that hard.  The script now strips anything between <...>
before using it.  Luckily, there is no data that has a < or > in it or it could have been trickier.

The new font tags you added however are missing closing </font> tags for each of them.  There should be a matching closing </font> tag for every <font ...> tag.

<FONT COLOR="#3333FF" SIZE=+2 style="font-family: Arial"><B>Averages\Extremes for day :01</B></font>
<FONT COLOR="#000000" style="font-family: Fixedsys">
------------------------------------------------------------
Average temperature       60.0   °F (15.6 °C)
Average humidity          70   %
Average dewpoint          50.1   °F (10.0 °C)
Average barometer         29.848 in.
Average windspeed         6.4   mph
Average gustspeed         10.8   mph
Average direction         185 ° ( S )
Rainfall for month        1.756  in. (44.6 mm)
Rainfall for year         8.925  in. (227 mm)
-----------------------------------------------------------
Maximum rain per minute   0.000  in. ( 0 mm) on day 01 at time 10:18
<FONT COLOR="#FF0000">Maximum temperature       68.2  °F (20.1 °C) on day 01 at time 14:36
<FONT COLOR="#3333FF">Minimum temperature       49.7  °F (9.8 °C) on day 01 at time 23:59
<FONT COLOR="#000000">Minimum pressure          29.6  in. on day 01 at time 00:47
Maximum pressure          30.2  in. on day 01 at time 23:53
<FONT COLOR="#000000">Maximum windspeed         22.0  mph from 169° on day 01 at time 12:37
Maximum gust speed        32.0  mph from 176° on day 01 at time 12:36
Maximum humidity          93 % on day 01 at time 00:45
Minimum humidity          49 % on day 01 at time 21:08
Maximum heat index        77.5 °F (25.3 °C) on day 01 at time 15:09
Rain for the day :0.120 in
</FONT>
<FONT SIZE=+0><A HREF="20071201.gif">Click here for todays 24 hour graph  :1  :12  :2007</A></FONT>

All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline jwwd

  • Posts: 3,561
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #93 on: December 29, 2007, 02:31:42 PM »
Henrik,

You can format the number anyway you want without any change from the source....

If you need only 1 digit instead of the two...

If $DAY = "09" and $yearnum = "2007"...

$filename = 'windtempraintrend' . intval($DAY) . $yearnum . ".gif"; 

Will produce:  windtempraintrend92007.gif

or

$filename = 'climatedataout' . intval($DAY) . $yearnum . ".html";

Will produce:  climatedataout92007.html

Hi Kevin

I have your great script up and running and I have figured out how to present the monthly .gifs produced by WD.

See example here: www.buskelundtoften.dk/vejret/1rapporter.php

Try and get November 2007 daily report - here you see all the month-stamped .gifs from November 2007.

Now I only need to fix the 1-digit filename. Im not sure how to do that - I have looked at your code above - but am in doubt where to place the code.

Here is the code I use in the avgextract.php:

Code: [Select]
            if ($LEVEL == 0 ) {
               
                if ( strpos ($value,"Daily report for ") !== false ) {
                    preg_match("/Daily report for (.*)\</U",$value,$found);
                    $month = $found[1];
                    echo "<h1>Daily Report for the month of " . $month . "</h1>";
                echo '  <img src="' . $website . $monthnum . $yearnum . 'monthtodate' . '.gif">
    <br/>' . "\n";
                echo '  <img src="' . $website . $monthnum . $yearnum . 'alltimerecordsmonth' . '.gif">
    <br/>' . "\n";
                echo '  <img src="' . $website . 'windtempraintrend' . $monthnum . $yearnum . '.gif">
    <br/>' . "\n";
                echo '  <img src="' . $website . 'windtempraintrend3d' . $monthnum . $yearnum . '.gif">
    <br/>' . "\n";
                echo '  <img src="' . $website . $yearnum . $monthnum . 'windrose' . '.gif">
    <br/>' . "\n";
                    $LEVEL = 1;
                }
            }

Thank you very much for your help and all your great scripts.

Best regards,

Henrik

Ps. How is your new phone? Is it a good toy?

I just got a new digital camera - Ricoh Caplio R7 - great with some new toys.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #94 on: December 30, 2007, 01:15:17 AM »
I made an automatic drop down list generator for the WD Avg/Extreme script.

 The code will output the html drop down list automatically for the monthly files found on your server
<option value="200712">December 2007</option>
<option value="200711">November 2007</option>
<option value="200710">October 2007</option>

look here, the instructions and code are inside
http://www.carmosaic.com/weather/include-get-month-files.txt

My Monthly Weather Reports page:
http://www.carmosaic.com/weather/monthly-stats.php
« Last Edit: January 01, 2008, 01:27:57 AM by MCHALLIS »

Offline jwwd

  • Posts: 3,561
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #95 on: December 31, 2007, 08:04:13 AM »
Hi and happy new year

Yesterday I did manage to present the montly WD .gifs together with my daily reports - thanks to weatherc

Let me know what you think:

www.buskelundtoften.dk/vejret/english/rapporter.php

Best regards,

Henrik

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #96 on: January 01, 2008, 01:30:15 AM »
My dropdown list generator code is ready to share

This script is designed to be a plugin for
TNET Weather - tws-avgext-script where the date string is used like this:
sample.php?date=200712

If you are just starting out, make sure you first install the tnet scripts and get them working before trying my plugin.
You need to have installed the AvgExtract.php and the sample.php from the tnet site, get that working, and then finally install my plugin.

look here, the instructions and code are inside
http://www.carmosaic.com/weather/scripts/include-get-month-files.php?sce=view

I use it as a plugin on my tws-avgext-script Monthly Weather Reports page
http://www.carmosaic.com/weather/monthly-stats.php
« Last Edit: January 04, 2008, 01:42:00 AM by MCHALLIS »

Offline jwwd

  • Posts: 3,561
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #97 on: January 01, 2008, 07:09:56 AM »
Hi and happy new year

Great looking site - but there is an error on your site - see attached pic

Best regards,

Henrik

Offline Budgie

  • Martin
  • Global Moderator
  • Posts: 4,956
  • WML Station: WD00934 CWOP: CW7959
  • Isle of Lewis, Scotland
    • Hebrides-Weather
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #98 on: January 01, 2008, 11:47:40 AM »
I'm getting that on my site as well.
I'm assuming that it's because WD hasn't uploaded the Jan 2008 file yet but it should go after midnight once the file has something in it to upload.  :wink:

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #99 on: January 01, 2008, 04:15:10 PM »
I have fixed it, I will reply here with the fix as soon as I organize it properly for release

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #100 on: January 01, 2008, 05:54:32 PM »
All fixed and even better than before  :)

I want to note that this is designed to be a plugin for Kevin's "PHP Extraction of WD Avg/Ext HTM Files" script

script available at
http://www.carmosaic.com/weather/scripts/include-get-month-files.php?sce=view

Version 2.0 - 01-Jan-2008 - fix: find default month, make sure it exist
added feature: verify inputted date file exist, use default if it does not
version 2 requires changes in the how to use section
refer to "How to use it:" section at the top of the script
« Last Edit: January 04, 2008, 01:42:56 AM by MCHALLIS »

Offline dafuser

  • Posts: 564
  • Granbury, Texas
    • Weather from the shores of Lake Granbury
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #101 on: January 01, 2008, 10:42:43 PM »
All fixed and even better than before  :)

I want to note that this is designed to be a plugin for Kevin's "PHP Extraction of WD Avg/Ext HTM Files" script

script available at
http://www.carmosaic.com/weather/include-get-month-files.txt

Version 2.0 - 01-Jan-2008 - fix: find default month, make sure it exist
added feature: verify inputted date file exist, use default if it does not
version 2 requires changes in the how to use section
refer to "How to use it:" section at the top of the script
I tried to implement the script, but it does not display anything. I probably messed something up, but darned if I can see what it is. My page is [url][http://www.lesdiefenbach.org/wx/test-stats.phpurl]Can you see anything obvious?  I only have December2007.htm available for data.
--
Thanks Les...
Microsoft Windows: Proof that P.T. Barnum was correct.

24 inch iMac 2.8GHz C2D, 4 GB Ram (OS X 10.7 Lion) Davis Vantage Vue

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #102 on: January 01, 2008, 11:31:34 PM »
dafuser,

Did you first install the tnet scripts and get them working before trying my plugin?
You need to have installed the AvgExtract.php and the sample.php from the tnet site, get that working, and then finally install my plugin.

Start here:
http://www.tnetweather.com/tws-avgext-script.php

was I any help?

Offline Budgie

  • Martin
  • Global Moderator
  • Posts: 4,956
  • WML Station: WD00934 CWOP: CW7959
  • Isle of Lewis, Scotland
    • Hebrides-Weather
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #103 on: January 02, 2008, 03:20:01 PM »
It's installed and working like a dream Mike.  :D

Thanks for that.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: PHP Extraction of WD Avg/Ext HTM Files
« Reply #104 on: January 02, 2008, 05:51:20 PM »
Someone pointed out to me a page header title inconsistency and I have the fix ....

January2007.htm page title was "Daily Report for the month of January 2007"
and January2008.htm page title was "Daily Report for the month of 01 2007"

Here is the fix that will use "January" in both pages

inside AvgExtract.php

change
Code: [Select]
preg_match("/Daily report for (.*)\</U",$value,$found);
$month = $found[1];

to

Code: [Select]
// mchallis page title consistancy fix ....
// January2007.htm page title was "Daily Report for the month of January 2007"
// and January2008.htm page title was "Daily Report for the month of 01 2007"
$month = $mnthname[$monthnum -1 ] . " $yearnum";

 

cumulus