Closed fershad closed 1 year ago
@mrchrisadams this PR sets up CO2.js to be a data source for annual country-level marginal & average grid intensity data. This means that folks can import grid intensity data into their code, and use it for different purposes.
I've adjusted the output JS data generated from the Ember & UNFCCC files to include a few extra properties (type
, source
, year
) for context. These comes along with the data
object, and so they can also be accessed & used once imported.
const tgwf = require('@tgwf/co2');
const { averageIntensity } = tgwf;
const { data, type, source, year } = averageIntensity;
const taiwan = data.twn; // Or const { twn } = data;
This looking nice @fershad, thanks!
I'll be able to look in more detail next week, and I'll give it a more detailed code review.
In the meantime, I wanted to draw your attention to this PR, as it'll give an idea of one of the use cases we might need to accomodate for in the developer documentation.
I met some of the Firefox profiler team last week in Berlin, and they showed me how their new energy metrics work in the profiler.
I've had a pass at extending the firefox profiler and devtools to expose some carbon emissions figures, and I think we can use CO2.js to provide numbers inside the browser wherever we have information about energy usage.
I made a PR below largely as an experiment, but it might make a nice example of where this data can end up.
@mrchrisadams I've updated this PR to use uppercase Alpha-3 ISO country codes.
I've also updated the readme & changelog to reflect the upcoming changes to the library.
I will merge this change, and once that is done we are ready for v0.11.0 release to happen next Monday (October 3rd, 2022) as discussed. I have prepared this release note which we can share over the next few days to let folks know what's coming up: https://www.thegreenwebfoundation.org/news/release-guide-co2-js-v0-11/
This PR exposes annual average and marginal grid intensity data to the CO2.js library. It will allow users to use CO2.js as a source to import country-level grid intensity data into their code. They would do so using something like the code snippet below.
To facilitate this, I have had to make changes to where the minified data files reside in the code. Previously (in #102) they were in
data/output
. Now, the minified data files reside insrc/data
.