Package for accessing the Elexon data portal API
Project description
ElexonDataPortal
About the ElexonDataPortal Python API Wrapper
The ElexonDataPortal python wrapper is a project being developed within the UCL Energy & AI research group. It aims to provide an easy to use wrapper which enables data retrieval from a wide range of resources relating to UK electricity demand, generation and markets.
The ElexonDataPortal provides the ability to download data directly from the Elexon API and have it parsed into a user-friendly Pandas dataframe. All queries require both a stream name and query arguments, all query argument information can be found here. Previous users of Elexon data will have had to switch between many different naming conventions for query arguments, the ElexonDataPortal harmonises these so that instead of using one of say FromDate, EventStart or SettlementDate we would use start_date for all of them.
You will also have to have an Elexon API key which you will receive after registering here.
The module can be installed with
pip install ElexonDataPortal
Using the ElexonDataPortal Python API Wrapper
Making Standalone Queries
Elexon allows you to query data in a very limited fashion, often constrained to returning individual settlment periods. These queries are exposed through the default query function from the API wrapper.
stream = 'B1630'
query_args = {
'query_date' : '2019-09-25',
'SP' : 48,
}
df_RES_gen = edp_wrapper.query(stream, query_args)
df_RES_gen
timeSeriesID | businessType | powerSystemResourceType | settlementDate | settlementPeriod | quantity | documentType | processType | curveType | resolution | activeFlag | documentID | documentRevNum | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | NGET-EMFIP-AGWS-TS-00291950 | Solar generation | "Solar" | 2019-09-25 | 48 | 0 | Wind and solar generation | Realised | Sequential fixed size block | PT30M | Y | NGET-EMFIP-AGWS-00145968 | 1 |
1 | NGET-EMFIP-AGWS-TS-00291951 | Wind generation | "Wind Offshore" | 2019-09-25 | 48 | 79.657 | Wind and solar generation | Realised | Sequential fixed size block | PT30M | Y | NGET-EMFIP-AGWS-00145968 | 1 |
2 | NGET-EMFIP-AGWS-TS-00291952 | Wind generation | "Wind Onshore" | 2019-09-25 | 48 | 1342.004 | Wind and solar generation | Realised | Sequential fixed size block | PT30M | Y | NGET-EMFIP-AGWS-00145968 | 1 |
Orchestrating Multiple Queries
Where the standard query call will carry out individual requests for data from Elexon, the query orchestrator accepts a date range and repeatedly requests data over it. Alongside the start and end dates for the period in question any additional parameters which you would make in a standalone call can also be included.
stream = 'FUELHH'
query_args = {
'start_date' : '2019-09-25',
'end_date' : '2019-09-25 23:30',
}
df_generation = edp_wrapper.query_orchestrator(stream, query_args)
df_generation.head()
recordType | startTimeOfHalfHrPeriod | settlementPeriod | ccgt | oil | coal | nuclear | wind | ps | npshyd | ocgt | other | intfr | intirl | intned | intew | biomass | intnem | activeFlag | local_datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | FUELHH | 2019-09-25 | 1 | 7965 | 0 | 0 | 6598 | 4245 | 0 | 293 | 1 | 80 | 1502 | 0 | 760 | 0 | 1753 | 0 | Y | 2019-09-25 00:00:00+01:00 |
1 | FUELHH | 2019-09-25 | 2 | 7405 | 0 | 0 | 6596 | 4376 | 0 | 292 | 1 | 79 | 1504 | 0 | 758 | 0 | 1756 | 0 | Y | 2019-09-25 00:30:00+01:00 |
2 | FUELHH | 2019-09-25 | 3 | 7423 | 0 | 0 | 6595 | 4243 | 0 | 290 | 2 | 80 | 1502 | 0 | 758 | 0 | 1758 | 0 | Y | 2019-09-25 01:00:00+01:00 |
3 | FUELHH | 2019-09-25 | 4 | 7574 | 0 | 0 | 6600 | 4020 | 0 | 301 | 2 | 78 | 1504 | 0 | 758 | 0 | 1755 | 0 | Y | 2019-09-25 01:30:00+01:00 |
4 | FUELHH | 2019-09-25 | 5 | 7811 | 0 | 0 | 6596 | 3920 | 0 | 280 | 1 | 77 | 1502 | 0 | 758 | 0 | 1754 | 0 | Y | 2019-09-25 02:00:00+01:00 |
We Need Your Help!
Currently a number of commonly used streams are included as part of the module. Unfortunately as there are over 100 streams in total, and as Elexon is planning a new data Foundation Platform, it was not deemed viable to initially include each and every stream. Instead the module has been made to be extendable so that new streams can be added for those who require them. If you add new streams please make a Git request to add them to the main module!
Information for each stream is laid out in the format below. The request type refers to whether the existing Elexon API queries data on a settlement period by settlement period basis or by accepting a date range. The required params is a dictionary which maps this modules harmonised names (e.g. query_date and SP) to the Elexon data stream param names (e.g. SettlementDate, SettlementPeriod) which vary from stream to stream.
'DETSYSPRICES' : {
'name' : 'Detailed System Prices',
'request_type' : 'SP_by_SP',
'data_parse_type' : 'dataframe',
'API_version' : '1',
'optional_params' : None,
'required_params' : {
'query_date' : 'SettlementDate',
'SP' : 'SettlementPeriod',
},
},
We are also looking for any contributions for data cleaners and plotters which can be used for specific streams. Currently these are limited to just Balancing Market streams.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ElexonDataPortal-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a65abd637147302d4d905e9039e16a321bbe70a130f1f57d2ec1eac0c1f09a |
|
MD5 | 6ff32a2f19520c075bc44c4cd92bc10a |
|
BLAKE2b-256 | eb9a8ae9016cee4dec6b8a805a6b29a1e56eb1a57d1842be1a1d4645bc8112ce |