geocaml / carbon-intensity

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

Energy grids and countries does not map one-to-one #9

Closed reynir closed 1 year ago

reynir commented 1 year ago

In the code ISO 3166-1 alpha-2 is used to select the energy grid: https://github.com/geocaml/carbon-intensity/blob/778fe7554b9df1dd282fe296aa534469568d15a1/src/carbon.mli#L33-L35

Some countries have multiple energy grids, for example Denmark (2), Sweden (4), Norway (5), USA (way too many). Even the UK has has one for Great Britain, one for Orkney Islands, one for Northern Ireland etc., and the ISO 3166-1 alpha-2 code GB includes Northern Ireland. For Denmark the difference is not insignificant. Right now the carbon intensity in West Denmark is 84g while in East Denmark it is 96g (according to https://app.electricitymaps.com/map).

I don't know what a good alternative is, and for many countries it's probably "close enough".

patricoferris commented 1 year ago

Hey @reynir,

Thanks for the issue, I agree this is a little confusing and I think I naively just went with what the API looked like it offered rather than digging any deeper. I've opened #10 which reconfigures to use the Zones that they provide.

the ISO 3166-1 alpha-2 code GB includes Northern Ireland.

Wow I had no idea ^^"

I don't know what a good alternative is, and for many countries it's probably "close enough".

The finer-grained the better I think. For example, we should really be using East England for machines in Cambridge if you take a look at the GB map here: https://carbonintensity.org.uk. The renewable energy in Scotland really skews the average for GB...

reynir commented 1 year ago

Very nice! I think that PR is excellent. The difference between Scotland and the rest of GB is quite chocking!