geocaml / carbon-intensity

An HTTP client for accessing various carbon intensity APIs
MIT License
25 stars 1 forks source link

French data #6

Closed patricoferris closed 1 year ago

patricoferris commented 1 year ago

@maiste suggested looking at https://data.rte-france.com/ for data from France.

emillon commented 1 year ago

I managed to get the data from the eco2mix-national-tr dataset. Here's a python sample that displays the latest value:

import requests

url = "https://odre.opendatasoft.com/api/explore/v2.0/catalog/datasets/eco2mix-national-tr/records"
r = requests.get(
    url,
    params={
        "limit": 1,
        "order_by": "date_heure desc",
        "where": "taux_co2 is not null",
        "select": "taux_co2",
    },
)

d = r.json()
print(d["records"][0]["record"]["fields"]["taux_co2"])

There's also https://www.rte-france.com/themes/swi/xml/power-co2-emission-fr.xml but it seems less public.

I wanted to contribute an OCaml version but I can't get the current version to build. What version of cohttp-eio is necessary?

patricoferris commented 1 year ago

Amazing thank you! Trying to fix things in https://github.com/geocaml/carbon-intensity/pull/7

patricoferris commented 1 year ago

Should be fixed in main now