REBASE SDK
create(site_config)
create
Create a new site
forecast(site_id[, type])
forecast
Get the latest forecast for a site
get(site_id)
get
Get a site by id
delete(site_id)
delete
Delete a site
list()
list
List all of your sites
status(site_id)
status
Get the training status of your site.
train(site_id)
train
Start training for your site
upload(site_id, df)
upload
Upload observed data for your site.
rebase.
Site
site_config (dict) – config for site to create
the site id for the newly created site
str
rebase.InvalidUsageError – if site_config is missing some required fields
Example:
>>> site_config = { 'latitude': 51, 'longitude': 7 } >>> site_id = rb.Site.create(site_config) >>> print(site_id) 4ab82692-3944-4069-9cbb-f9c59513c1c3
site_id (str) – id of site to delete
rebase.NotFoundError – if specified site does not exist
>>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> rb.Site.delete(site_id) Success. Site: 4ab82692-3944-4069-9cbb-f9c59513c1c3 was deleted.
site_id (str) – id of the site
type (str) –
type of forecast to return
prioritized returns best forecast at the time
prioritized
ai only returns AI forecasts
ai
physical only returns physical forecasts
physical
Default prioritized
Returns a dict with the following format:
{ 'type' (str): # type same as params, 'ref_time' (DateTime): # date when forecast data updated, 'df' (pandas.DataFrame): # dataframe with forecast data }
>>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> data = rb.Site.forecast(site_id) >>> print(data['df']) forecast valid_time 2020-10-14 00:00:00+00:00 77.3 2020-10-14 00:15:00+00:00 86.1 ... ... 2020-10-17 23:30:00+00:00 87.0 2020-10-17 23:45:00+00:00 86.6
dict
site_id (str) – the id of the site
the config of the site
>>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> site_config = rb.Site.get(site_id) >>> print(site_config) { 'site_id': '4ab82692-3944-4069-9cbb-f9c59513c1c3', 'type': 'solar' }
list with one dict per site
>>> sites = rb.Site.list() >>> print(sites) [ {'site_id': ..., }, # site 1 ..., {'site_id': ...}, # site N ]
List
site_id (str) – id of site to get status of
Returns a dict with the training status.
Possible states:
queued - training is queued
queued
training - is currently training
training
complete - training is complete
complete
retry - training failed but is retrying
retry
failed - training failed (no more retry)
failed
>>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> rb.Site.status(site_id) { 'status': 'complete', 'history': [ {'state': 'queued', 'timestamp_utc': '2020-10-12 13:04:17'}, {'state': 'training', 'timestamp_utc': '2020-10-12 13:04:22'}, {'state': 'complete', 'timestamp_utc': '2020-10-12 13:05:23'}, ] }
site_id (str) – id of site to train
rebase.TrainingNotReadyError – if you have not uploaded observation data to train on for this site
>>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> rb.Site.train(site_id)
Upload observed data for your site. This data is used when training a model.
site_id (str) – id of site to upload data for
df (pandas.DataFrame) –
DataFrame with the following format
>>> valid_time observation 0 2020-01-22 00:00:00+00:00 126.3 1 2020-01-22 00:15:00+00:00 122.7 . ... ... n-1 2020-10-17 23:30:00+00:00 169.2 n 2020-10-17 23:45:00+00:00 176.6
>>> import pandas as pd >>> site_id = '4ab82692-3944-4069-9cbb-f9c59513c1c3' >>> df = pd.read_csv('example_data.csv') >>> rb.Site.upload(site_id, df) Success!
There are currently 4 different supported types of sites:
Solar
Wind
Localized weather
Electricity demand
Each of them requires a specific configuration when being created from rb.Site.create(), which you can find below.
Attribute
Description
type
Type of site (must be solar in this case)
solar
string
name
Name to give your site
latitude
Latitude of your site, ranging from 29.5 to 70.5
29.5
70.5
float
longitude
Longitude of your site, ranging from -23.5 to 45.0
-23.5
45.0
azimuth
Orientation of your solar panels,
North = 0, East = 90, South = 180, West = 270 degrees
North = 0, East = 90, South = 180, West = 270
tilt
Tilt of your solar panels
0 to 90 degrees
0
90
capacity
Capacity of your site. Should be an array containing one object for each capacity change on this format:
[{value: v0, validFrom: d0}, ..., {value: vn, validFrom: dn}]
value of value key must be the capacity in kW as a float
value
value of validFrom key must be an ISO 8601 formatted date string from when the capacity is valid from
validFrom
JSON array of JSON objects
{ 'type': 'solar', 'name': 'My solar site', 'latitude': 53.41, 'longitude': 5.94, 'azimuth': 171.3, # 0 = North, 90 = East, 180 = South, 270 = West 'tilt': 10.3, 'capacity': [ {'value': 750.5, 'validFrom': '2019-10-10T00:00:00Z'}, # capacity of site changed to 750.5 kW at this date {'value': 500.3, 'validFrom': '2019-04-03T00:00:00Z'}, # site was installed at this date ], }
Type of site (must be wind in this case)
wind
{ 'type': 'wind', 'name': 'My wind site', 'latitude': 53.41, 'longitude': 5.94, 'capacity': [ {'value': 4000, 'validFrom': '2019-10-10T00:00:00Z'}, # capacity of site changed to 4000 kW at this date {'value': 2000, 'validFrom': '2019-04-03T00:00:00Z'}, # site was installed at this date ], }
Type of site (must be localized in this case)
localized
measurement
The type of measurement data to predict
Must be one of:
WindSpeed / Temperature / CloudCover
{ 'type': 'localized', 'name': 'My localized site', 'latitude': 53.41, 'longitude': 5.94, 'measurement': 'WindSpeed' }
Type of site (must be load in this case)
load
nwps
An array of one or more NWPS to train on
Must be one or more of:
DWD_ICON-EU
NCEP_GFS
JSON array of strings
variables
Array of NWP variables and lags to use in training
Available variables:
Temperature
SolarDownwardRadiation
WindSpeed
WindDirection
CloudCover
Each variable can have an optional array of lags with values in range -24 to 24
-24
24
Array of calendar features that should be included in training
Available features:
holidays - If the model should take public holidays into account
holidays
hourOfDay - If the model should take into account which hour of the day it is
hourOfDay
dayOfWeek - If the model should take into account which day of the week it is
dayOfWeek
weekOfYear - If the model should take into account which week of the year it is
weekOfYear
JSON array of JSON strings
{ 'type': 'load', 'name': 'My load site', 'latitude': 53.41, 'longitude': 5.94, 'nwps': ['DWD_ICON-EU', 'NCEP_GFS'], 'variables': [ {'name': 'Temperature', 'lag': [-4, -3, -2, -1, 1, 2, 3, 4]}, {'name': 'SolarDownwardRadiation'}, ], 'calendar': ['holidays', 'hourOfDay'], }