About Session Forecasts¶
After downloading the raw measurements data, the next step for Forecasters is to prepare their forecasts for an open session and respective challenges (with clear start and end datetime boundaries) This involves creating forecast submissions based on the retrieved data and any additional variables or models the Forecaster might utilize.
In this example, we'll demonstrate how to prepare a simple 24-hour submission using randomly generated data. In a real-world scenario, you would replace this with your forecasting model based on the dataset retrieved in the previous step.
Note
- Example Purpose: This example demonstrates preparing a 24-hour forecast submission with 15-minute interval samples using random data. Replace this with your forecasting model for actual use.
- Quantiles: The example submission includes values for three variables, specifically 'quantiles' 10, 50, and 90.
Prerequisites
- Python Environment: Ensure you have Python installed with the necessary libraries (
pandas
,numpy
,requests
). - Access Token: A valid access token is required for authentication. Refer to the Authentication section if needed.
- Challenges List: A list of challenges retrieved from the Listing Challenges section.
How does it work?¶
Forecasters can submit forecasts for open sessions Challenges, competing for the prize money available. They may commence or stop contributing to the market at any time.
It is important that forecasters understand the following rules and guidelines when submitting forecasts:
- Submission Timing: Forecasts must be submitted before the gate closure time (10:00 CET) for that market session. Late submissions will not be considered.
- Submission Period: Market sessions are open from 00:00 to 10:00 CET daily.
- Submission Method: Forecasts are submitted to the platform's API via HTTPs requests. There is no front-end provided.
- Latest Forecast Considered: Only the latest forecast from a forecaster in a market session will be considered.
- Unique Submissions: A forecaster may not submit multiple forecasts for the same variable (e.g., two quantile 50 submissions) under the same or different forecaster IDs for the same challenge. A Forecaster can update their original submissions using a specific API endpoint. The latest valid submissions (before Gate Closure Time) will be considered.
- Forecast Coverage: Forecasts must cover the entire period mentioned in the challenge (start and end date). Given the fixed 15-minute time resolution for the submissions, Forecasters, should submit up to 96 forecasted quantities per variable (i.e., quantiles 10, 50, 90) per challenge, except for DST change days where these quantities might vary.
- Time Resolution Compliance: Forecasts must match the time resolution specified in the challenge.
- Forecast Data Format: Forecasts must be submitted in a specific format, as detailed in the Preparing a Session Forecast section.
Preparing a Session Forecast¶
Selecting a Challenge¶
First, retrieve the information about the challenge you want to submit a forecast for.
In the example below, we will select a challenge for a specific market session (open_market_session_id
) and target resource name (resource_name
).
# Get the session id from `/market/session/` endpoint
open_market_session_id = "your_open_market_session_id"
# Challenge resource identifier (name):
resource_name = "wind_farm_1"
# Request the challenges for the open market session:
response = requests.get(
url='https://predico-elia.inesctec.pt/api/v1/market/challenge',
params={'market_session': int(open_market_session_id),
'resource_name': resource_name},
headers=headers
)
# Check if the request was successful
if response.status_code == 200:
challenges = response.json()
else:
print("Failed to retrieve challenges.")
print(f"Status code: {response.status_code}")
exit()
# Select the first challenge of the list of challenges previous retrieved
# Note that as we're filtering by resource_name, there should be only a
# single challenge per session
selected_challenge = challenges["data"][0]
# Unpack selected challenge information
resource_id = selected_challenge["resource"] # challenge resource UUID
challenge_id = selected_challenge["id"] # challenge UUID
start_datetime = selected_challenge["start_datetime"] # first forecast leadtime
end_datetime = selected_challenge["end_datetime"] # last forecast leadtime
print(f"""
Challenge info:
ID: {challenge_id}
Resource ID: {resource_id}
First forecast leadtime): {start_datetime}
Last forecast leadtime): {end_datetime}
""")
Preparing Forecast Submissions Time-series Data¶
Next, prepare the forecast data for submission.
Strict requirement!
You must submit forecasts for variables Q10, Q50 and Q90 to be selected to participate in a forecasting session. Partial submissions (e.g., missing one of the variables) will not be considered for the final evaluation / monthly payment distribuctions.
Change this submission!
In this example, our submission will be exclusively composed by random samples.
However, you should prepare your model based on the raw measurements data for the challenge resource
(see
Downloading Raw Data section), and any external information sources you might have access to.
One variable at each time
You can only submit one forecast variable in each HTTPs request (e.g., forecasts for quantile 10 in the first request and quantile 50 in the second request). After each submission, you will receive an email confirming that the forecast was successfully submitted. This also helps you to keep track of your submissions.
# Create a random 24h submission (random values):
# Generate datetime values for the challenge period:
datetime_range = pd.date_range(start=start_datetime,
end=end_datetime,
freq='15T')
datetime_range = [x.strftime("%Y-%m-%dT%H:%M:%SZ") for x in datetime_range]
# Generate random values for the "value" column
values = np.random.uniform(low=0.0, high=1.0, size=len(datetime_range))
values = [round(x, 3) for x in values]
# Reuse this data to prepare 3 different quantiles submissions Q10, Q50, Q90
submission_list = []
for qt in ["q50", "q10", "q90"]:
qt_forec = pd.DataFrame({
'datetime': datetime_range,
'value': values,
})
submission_list.append({
"variable": qt,
"forecasts": qt_forec.to_dict(orient="records")
})
# Your submissions:
print("Submission List:")
for i, submission in enumerate(submission_list):
print("-"*79)
print(f"Submission #{i+1}")
print(json.dumps(submission, indent=3))
What's next?¶
Learn how to submit your forecasts on the Predico platform in the Submitting a Session Forecast section.