Jason Hourly Forecast Bug

  • 1
  • Problem
  • Updated 12 months ago

When requesting the Hourly Forecast”

"http://api.wunderground.com/api/”KEY”/hourly/q/TX/Plano.json

The icon name is incorrect.
It should be “nt_clear” but is just “clear”.
The url has the correct icon.

Every “icon” in that Jason string when it is night is incorrect.

This causes a problem if you want to use a different icon set because when you get
the “icon” and use it in a different icon set it is always a daytime icon and not a nighttime icon.

"icon": "clear",
"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif";,


Photo of James Anding

James Anding

  • 60 Posts
  • 49 Reply Likes

Posted 2 years ago

  • 1
Photo of Micah Montoya

Micah Montoya

  • 2 Posts
  • 1 Reply Like
This may not be a bug. Look at the other icon names to see if they have nt on them. If they do then  you could just search for 'nt_' and if it isn't there append it. This would be a workaround until it gets fixed if it is a bug. for JS something like: if(icon.indexOf('nt_') == -1) {icon = 'nt_' + icon;}
Photo of James Anding

James Anding

  • 60 Posts
  • 49 Reply Likes
Thanks for the reply. I did use a workaround similar to that and it works. Just seems to be incorrect the way it is. It would stand to reason that the icon field would match the icon_url field. But, I got it to work.
Photo of Andy Rowson

Andy Rowson

  • 25 Posts
  • 8 Reply Likes
Hi, I have just hit this same issue but am not as advanced to "append". I would have thought that if the icon url is nt_cloudy then the icon should be nt_cloudy. It certainly works this way when using the normal 4-day forecast. Can anyone make some suggestions or possibly look at getting this fixed.

Thanks
(Edited)
Photo of Andy Rowson

Andy Rowson

  • 25 Posts
  • 8 Reply Likes
I have managed to work around this in php by adding "nt_" to the icon name if the time of the forecast is between dusk and dawn using the times given by my weather software. Not sure I did it the easiest way (it uses a lot of variables for each hour) but I am a php novice, could see what I needed to do and worked out a way to get there. Anyway, its working for me until / if the issue is fixed.
Photo of James Anding

James Anding

  • 60 Posts
  • 49 Reply Likes
I have had to do many work around's for issues. You are safe, there is zero chance it will get fixed.