7:08 pm

weatherreport 2.0 released. w00t.

UPDATE 2: Now at 2.2, since adding code to fetch the METAR using fsockopen() for users whose webservers do not permit remote file() or fopen(). This should solve a lot of those "Cannot connect to NWS..." issues I hear about from time to time.


UPDATE: It looks like the time localisation thingie is a 'go', so I've upped the rev level to 2.1. I've integrated Orlando's Portugese translation file also, and it is available as a separate download. The readme has been updated also, with instructions on enabling translation files as well as contributing new ones.


The long-awaited, anticipated by thousands, update to my little weather plug-in is now available for download. I've upped the rev level to 2.0 cos I went to the mat adding localised language support. It always kinda bugged me that the output was only in English, and me living in a by-golly-lingual country. So now it'll say if it's raining wherever in French, if you want. (Scroll down the sidebar to see the report for Halifax. Hoo, touch me!)

Now, as my nearest and dearest are painfully aware, especially after putting up with me last night, I do not speak French. Not by a long shot. Hell, I can barely spell it. (f, r, a, n, funny-lookin' c, a, i, s, what'd I leave out? Must be something.) But between an old dictionary of Nola's, babelfish and flipping back and forth between the "French" and "English" buttons on various Environment Canada weather forecast sites, I don't think it's too godawful a translation. It probably is, though. I don't care. It works. I proved a concept, goddammit.

Because several files changed when moving functions from them into the language files, even upgraders are advised to just download the whole thing. Please do take note of the changes to the instructions for configuring weatherreport.php and setting your language of choice, as well as the changes to headings display. It's all in the readme. I'm hoping it makes sense. It's a hell of a lot easier to do than to explain.


counting raindrops with half an ear for Moon Cradle from the album "Parallel Dreams" by Loreena McKennitt

