How to access NWS weather data with webread()

Wondering if anyone could help walk me through accessing data at the National Weather Service API. See specifications @ https://www.weather.gov/documentation/services-web-api
Tried: n = webread("https://api.weather.gov/gridpoints/TOP/31,80/forecast/hourly")
I'm having formatting problems. The data comes in as a 96144x1 uint8 matrix. I simply don't undertstand how to deal with this. In the past, my API calls have resulted in structures that I could easily access. How do I handle this? what weboptions() will provide the solution?
Thanks in advance

Respuestas (1)

Fiona La
Fiona La el 18 de En. de 2019
It seems that after the National Weather Service API was updated, MATLAB R2017a's 'webread' function is not able to recognize the data as 'JSON' formatted. Fortunately, upon testing this workflow in MATLAB R2018b, it appears that the issue has been resolved and the 'webread' function is able to recognize the weather data as 'JSON' formatted.
Here is the sample command that I tested, where 'data' is a struct that contains hourly forecast data:
>> data = webread('https://api.weather.gov/gridpoints/TOP/31,80/forecast/hourly')
Refer to this documentation page for more information about 'webread':

Preguntada:

el 15 de En. de 2019

Respondida:

el 18 de En. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by