Skip to content

Access data from RTE API

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

dreamRs/rte.data

Repository files navigation

rte.data

Access data from RTE data portal

R-CMD-check Lifecycle: experimental

Overview

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")

Authentication

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.

Examples

Consumption

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)

Physical flows

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)
## Warning in as.data.table.list(x, keep.rownames = keep.rownames, check.names
## = check.names, : Item 4 has 4 rows but longest item has 18; recycled with
## remainder.

autoplot(balance, by_country = TRUE)

Actual generation

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 production units

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)

Generation installed capacities

inst_cap <- get_open_api(
  api = "generation_installed_capacities",
  resource = "capacities_per_production_unit"
)

autoplot(inst_cap)

About

Access data from RTE API

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages