How are the Weather Forecast File APIs used?

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:

  1. For standard forecasts, the endpoint is: /forecast/file/
  2. 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:

  1. Write their own custom code
  2. 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:

Weather-sample-viz-in-panoply

Note that this visualization is only showing one data variable (Wind Speed) at one elevation (Ground/Water Surface) for one distinct time window.

Weather-fields-in-panoply

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.

 

Here is an example video showing the /file/forecast endpoint being used to retrieve .grib2 files:

Weather-File-API-cURL-usage