1. Help Center
  2. Spire Weather
  3. Using the Spire Weather API

Retrieving minimum and maximum temperature values

An overview of how the minimum and maximum temperature values are published in the API.

The basic data bundle offered by Spire Weather includes fields for minimum and maximum temperature values. The field names are:

  • air_temperature_min_in_last_6_hours
  • air_temperature_max_in_last_6_hours

Due to the fact that the minimum and maximum values are valid for a 6 hour range, they are only included at lead times in 6 hour intervals.

Take the following Weather Forecast Point API request for example:

https://api.wx.spire.com/forecast/point?lat=42.32717&lon=-91.62078&bundles=basic&time_bundle=medium_range_std_freq

Here we specify the basic data bundle and the medium_range_std_freq time bundle, which will return 7 days of forecast data with 6 hour intervals between lead times.

Using the X-Fields header, we can also configure server-side filtering to limit the data fields in the response returned by the API. Server-side filtering and the X-Fields header are described in greater detail here.

In this example, we will limit the API response to only return data times and values of air_temperature_min_in_last_6_hours or air_temperature_max_in_last_6_hours.

{data{times,values{air_temperature_min_in_last_6_hours,air_temperature_max_in_last_6_hours}}}

With the API request and X-Fields header from above, we can expect to get output that looks like this:

{

    "data": [

        {

            "times": {

                "issuance_time": "2020-04-29T00:00:00+00:00",

                "valid_time": "2020-04-29T00:00:00+00:00"

            }

        },

        {

            "times": {

                "issuance_time": "2020-04-29T00:00:00+00:00",

                "valid_time": "2020-04-29T06:00:00+00:00"

            },

            "values": {

                "air_temperature_min_in_last_6_hours": 280.609985351562,

                "air_temperature_max_in_last_6_hours": 286.929992675781

            }

        },

        {

            "times": {

                "issuance_time": "2020-04-29T00:00:00+00:00",

                "valid_time": "2020-04-29T12:00:00+00:00"

            },

            "values": {

                "air_temperature_min_in_last_6_hours": 280.399993896484,

                "air_temperature_max_in_last_6_hours": 282.0

            }

        },

        {

            "times": {

                "issuance_time": "2020-04-29T00:00:00+00:00",

                "valid_time": "2020-04-29T18:00:00+00:00"

            },

            "values": {

                "air_temperature_min_in_last_6_hours": 280.300018310547,

                "air_temperature_max_in_last_6_hours": 281.399993896484

            }

       },
...

Note that the first lead time of 2020-04-29T00:00:00+00:00 does not contain any data values for air_temperature_min_in_last_6_hours or air_temperature_max_in_last_6_hours. This is expected, since the 0-hour lead time is the very beginning of the forecast window. For all following lead times of the medium range forecast, we can expect to see data values in these fields, since the medium_range_std_freq time bundle has 6 hour intervals between lead times. For more information on issuance times and lead times, please see here.

 

If a high-frequency time bundle is specified, such as short_range_high_freq or medium_range_high_freq, the lead time intervals between 0 and 24 hours will be 1 hour instead of 6.  Since min/max temperature values are delivered in 6 hour chunks, those fields will not be included in the 01:00 - 05:00 lead times, the 07:00-11:00 lead times, the 13:00-17:00 lead times, or the 19:00-23:00 lead times.

The example above uses the /forecast/point API endpoint, but the same is true for files downloaded from the /forecast/file API endpoint.