Author Topic: NHC feed parser  (Read 12615 times)

0 Members and 1 Guest are viewing this topic.

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« on: August 26, 2006, 10:11:02 PM »
I'm working on a PHP script that takes the NHC (National Hurricane Center) RSS feed and parses it for presentation on your web page. This script is specfic to the NHC feed. It does a couple of things that other RSS feed parsers don't with regard to these specific feeds:

1) Breaks out and sections individual storms.
2) Creates a header for each individual storm.

You can see it working here:

http://weather.anolecomputer.com/

The script outputs each storms set of links as an unordered list (<ul>) and the output is XHTML 1.0 strict compliant.

The script utilizes a really lightweight and well written feed parser called lastRSS. For info on lastRSS you can visit the website at:
http://lastrss.webdot.cz/

One of the nice things about lastRSS is that it includes caching. I still need to do some testing on the caching and write up some documentation before I make this script publicly available but I should have it ready tomorrow.

Obviously this is going to be of primary interest to those of us in hurricane prone areas.

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« Reply #1 on: August 26, 2006, 11:14:47 PM »
Might not have this ready tomorrow after all. Looks like we're now in the 3-day cone of uncertainty for Ernesto. Going to get the shutters in place tomorrow and start making preps.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
NHC feed parser
« Reply #2 on: August 27, 2006, 01:14:53 AM »
That's looks great on your page!  Offering the summarization by storm is a great idea.  Thanks for the reference to the lastRSS PHP class.. I picked up a copy of it too.  

Keep up your prep for Ernesto and I hope it doesn't strike you!!

 :D

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« Reply #3 on: August 27, 2006, 07:35:29 AM »
lastRSS is pretty nice. I finished up the cache testing last night, but I discovered a problem this morning because of an assumption I made that there would always be 5 link listings for each storm. This morning there is are 6 for Ernesto including an "Update". I'll have to do a little rethinking on how to handle that.

Offline ocala

  • Forecaster
  • *****
  • Posts: 4397
  • The blues had a baby and named it rock n roll
NHC feed parser
« Reply #4 on: August 27, 2006, 09:08:45 AM »
That update was weird because it came out at 5:05. They must have been waiting for recon data. At any rate that's pretty cool. Might have to put that one in the web site.

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« Reply #5 on: August 27, 2006, 09:17:45 AM »
Just taking a break from the shutters for a minute. Nice thing about doing brainless stuff like this is it let's you work things out in your mind and I'm jpretty sure I know the solution to the problem. I wasn't real comfortable relying on the always five links idea anyway and what I have in mind is a better solution.

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« Reply #6 on: August 27, 2006, 02:19:31 PM »
I almost have this done but I need a little help from someone who speaks Spanish. What is the equivalent of "Tropical Storm" in Spanish?

I think it would be "Tormenta Tropical" but I'm not wholely confident that I have that right.

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC RSS Feed Parser v1.0 now available
« Reply #7 on: August 27, 2006, 02:32:33 PM »
NHC RSS Feed Parser v1.0 is now available. You can download it from here:

http://scripts.anolecomputer.com/download.shtml

This script takes the National Hurricane Center (NHC) RSS feed and formats it for inclusion on a web page. The feed is processed into a series of unordered lists (<ul>) with headers for each storm and an <hr> divider between unrelated items. Output is XHTML 1.0 Strict compliant.

It also includes built-in transparent caching.

You can see the script in action here:

http://weather.anolecomputer.com/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
NHC feed parser
« Reply #8 on: August 27, 2006, 09:06:59 PM »
Nice script!  Very clean and readable output.

Thanks!!

Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser
« Reply #9 on: August 28, 2006, 11:41:56 PM »
Just found a small bug. I'll need to add some code to handle local statements. Right now they are coming out in a purely accidental decent grouping but they're listed as "Tropical Storm Statement" when they should be showing up as "Hurricane Local Statements".

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC RSS Feed Parser v1.1 is now available
« Reply #10 on: August 29, 2006, 07:24:45 AM »
NHC RSS Feed Parser v1.1 is now available. You can download it from here:

http://scripts.anolecomputer.com/download.shtml

This version improves the handling of Hurricane Local Statements in the NHC feed.

You can see the script in action here:

http://weather.anolecomputer.com/

Offline up10ad N9RJH

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 578
  • Station will be back up someday...
    • Forecaster without a site
NHC feed parser
« Reply #11 on: August 29, 2006, 08:39:56 AM »
Very nice script!  Thanks.  Of course, hurricane info isn't nearly as important in my area as yours, but my visitors are still interested in what is happening on the east coast.  The only things I changed on it were the links, which I changed to target a new window, and I removed the 'other' type reports including the outlook statements.  

It works great.
Rick (N9RJH)
Have you joined USAWeatherFinder.com yet?

Offline anvana

  • Senior Member
  • **
  • Posts: 98
    • http://www.topsailweather.com
NHC feed parser
« Reply #12 on: August 29, 2006, 07:16:18 PM »
Thanks, Anole....

Looks like something I need to work on this evening. Just in time!

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
NHC feed parser v1.2 now available
« Reply #13 on: December 23, 2006, 11:09:17 AM »
NHC feed parser v1.2 is now available:

http://scripts.anolecomputer.com/download.shtml

This version contains a bug fix which corrects an xhtml compliancy problem (extra </ul> when no statements or warnings are active).

Special thanks to Ken True at http://saratoga-weather.org/ for providing the fix! This was on my fix list but things have been so busy here for the last few months that it was pretty low down the priority list. So thanks Ken for fixing this for me!  :D

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NHC feed parser
« Reply #14 on: December 23, 2006, 01:21:15 PM »
You're welcome, and THANK YOU for the excellent NHC php display code.  I'm using it on my site too :-)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything