How to gather data from weather forecast?

조회 수: 27 (최근 30일)
Fernando Penaherrera
Fernando Penaherrera 2018년 9월 4일
댓글: Saleh 2020년 9월 1일
Hi!
I am developing a script which uses outside temperature as input for a calculation of ventilation requirements in a house.
I wanted to use data from a weather forecast website. How can I make a script to read and save the Temperature data from tomorrow or next week?
For example, how do I get a table with this data?
https://www.google.de/search?q=quito+temperatura&rlz=1C1CHBF_deDE773DE773&oq=quito+temperatura&aqs=chrome..69i57j0l5.2527j1j4&sourceid=chrome&ie=UTF-8
Thanks in advance.

답변 (2개)

Nikilesh Chilkuru
Nikilesh Chilkuru 2018년 9월 6일
편집: Nikilesh Chilkuru 2018년 9월 7일
Google Uses Weather Underground API to provide current weather information. They stopped issuing free API keys which you can use in your applications.  You can search for public API's that provide weather data. One of them is Weather API provided by OpenWeatherMap. You can browse to the link provided below and signup for the account and you can generate keys.
After generating the API key you can use them in your application and make calls to this API providing query parameters using MATLAB function "webread". To get more information on how to use function "webread" refer:
I am providing a simple example of using "webread" with OpenWeatherMap API.
key = 'YOUR_API_KEY';
options = weboptions('ContentType','json');
url = ['https://api.openweathermap.org/data/2.5/weather?q=', 'London','&APPID=',key];
Current_Data = webread(url, options);
You can browse through API doc and get familiar with how to use it depending on your requirements. Also, you can use other public weather API's as well depending on which one you feel suits your application the best. But the procedure to read from an API would be the same.
  댓글 수: 2
Xinran Wan
Xinran Wan 2019년 4월 29일
Thanks so much!! It actually works:))
Saleh
Saleh 2020년 9월 1일
Hello; I have used your code and it works for me in this case:
url = ['https://api.openweathermap.org/data/2.5/onecall?lat=32.871105&lon=51.390099&appid=' ,key];
Current_Data = webread(url, options);
my question is for some latitude and longitude the recieved data is in cell format and for some is in struct format, could you please tell me the reason and how can I recieve all them in struct format?
Thanks in advance

댓글을 달려면 로그인하십시오.


James  Bowser
James Bowser 2020년 4월 3일
편집: James Bowser 2020년 4월 3일
If you’re looking at the software side, I recommend Website
Open source, python, easily customizable, well supported.I use it on my personal weather station

카테고리

Help CenterFile Exchange에서 Weather and Atmospheric Science에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by