An overview of the Weather Forecast File APIs and the GRIB2 file format.
Example Input:
curl -OJL -X GET "https://api.wx.spire.com/forecast/file/sof-d.20200502.t00z.0p125.basic.global.f000.grib2" -H "spire-api-key: $YOURKEY"
Output (GRIB2):
Unlike the JSON text data returned by the Point API, the File APIs return actual files with .grib2 file extensions. There are 2 different API endpoints for returning .grib2 data:
- For standard forecasts, the endpoint is: /forecast/file/
- For historical forecasts, the endpoint is: /sample/file/
Responses from API requests to these endpoints will return files with names that look something like this:
These .grib2 files require special software to view.
In order to view the data stored in a .grib2 file, users will need to do one of the following:
- Write their own custom code
- Use an existing application
There are many existing applications for working with .grib2 files.
Here is a sample of Spire Weather data shown in NASA’s free Panoply software:
Note that this visualization is only showing one data variable (Wind Speed) at one elevation (Ground/Water Surface) for one distinct time window.
Another free tool for viewing .grib2 files is Unidata’s Integrated Data Viewer (IDV).
Spire does not currently offer its own custom application for viewing .grib2 files, but the Spire Weather GitHub includes starter code and examples for working with the data and we have also developed a series of GRIB2 Python Tutorials for working with the data in custom Python scripts.
Below is an example video showing the /file/forecast endpoint being used to retrieve .grib2 files, but be sure to check out our dedicated FAQ page for additional usage patterns: