knitr::opts_chunk$set( collapse= TRUE, comment = "##", fig.width = 9, fig.retina = 2, fig.path = "images/" ) library("rte.data")
Access data from RTE data portal
RTE, the french electricity transmission system operator, provides access to various data through an API on its data portal. You can retrieve those data with rte.data
.
Installation (from Github) :
remotes::install_github("dreamRs/rte.data")
To access the API, you need to create an account, or login if you have one.
Once logged, you can subscribe (create an application) to the desired API (each APIs must be subscribed individualy), you'll obtain an client id
and a client secret
(or directly a base64 encoded key). Use those to get a token :
# To create a token you can use id_client and id_secret id_client <- "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" id_secret <- "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" token <- get_token( key = list(id_client = id_client, id_secret = id_secret) ) # or the base64 encoded key key <- "TGEgZGF0YXNjaWVuY2UgYXZlYyB1biBncmFuZCBS=" token <- get_token(key)
With this token, you can query the API. You need to generate a token every ~two hours, but you can use the same key each time.
So for future use, you can store your credentials in your .Renviron
with set_key
.
Data on French electricity consumption in real time, with forecast :
short_term <- get_consumption( "short_term", start_date = Sys.Date() - 1, end_date = Sys.Date() + 1, type = c("REALISED", "D-1") ) short_term autoplot(short_term)
Data about physical cross-border schedules detailing electricity flows actually transiting across the interconnection lines directly linking countries.
balance <- get_physical_flows(start_date = Sys.Date() - 60, end_date = Sys.Date()) autoplot(balance) autoplot(balance, by_country = TRUE)
Generation data aggregated by sector and produced per group (in MW) on an intradaily basis for net generation injected into the network.
prod_type_30 <- get_actual_generation( resource = "actual_generations_per_production_type", start_date = Sys.Date() - 30, end_date = Sys.Date() ) autoplot(prod_type_30, by_day = TRUE)
active_units <- retrieve_active_units(start_date = Sys.Date() - 2, end_date = Sys.Date()) autoplot(active_units)
or see on a map :
autoplot(active_units, map = TRUE)
inst_cap <- get_open_api( api = "generation_installed_capacities", resource = "capacities_per_production_unit" ) autoplot(inst_cap)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.