Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Energy mix per country #513

Open
bourdeet opened this issue Mar 7, 2024 · 3 comments
Open

Dynamic Energy mix per country #513

bourdeet opened this issue Mar 7, 2024 · 3 comments
Labels
enhancement New feature or request P2 Priority 2

Comments

@bourdeet
Copy link

bourdeet commented Mar 7, 2024

Hello!

I have noticed in Denmark that the national electricity grid manager provides an API to track, among other things, the evolution of the energy mix in realtime: https://www.energidataservice.dk/tso-electricity/DeclarationGridmix

I was thinking of using this data source as a replacement for global_energy_mix.json, when computing CO2 emissions.

Have you already considered a method for people to include different APIs of this kind as plugins? I noticed another related question regarding using ElectricityMap, but it would be interesting to incorporate data from freely accessible API than rely on commercial ones.

cheers,

Étienne

@LuisBlanche
Copy link
Contributor

Hi Etienne, thanks for using CodeCarbon. It would mean a lot of maintenance to handle a different API for each country unless they all have the same standardized way of querying. On improvement I could imagine though would be to use this API to enrich a more detailed static file with evolution of mix across seasons or lets be crazy the hours of the day.
Another option would be to allow any API to provide electricity data but you would need to implement a "middle man" API to ensure standardisation so that code carbon could call it the same way it does the electricitymaps API

There is a free tier access to ElectricityMaps that can acomodate small use cases.

@LuisBlanche LuisBlanche added the question Further information is requested label Mar 7, 2024
@bourdeet
Copy link
Author

bourdeet commented Mar 8, 2024

Hi Luis,

Thanks for the reply. I was indeed thinking of a middle man structure, where one could wrap different APIs into a unified call to code carbon. So I think I'll fork and explore a bit :)

have a great weekend,

Étienne

@benoit-cty
Copy link
Contributor

Hello, CodeCarbon already support this with co2_signal_api_token , see https://github.com/mlco2/codecarbon/blob/fad87d7acb11d54fa67e9af17c899d0752e3163a/codecarbon/core/co2_signal.py#L12C53-L12C73 for the code.

Indeed, like Luis said, https://www.co2signal.com/ has now moved to a free ElectricityMaps API so it will be nice to switch to it.

@benoit-cty benoit-cty added enhancement New feature or request P2 Priority 2 labels Mar 10, 2024
@LuisBlanche LuisBlanche removed the question Further information is requested label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 Priority 2
Projects
None yet
Development

No branches or pull requests

3 participants