Author Topic: api.weather.gov very slow  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Offline akirmse

  • Member
  • *
  • Posts: 2
api.weather.gov very slow
« on: October 10, 2018, 01:09:25 AM »
I notice that api.weather.gov point requests are very slow.  Using Chrome's developer tools, I see two requests each taking > 10 seconds.  The first is the expected 301 redirect to a /gridpoints URL, and the second returns the data.

An example request is:
https://api.weather.gov/points/46.8529,-121.7604/forecast

Does anyone know why this is so slow, or whether there is a faster way to get the equivalent data?  I want simple 7-day forecasts for arbitrary points (temperature, conditions, wind).

---Andrew

Online Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: api.weather.gov very slow
« Reply #1 on: October 10, 2018, 07:53:39 AM »
Check out the tail end of this thread:

http://www.wxforum.net/index.php?topic=34923.0

One current theory is that there is something amiss with their Akamai configuration. Note that this service is still in beta and has been (and will continue to be) flaky as they mess around with it.

For an alternative, take a look at the version 4 code of advforecast2.php in the Saratoga web site template. It uses data from https://forecast.weather.gov/ and then does HTML scraping to get the info.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: api.weather.gov very slow
« Reply #2 on: October 10, 2018, 08:10:39 AM »
I notice that api.weather.gov point requests are very slow.  Using Chrome's developer tools, I see two requests each taking > 10 seconds.  The first is the expected 301 redirect to a /gridpoints URL, and the second returns the data.

An example request is:
https://api.weather.gov/points/46.8529,-121.7604/forecast

Does anyone know why this is so slow, or whether there is a faster way to get the equivalent data?  I want simple 7-day forecasts for arbitrary points (temperature, conditions, wind).

---Andrew
It is stil not sure that the API will be reliable in the near future.
At the moment the response times are very bad, here my measurements yesterday: http://www.wxforum.net/index.php?topic=34923.msg360598#msg360598
And Ken True's explanation also: http://www.wxforum.net/index.php?topic=34923.msg360649#msg360649

But you can use the current NWS version to retrieve a json file which gives you some information such as temps, POP, description and icon-URL's  Example: https://forecast.weather.gov/MapClick.php?lat=41.1511&lon=-74.3511&FcstType=json

If you want to use another forecasting-company check Darksky https://darksky.net/dev
They have free and very detailed forecast data available in json format. I use them on my home site also.

Wim

Online Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: api.weather.gov very slow
« Reply #3 on: October 10, 2018, 08:16:35 AM »
FWIW, this morning I am getting nothing but timeouts and 502 / Bad Gateway errors. I sent an email to the developer contacts that I have at NWS.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline akirmse

  • Member
  • *
  • Posts: 2
Re: api.weather.gov very slow
« Reply #4 on: October 10, 2018, 11:08:10 AM »
Thanks for the responses.  I used to use forecast.weather.gov, but it doesn't have wind speed that I could find, and the format is really annoying to work with.  My reading of the NWS site made me think that the old API was being retired, and that the new one was ready to go.  I also investigated DarkSky, but I found their forecasts to be wildly inaccurate for the mountainous areas my app needs.

The new API would be great if it just weren't so slow.  If someone could put me in contact with the NWS technical team I'd be happy to do what I can to help speed it up.