cloudy cloudy

Author Topic: wxraindetail.php add-on page for WD-AJAX-PHP-USA  (Read 56349 times)

0 Members and 1 Guest are viewing this topic.

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Posts: 5,939
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
wxraindetail.php add-on page for WD-AJAX-PHP-USA
« on: March 16, 2009, 02:17:03 AM »
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.

« Last Edit: December 29, 2009, 04:20:42 PM by TNETWeather »

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

mth

  • Guest
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #1 on: March 16, 2009, 02:48:01 AM »
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

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Posts: 5,939
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #2 on: March 16, 2009, 02:51:56 AM »
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.

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

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Posts: 5,939
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #3 on: March 16, 2009, 03:08:12 AM »
Looks like the fix is in the getnoaafile function in the script....

Look for:

Code: [Select]
$rawdata[] = $foundline;
Replace it with:

Code: [Select]
$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.
« Last Edit: March 16, 2009, 03:14:04 AM by TNETWeather »

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

mth

  • Guest
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #4 on: March 16, 2009, 03:18:06 AM »
Looks like the fix is in the getnoaafile function in the script....

Look for:

Code: [Select]
$rawdata[] = $foundline;
Replace it with:

Code: [Select]
$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

Offline andro700

  • Chuck
  • Posts: 3,346
  • Mohall North Dakota
    • Chuck's Weather Page
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #5 on: March 16, 2009, 03:28:17 AM »
Kevin great work on this script. It was very easy to set up.

Many thanks,
Chuck

Offline saratogaWX

  • Global Moderator
  • Posts: 5,939
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
    • Saratoga Weather
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #6 on: March 16, 2009, 06:22:12 AM »
Great work Kevin!  I can finally see my Seasonal rain totals :)

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
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline CNYWeather

  • Professional Trophymaker!
  • Posts: 1,521
  • Rome, New York
    • CNYWeather.com
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #7 on: March 16, 2009, 11:56:29 AM »
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

CNYWeather.com
CWOP: CW2352
WeatherUnderground: KNYWESTM1


http://www.CNYWeather.com

I Make Trophies Too!
http://www.speedyawards.com

mth

  • Guest
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #8 on: March 16, 2009, 01:02:10 PM »
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

Offline CNYWeather

  • Professional Trophymaker!
  • Posts: 1,521
  • Rome, New York
    • CNYWeather.com
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #9 on: March 16, 2009, 01:08:12 PM »
Thank you Michael!!

 :D
Tony

CNYWeather.com
CWOP: CW2352
WeatherUnderground: KNYWESTM1


http://www.CNYWeather.com

I Make Trophies Too!
http://www.speedyawards.com

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Posts: 5,939
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #10 on: March 16, 2009, 03:00:33 PM »
Were you going to put a page on TNETweather with a download there so I could link to that from the template plugins page?

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)

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

Offline pinto

  • Posts: 766
  • Belgium
    • weather station Kampenhout
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #11 on: March 16, 2009, 07:21:49 PM »
I like it, great job Kevin, easy to integrate with the template, and even with the style switcher

Raindetail in mm


Offline CNYWeather

  • Professional Trophymaker!
  • Posts: 1,521
  • Rome, New York
    • CNYWeather.com
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #12 on: March 16, 2009, 07:26:22 PM »
How'd you associate the style switcher Pinto?
Tony

CNYWeather.com
CWOP: CW2352
WeatherUnderground: KNYWESTM1


http://www.CNYWeather.com

I Make Trophies Too!
http://www.speedyawards.com

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Posts: 5,939
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #13 on: March 16, 2009, 07:31:51 PM »
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.

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

Offline pinto

  • Posts: 766
  • Belgium
    • weather station Kampenhout
Re: wxraindetail.php add-on page for WD-AJAX-PHP-USA
« Reply #14 on: March 16, 2009, 07:36:19 PM »
How'd you associate the style switcher Pinto?
Like Kevin says  :D

EDIT: colors used are the ones from
table-top
column-light
column-dark
« Last Edit: March 16, 2009, 07:45:05 PM by pinto »