mlco2 / mlco2/codecarbon

Update CodeCarbon data

Open
#503 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue P1
Dominant language
Python
Stars
1.9k
Forks
323
Avg merge
1d 12h
Merged PRs (30d)
12

Description

My understanding is that CodeCarbon can (with some limitations) read real-time power consumption by CPUs and GPUs. From this, and integrating over time, the energy consumed is calculated (e.g. kWh).
My understanding is that CC then uses a basic lookup to convert kWh to CO2_eq. It appears this is by using static data (https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/private_infra/global_energy_mix.json).

It would be much better to use dynamic data e.g. from electricitymaps, WattTime etc. How would I go about doing this?

Secondly the data for UK in the above json file states a CI of "268.329" (is this g CO2_eq per kWh?) with a date of "2021". Where, UK Gov website (https://view.officeapps.live.com/op/view.aspx?src=https%3A%2F%2Fassets.publishing.service.gov.uk%2Fmedia%2F61ee7495e90e07037c8d6176%2Fconversion-factors-2021-condensed-set-most-users.xls&wdOrigin=BROWSELINK avail from https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2021) for 2021 data has a figure of 212.33 gCO2_eq per kWh for UK electricity on average for 2021

More importantly there is now updated annual average for UK, see
https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with codecarbon/data/private_infra/global_energy_mix.json and trace where its country values are read and converted into CO2 estimates. Compare the UK entry with the linked government data, then assess how electricitymaps or WattTime could supply dynamic values; done means the source behavior and updated UK data are defined and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.