Sites
Get forecast
Get site forecast
To query a forecast, use the following python code:
import requests
import pandas as pd
site_id = 'Put the site ID here'
url = f'https://api.rebase.energy/platform/v2/sites/{site_id}/forecast'
start_date = pd.to_datetime('2024-06-28T06:15').strftime('%Y-%m-%d %H:%M')
end_date = pd.to_datetime('2024-06-28T07:15').strftime('%Y-%m-%d %H:%M')
ref_time = pd.to_datetime('2024-06-28T00:00').strftime('%Y-%m-%d %H:%M')
tz = 'UTC'
params={
'start_date': start_date,
'end_date': end_date,
'ref_time': ref_time,
'tz': tz
}
response = requests.get(url=url, headers=headers, params=params)
response.raise_for_status()
response = response.json()
Response example
{
"forecast": [
0.11206686960981,
0.140317812698395,
0.162892523432014,
0.185522487912443,
0.225405469535368
],
"model_name": [
"Solar_MetOfficeGlobalHiRes_Physical",
"Solar_MetOfficeGlobalHiRes_Physical",
"Solar_MetOfficeGlobalHiRes_Physical",
"Solar_MetOfficeGlobalHiRes_Physical",
"Solar_MetOfficeGlobalHiRes_Physical"
],
"model_version": [
1.0,
1.0,
1.0,
1.0,
1.0
],
"ref_time": [
"2024-06-28T00:00:00+0000",
"2024-06-28T00:00:00+0000",
"2024-06-28T00:00:00+0000",
"2024-06-28T00:00:00+0000",
"2024-06-28T00:00:00+0000"
],
"valid_time": [
"2024-06-28T06:15:00+0000",
"2024-06-28T06:30:00+0000",
"2024-06-28T06:45:00+0000",
"2024-06-28T07:00:00+0000",
"2024-06-28T07:15:00+0000"
]
}