Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Different methods for working with forecasts that are currently populating the API.

Spire Weather prioritizes the quickest possible delivery of the latest global forecast data. As a result, forecasts with the most recent issuance time in the API can be incomplete while remaining lead times are still being populated.

For an overview of Spire’s forecast refresh rates and the difference between issuance times and lead times, see Forecast Resolution, Range, and Refresh Rate.

When Complete Forecasts Matter

Some use cases require always having the most recent forecast data, which is why Spire issues forecasts while they are processing rather than waiting for them to complete. Other use cases require always having a complete forecast issuance.

In those situations, use one of these approaches:

Option 1: Specify the Previous Issuance Time

Explicitly request the previous issuance time through the API. Both the Point API and File API support the issuance_time parameter.

Example — Point API:

https://api.wx.spire.com/forecast/point?lat=42.32717&lon=-91.62078&issuance_time=2020-04-28T00:00:00Z

Update the issuance time to a recent value that is available in the API at the time of your request.

Option 2: Wait for the Latest Forecast to Finish

Check the size of the returned data array against the expected size for your time bundle. Only treat the forecast as complete when the count matches.

Expected forecast sizes by time bundle:

Time BundleLead Times (00/12 UTC)Lead Times (06/18 UTC)Description
hourly49251-hour intervals from 0 to 48 hours (0 to 24 hours for 06/18 UTC)
3_hourly4193-hour intervals from 0 to 120 hours (0 to 24 hours for 06/18 UTC)
6_hourly2956-hour intervals from 0 to 168 hours (0 to 24 hours for 06/18 UTC)
6_hourly_extended4156-hour intervals from 0 to 240 hours (0 to 24 hours for 06/18 UTC)
6_hourly_15day6156-hour intervals from 0 to 360 hours (0 to 24 hours for 06/18 UTC)

Example — Python:

EXPECTED_SIZE = {
    # (time_bundle, issuance hour) -> number of lead times
    ('hourly', 0): 49, ('hourly', 12): 49, ('hourly', 6): 25, ('hourly', 18): 25,
    ('3_hourly', 0): 41, ('3_hourly', 12): 41, ('3_hourly', 6): 9, ('3_hourly', 18): 9,
    ('6_hourly', 0): 29, ('6_hourly', 12): 29, ('6_hourly', 6): 5, ('6_hourly', 18): 5,
    ('6_hourly_extended', 0): 41, ('6_hourly_extended', 12): 41, ('6_hourly_extended', 6): 5, ('6_hourly_extended', 18): 5,
    ('6_hourly_15day', 0): 61, ('6_hourly_15day', 12): 61, ('6_hourly_15day', 6): 5, ('6_hourly_15day', 18): 5,
}

def get_expected_forecast_size(time_bundle, issuance_hour):
    return EXPECTED_SIZE.get((time_bundle, issuance_hour))

A code sample using the File API demonstrates downloading forecast files only once the full forecast has finished populating. Replace the legacy time bundle name in that sample with 6_hourly.

See Also