wxraindetail.php add-on page for WD-AJAX-PHP-USA

Rain Detail addon page for WD-AJAX-PHP-USA template.

This script is intended to be an addon to the existing WD-AJAX-PHP-USA package. It includes two files:
wxraindetail.php wxraindetail.css

Requirements to use these scripts:
`
o You need to be uploading the dailynoaareport*.htm files via WD to your website.

Current month file is named dailynoaareport.htm

Other months are named dailynoaareportMMYYYY.htm. Note that the
months are not padded so that Jan would simply be like
dailynoaareport12009.htm with no zero padding for the month.

Note that there was a change in format in 2007 that will require updating reports from that time before
so they can be parsed correctly.

To recreate use View → Avg Ext/Noaa Reports → 2nd Tab for Noaa Style Reports.

Select which date you want to recreate in the Select Date to Calculate Field.

Then copy and paste the results into a new file (use notepad or some other editor)
and save the file as mentioned above.

o Need to know where they are located (default normally would be in the web root)
o PHP5`

Settings:

There are some settings that you can make to the script in the settins section:

$SITE[‘viewscr’] = ‘sce’;

Defines the password for the view source command. Default is sce.

$year = “2009”;

Defines which default year to display

$loc = “./”;

Defines where the dailynoaareport*.htm files are located. The above assumes they are in the same level as the script itself.

$season_start = 7;

Defines when the season starts. 1 = Jan, 7 = July

$years_available = array(“2009”,“2008”,“2007”);

Allows you to define which years to allow to show in the drop down selector. To add a year, just add it with "'s around it like you see in the example. If you have less years, then you can remove entries.

Usage:

Basically, you should be able to download the script and associated CSS file, make the settings changes to the settings and it should display when used.

You can pass it an argument like: http://YourWebSite/wxraindetail.php?view=sce

To view the source of the script.

You can also call it with a year=XXXX value to have it use that year for locating and displaying the data.

The script includes a drop down that allows the visitor to select which year to display based upon your settings for the $years_available array.

Arguments are protected against XSS injection.

Adding to the Template Menu

Instructions need to be added.

History:

`# 2009-03-15 1.0 Inital Release

2009-03-15 1.1 Fixed data parsing in getnoaafile function

2009-03-16 1.2 Corrected form to use PHP Self for action

2009-09-05 1.3 Replaced split with preg_split

2009-09-06 2.0 Replaced collection to fix season logic - Fixed Month day 1 error`

Support:

Support for this script is done via posting an open message to the Weather-Watch forums. Please don’t PM or send email about it.

Download:

Scripts are available on the TNET Weather-Display Project Page

See attachment as well as some have problems unziping the other file

Scripts should be XHTML and CSS complaint.


recreate-dailynoaareports01.png

wxraindetail-2.0.zip (4.51 KB)

Kevin,

Very nice! I appreciate your share, this is a great tool to check rainfall totals!

I’ve edited just a touch:
http://relayweather.com/wxraindetail.php

One thing to note, if you don’t have data for an entire day, the code doesn’t recognize this and places the next day in its place. Example: My September 2005 is missing three complete days of data scattered throughout the month. The code will not notice this. It assumes that you have everyday complete for the month. Is there a way to stop this or do I need to place “dummy” data within my files?

Again, thanks for the code!

Cheers,
Michael

Need to check the parser… That part of the script hasn’t changed for a long time. So I don’t recall how it stores what it collects. It “should” only store data for days it finds, but I will need to look.

Looks like the fix is in the getnoaafile function in the script…

Look for:

$rawdata[] = $foundline;

Replace it with:

$rawdata[ intval($foundline[0]) -1 ] = $foundline;

This would force the days data into the correct slot instead of assuming that all the days are there.

Script in first post has bee updated.

Kevin,

That did it…all works now.

Thanks,
Michael

Kevin great work on this script. It was very easy to set up.

Many thanks,
Chuck

Great work Kevin! I can finally see my Seasonal rain totals :slight_smile:

Were you going to put a page on TNETweather with a download there so I could link to that from the template plugins page?

Best regards,
Ken

Thank you Kevin!

I have mine up and running http://www.cnyweather.com/wxrain.php

What is the source for the year 2008 and 2007
that I guess I haven’t uploaded to my site?

Tony

Tony,

I had to manually generate my reports in WD.

View → Avg/Extreams → Noaa Style Reports

Set the date to the month / year you want to see, click update Whole Month Now. Then copy (CTRL-A, CTRL-C) and paste (CTRL-P) the results in the screen to a file and name properly (Example: dailynoaareport72008.htm) then upload to your remote ftp server.

Michael

Thank you Michael!!

:smiley:

Yes Ken… I plan on it. I am currently in the process of updating the Scripts page so that it works more like my Cumulus Project page (TNET Cumulus Project Page)

I like it, great job Kevin, easy to integrate with the template, and even with the style switcher

Raindetail in mm

How’d you associate the style switcher Pinto?

I would guess that he added the CSS from the file I provided to each of the CSS external files used by the style switcher and adjusted them to fit the color scheme.

Since the CSS for the script is unique (has its own ID) it would not interfere with the other CSS in those files.

Like Kevin says :smiley:

EDIT: colors used are the ones from
table-top
column-light
column-dark

Gotcha!

Thanks!! 8)

Kevin,

Great script! Nicely done!

Scott

Cool! Let me know when you’re ready, and I’ll add the link on the plugins page.

Best regards,
Ken

Tony,

I saw that you changed the original filename from wxraindetail.php to wxrain.php.
but you forget to change the form name inside the script on line 97 from

to

Greets,
Maurice

Thanks for catching that Maurice.