thegreenwebfoundation / co2.js

An npm module for accessing the green web API, and estimating the carbon emissions from using digital services
Other
385 stars 48 forks source link

Use latest WORLD grid intensity #140

Closed fershad closed 1 year ago

fershad commented 1 year ago

Currently, CO2.js has a fixed constant for global grid intensity of 442 grams GLOBAL_GRID_INTENSITY=442. However, Ember's latest figures for World grid intensity is 435.99 (good job world at moving the needle in the right direction).

Rather than having to manually update the GLOBAL_GRID_INTENSITY constant each time Ember makes a data update, we should look to use the average grid intensity data that already exists inside of CO2.js. This would allow us to always use the latest global grid intensity, with minimum effort required to keep it up to date.

The GLOBAL_GRID_INTENSITY variable is set in https://github.com/thegreenwebfoundation/co2.js/blob/97d575e0f62db3269a0eb153462c29064774ee26/src/constants/index.js#L17

fershad commented 1 year ago

CO2.js patch release (0.13.3)

PrathumP commented 1 year ago

Hi @fershad I'd like to work on this, could you please assign it to me.

fershad commented 1 year ago

Thanks @PrathumP ~~

To help you get started, the averageIntensity data to use is already exported from src/index.js. You should be able to import this & use it in the constants file.

Please create a Pull Request when you've started. We can then use that space if you need help with implementation.

PrathumP commented 1 year ago

I've implemented the required changes. Please let me know if anything else needs to be done.

fershad commented 1 year ago

Thanks @PrathumP. I've left a comment in the PR with some changes that are needed https://github.com/thegreenwebfoundation/co2.js/pull/142/files

PrathumP commented 1 year ago

I'm sorry but I am unable to find your comment in the PR.

fershad commented 1 year ago

@PrathumP I've copied the comment from the code review into the PR.

fershad commented 1 year ago

Fixed with #142