Get Historical Weather Data
Updated 4 Jun 2021
This function get historical weather data from NCEI API in MATLAB
This is a simple, proof-of-concept to easily fetch weather data in MATLAB. The output is set to JSON, and matlab conveniently packs the weather data into a struct datatype, making it easy to handle the data.
For this code, it uses the Global Surface Summary of the Day (GSOD) dataset, and the Naha statation (47936099999) to fetch temperatures and sea level pressure data. For more information on the dataset, visit https://www.ncei.noaa.gov/data/global-summary-of-the-day/doc/readme.txt
It should be easy to modify the code to suit other weather data and dataset needs. For more infomatio, visit NCEI API website https://www.ncei.noaa.gov/support/access-data-service-api-user-documentation
[Tmin,Tmax,Tmean,seaLevelPressure,stationPressure] = getHistoricalWeatherData(Date)
Date can be a MATLAB date datatype, as e.g.:
Date = datetime('today');
You can also add a start and end date:
Date = [datetime('2020-05-30') datetime('2021-05-30')];
You can either clone the repository, download the release as zip file, or visit
Julio Barros (2023). Get Historical Weather Data (https://github.com/jmbarrojr/get-historical-weather-data/releases/tag/0.5), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.