What are historical forecasts

When a forecast is generated it is stored in a data base and can be retrieved at a later time. The issue/update time of the forecast is also stored. Therefore, it is possible to do ex-post forecast error analysis when the actual generation or demand data become available.

How to query historical forecasts

To query historical forecasts you will need to provide the following requests parameters.

Start date start_date
Specify the starting target period of the forecast.
Example: "2024-10-18 00:00"

End date end_date
Specify the ending target period of the forecast.
Example: "2024-10-18 23:00"

Reference time as_of
Specify the reference time. The API will return the most recent forecasts which were available at the reference time and cover the period between start_date and end_date. If not provided, then by default the request time is considered as reference time.
Example: "2024-10-17 12:00"

Time zone tz
Specify the time zone. The default time zone is UTC.
Example: "CET"

In the example below we want to query the forecasts for solar site with ID a923653c-26f1-1b29-955d-ffde5d182276 for the period between 2024-06-28 00:00 and 2024-06-28 01:00 which were available at 11:00 in the morning the previous day. All times are in UTC.

Get historical forecast
import requests

api_key = "Your API key" # Set your API key
site_id = "a923653c-26f1-1b29-955d-ffde5d182276" # Set the site ID
start_date = "2024-06-28 00:00" # Set the start date
end_date = "2024-06-28 01:00" # Set the end date
as_of = "2024-06-27 11:00" # Set the reference time


url = f"https://api.rebase.energy/platform/v2/sites/{site_id}/forecast"
headers = {"Authorization": api_key, "Content-Type": "application/json"}
params={
	'start_date': start_date,
	'end_date': end_date,
	'as_of': as_of
}

response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
response = response.json()
Response example
{
    "valid_time": [
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:15:00Z",
        "2024-06-28T00:30:00Z",
        "2024-06-28T00:45:00Z",
        "2024-06-28T01:00:00Z"
    ],
    "forecast": [
        0.0,
        0.0,
        0.0,
        0.0,
        0.0
    ],
    "model_name": [
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical"
    ],
    "model_version": [
        1,
        1,
        1,
        1,
        1
    ],
    "update_time": [
        "2024-06-27T06:00:00Z",
        "2024-06-27T06:00:00Z",
        "2024-06-27T06:00:00Z",
        "2024-06-27T06:00:00Z",
        "2024-06-27T06:00:00Z"
    ]
}

The response is a serialized table with the following columns:
valid_time: It contains the target times, i.e. the periods which are forecasted.
forecast: It contains the forecast values.
model_name: It contains the names of the models which create the forecasts.
model_version: It contains the versions of the models which create the forecasts.
update_time: It contains the issue/update time, i.e. the time when the forecasts were updated.

As it can be seen from the response, the update time for the specific forecasts is 2024-06-27 06:00 UTC. This is the latest available forecast for the specific target periods issued before 2024-06-27 11:00 UTC.

If the reference time is omitted, the request time is considered as reference time. In this case the API returns the most recent forecast update which was issued at 2024-06-28 00:00 UTC.

Response example
{
    "valid_time": [
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:15:00Z",
        "2024-06-28T00:30:00Z",
        "2024-06-28T00:45:00Z",
        "2024-06-28T01:00:00Z"
    ],
    "forecast": [
        0.0,
        0.0,
        0.0,
        0.0,
        0.0
    ],
    "model_name": [
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical",
        "Solar_MetOfficeGlobalHiRes_Physical"
    ],
    "model_version": [
        1,
        1,
        1,
        1,
        1
    ],
    "update_time": [
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:00:00Z",
        "2024-06-28T00:00:00Z"
    ]
}

How to query the update times

To query the update times you need to provide the ID of the site. The API will return all the update times of the forecasts that were generated for the specific site.

Get update times
import requests

api_key = "Your API key" # Set your API key
site_id = "a923653c-26f1-1b29-955d-ffde5d182276" # Set the site ID

url = f"https://api.rebase.energy/platform/v2/sites/{site_id}/forecast/updates"
headers = {"Authorization": api_key, "Content-Type": "application/json"}

response = requests.get(url, headers=headers)
response.raise_for_status()
response = response.json()
Response example
['2024-06-27T00:00:00Z',
 '2024-06-27T06:00:00Z',
 '2024-06-27T12:00:00Z',
 '2024-06-27T18:00:00Z',
 '2024-06-28T00:00:00Z',
 '2024-06-28T06:00:00Z',
 '2024-06-28T12:00:00Z',
 '2024-06-28T18:00:00Z',
 '2024-06-29T00:00:00Z',
 '2024-06-29T06:00:00Z',
 '2024-06-29T12:00:00Z']