hourly forecast appears to be returning some invalid icon urls #633
Replies: 2 comments
-
I discovered this quite some time ago and worked around it. The problem is when there is a 0% chance of precipitation. In that case, the icon is of the form: Note the “,0” above. If you remove it, the icon is valid. If you change “,0” to “,2” or “,10” or any non-zero integer, it also works. The 12 hour forecasts correctly omit the “,0” when POP is 0%. The workaround is to check for “,0?” And, if you see it, replace it with “?” (i.e., remove the “,0”). |
Beta Was this translation helpful? Give feedback.
-
Ran into this last night. I was worried the hourly was somehow hitting a rate limit, but the only correlation was the 0% POP. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The hourly forecast ( example https://api.weather.gov/gridpoints/PBZ/58,100/forecast/hourly ) appears to be returning some invalid icon urls. OR, the icon api is breaking in some fashion when fetching icons with 0% values on them.
for example,the forecast is returning values such as this for the url:
icon | "https://api.weather.gov/icons/land/night/sct,0?size=small"
which returns a 400 error from the api when attempting to retrieve it.
{
"correlationId": "56748b83",
"title": "Bad Request",
"type": "https://api.weather.gov/problems/BadRequest",
"status": 400,
"detail": "Bad Request",
"instance": "https://api.weather.gov/requests/56748b83"
}
If I replace precip % value with something other than 0:
https://api.weather.gov/icons/land/night/sct,1?size=small
or remove it completely
https://api.weather.gov/icons/land/night/sct?size=small
then the url works. But the url with the 0 % that the forecast api returns does not work.
Beta Was this translation helpful? Give feedback.
All reactions