top | item 34975936

(no title)

vsergeev | 3 years ago

Unfortunately, the NWS API is missing machine readable condition codes/icons in the daily and hourly forecast, which is why it isn't available in briefsky. The API has nearly everything else, though. If I had a solution for those icons, I probably would have added support for their weather alerts too, and also made it the default for US locations.

See here for notes on other unsupported providers: https://github.com/vsergeev/briefsky#unsupported-providers

discuss

order

zie|3 years ago

According to your link it's missing 2 things, and I would argue neither are true.

Sunrise/sunset data can be calculate yourself: https://gml.noaa.gov/grad/solcalc/calcdetails.html

As for the code/icons, there is indeed an 'icon' in the hourly forecast, for example:

From this url: https://api.weather.gov/gridpoints/PDT/31,35/forecast/hourly which returns an hourly forecast for someplace or other, there is this:

"icon": "https://api.weather.gov/icons/land/night/snow,20?size=small",

vsergeev|3 years ago

The icon field is deprecated, no longer documented in the API, and also more complicated in practice, as it can mix multiple conditions, e.g. `...{day,night}/rain,30/snow,60?...`. The space of possible icons is also fairly large -- https://www.weather.gov/forecast-icons to get an idea -- and it's not clear what short string they all map to. So yeah, in theory you could parse and infer a weather condition out of that link, but as you can see it's pretty hacky and already deprecated. The API should really just return a code or enum (e.g. like a WMO code).

But maybe there's a cleaner way to infer it. PRs are always welcome.