tagged: | 30 Comments


  1. Shaun
    posted June 8, 2005 at 8:06 am

    Love the plugin. Only question is can you change the time format to be local? ie: 1:00pm CT

  2. posted June 8, 2005 at 11:04 pm

    I’m glad you like it!

    Localising the time and date is an interesting question, since I would first have to determine just what “local” means. Are we talking local to your site’s server? To your site’s readers? To the reporting station? Then there’s the issue of what’s actually reported as “the time” in the METAR, and what format is used (there are two that I’m aware of).

    So far I’ve just let it lie, since everyone knows what UTC means, and can do a mental calculation to whichever meaning of “local” is of greatest interest to them. But that’s not quite as satisfying, so I’ll think about it again and see what I can come up with.

  3. posted June 9, 2005 at 5:20 am

    […] June 9th, 2005 WordPress Plugin: WeatherReport WeatherReport is a PHP script created as a plug-in for WordPress. It […]

  4. posted June 9, 2005 at 5:39 am

    […] in WordPress: Ajax Spell Checker Plugin WordPress: WeatherReport WeatherReport – uno script PHP creato come plugin per WordPress. Si […]

  5. Rahul Sinha
    posted June 9, 2005 at 6:36 am

    Hi there,

    It would seem that you might allow the user to set a timezone for display; the UTC conversion could be done in-script.

    My server may be in Amsterdam, but I live in Washington DC, and thus would like US-EDT, not CET or whatever… (nor Greenwich UK) :-)


  6. Corrie
    posted June 9, 2005 at 9:56 am

    nice, love it

  7. posted June 9, 2005 at 7:20 pm

    Thanks, Corrie!

    Rahul, setting a time zone is beyond my humble powers. I am currently testing how it works if I allow for an offset of so many hours from Greenwich and do a conversion. I’ll make it available if it doesn’t blow up in the next day or so.

  8. posted June 11, 2005 at 10:08 pm

    I made the plugin translation to Portuguese. However, the main script plugin does not accept the wr-pt.php file name, and therefore I had to use the portuguese translation inside (under cover) of the french file name (wr-fr.php). It runs swell ;)
    You may download here the wr-fr.php with portuguese language content.:cool:
    It’s up to the plugin’s author to include the wr-pt.php in a forthcoming release…

    Thanks for the rockin’ job!

  9. posted June 11, 2005 at 10:10 pm

    I forgot to mention the download site…o_O

  10. posted June 11, 2005 at 11:41 pm

    Yay! Thank you, Orlando! I need to tweak some things in the docs and add the function for ‘local time’ conversion I’m working on before I post it for download, so it might be a couple of days before it’s available.

    Very good of you to do that. I do appreciate it.

  11. Jenna
    posted June 12, 2005 at 9:37 am

    Any chance I can get a zip option for download?

  12. posted June 12, 2005 at 1:14 pm

    Sorry, no. I can’t keep up with more than one ‘master’ fileset. If you’re working with Windows, the current version of WinZip does decode .tar.gz files. Otherwise a google search for gzip will turn up a number of freeware or shareware utilities, one of which should work for your platform.

  13. posted June 14, 2005 at 6:45 am

    Thanks for the update, Jill. I’ve got the output just the way I want it!

  14. posted June 15, 2005 at 5:30 pm

    Hi! Thanks for creating this plugin, it seems full of the features I’ve been looking for!

    Unfortunately, I can’t get it to work. It just keeps telling me that it “Could not connect with NWS, or YMML is not valid or is not available.” I know YMML is a proper code, and I’ve tried a few others like KONT and KSTP as well… Do you have an idea of some things I should check first to find out what’s wrong?

    I currently have the WeatherIcon plugin on my site, and it does work, but it’s not as feature-full as I’d like.

    Thanks for any help you have time to toss my way!

  15. Ben
    posted June 15, 2005 at 9:33 pm

    Can’t get it to work on my pages. All I see is the code.

  16. posted June 15, 2005 at 11:04 pm

    Adam, give this version a try. I may have resolved the problems I had a few months ago with using fsockopen() in situations, such as I suspect yours to be, where the webserver does not allow remote file reading via file() or fopen().

    Let me know how you get on.

  17. posted June 15, 2005 at 11:29 pm

    Ben, either you missed something in the installing and configuring, or you’ve a typo in the get_weather call in your sidebar. If you want to provide details of what you’re seeing, please send me an email.

  18. posted June 16, 2005 at 1:02 am

    I’m having the same problem that Adam had; you can see it at my page. I put the weather call into the sidebar. It’s telling me, “Could not connect with NWS, or KAVP is not valid or is not available. To test for specifics, click here.”


  19. posted June 16, 2005 at 1:08 am

    Seth, try the fix I posted for Adam. See if that resolves your problem.

  20. posted June 16, 2005 at 8:33 am

    The new version seems to require a file “wr-pt.php”:

    Warning: main(/[…]/plugins/wr-weather/wr-pt.php): failed to open stream: No such file or directory in /[…]/plugins/weather-report.php on line 58

    Can you post this file, too, please? And thanks again!

  21. posted June 16, 2005 at 8:36 am

    Oh geez, nevermind, I’m incredibly stupid. I found the reference to that file in weather-report.php and commented it out since I don’t need that language translation.

    So the new version works without troubles. Thanks! Now I can get to configuring it and stuff…

  22. posted June 16, 2005 at 9:09 am

    Yep. That did it! :)

    I had tried that solution before I posted here, but the .phps suffix confused me. Once I changed it to just .php, everything worked just fine.

    Thanks for an excellent piece of software! Any plans for adding graphics for current conditions? ;)

  23. posted June 16, 2005 at 10:04 am

    Adam & Seth: thank you both for testing that little mod for me! I’ve updated the main package to include it.

    Seth, graphics are a non-starter for me, unless I can make them stunning, jewel-like examples of timeless elegance. But I’ll think about it. :)

  24. posted June 16, 2005 at 2:12 pm

    […] Plugin Love Here are some hot new WP plugins: weather report, spotpress, tidy, sitemaps (!), and a permalink redi […]

  25. Carsten
    posted July 8, 2005 at 4:54 am

    Hi from Denmark :-) (maybe that explains my poor english ;-) )

    First i tried weathericon -but couldent make it work

    Now i tried your great plugin, but i get an error when i try to acticate it.

    I get this:

    Parse error: parse error, unexpected T_STRING in /customers/crazycage.dk/crazycage.dk/httpd.www/d9s/wp-content/plugins/weather-report.php on line 32

    its the line where i put the password to my mysql database. Is it because the passwords starts with a number instead of a number -and how do i correct it. Im no php geek but i assume that i might surround the password with some code so it makes no difference that the code starts with a number instead of a letter.

    Any suggestions

  26. posted July 8, 2005 at 6:34 am

    Carsten, if you’re using WeatherReport with WordPress, you shouldn’t need to enter your password in weather-report.php. That is only for using it outside of WordPress.

    All you need to do with lines 29-33 is to uncomment them. Do not change them otherwise. They should look like this:

    require_once (WP_DIR . 'wp-config.php');
    $server = DB_HOST;
    $loginsql = DB_USER;
    $passsql = DB_PASSWORD;
    $base = DB_NAME;

  27. posted July 21, 2005 at 12:26 am

    […] Weather Report 2.2 is another plugin based on the National Weather Service data. It is highly customizable, since it will only output text. But we like icons, don’t we? […]

  28. Sabbry
    posted November 28, 2005 at 11:02 am

    Oh OH .. good work

  29. Joseph
    posted December 20, 2005 at 11:14 pm

    Ummm, can you post an exact layout of the code that goes in the sidebar? I don’t see an example or rather it’s crowded with all the other material in the Read Me too much for me to understand it.


  30. posted December 20, 2005 at 11:30 pm

    I’ll try. In my sidebar, for the ‘Your Weather’ section, I have:

    getuserweather('en,show-date,temp-cf,dew-cf,rel-hum,pressure-inhg-hpa,activity,cloudwatch-mft,remarks,,<br />,1,0');

    and for Tofino in the ‘More Weather’ section, I have:

    get_weather('CYAZ,en,show-date,-7,temp-cf,activity,cloudwatch-mft,remarks,,<br />,1,1');

    The section for Vancouver’s weather is more complicated, since it’s divided into several groupings, so there are several calls split into separate <div>’s. Pulled out of the divs, they are:

    get_weather('CYVR,en,show-date,-7,,<br />,1,0');
    get_weather('CYVR,en,temp-cf,dew-cf,minmax6h-cf,minmax24h-cf,heat-index-cf,rel-hum,,<br />,1,0');
    get_weather('CYVR,en,pressure-inhg-hpa-atm,pressurelong-inhg-hpa-atm,,<br />,1,1');
    get_weather('CYVR,en,activity,visibility-kmmi,,<br />,1,0');
    get_weather('CYVR,en,precip-mmin,precip6-mmin,precip24-mmin,,<br />,1,1');
    get_weather('CYVR,en,wind-ktkmmph,wind-dir,,<br />,1,1');
    get_weather('CYVR,en,clouds-mft,,<br />,1,1');
    get_weather('CYVR,en,cloudwatch-mft,,<br />,1,1');
    get_weather('CYVR,en,remarks,about,,<br />,1,1');