thegreenwebfoundation / co2.js

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

Ca dw/swd calculations #87

Closed mrchrisadams closed 2 years ago

mrchrisadams commented 2 years ago

This is a sanity check PR to work out why the numbers in #85 seem to be coming up strange results.

mrchrisadams commented 2 years ago

If it helps, you can spin up a workspace with gitpod to play with these numbers by following the link below.

You need an account with gitpod, but that's free to set up.

https://gitpod.io/#https://github.com/thegreenwebfoundation/co2.js/pull/87

mrchrisadams commented 2 years ago

OK, I've switched the constants around so that the first time load uses the 0.75 figure, and the subsequent loads use the 0.25 figure.

As I understand it, this ought to match the approach documented on the SWD page too, and should mean that the number per page ought to be 0.57 using the v9 model.

The v8 version still gives the lower figure of 0.2 - this might explain why @drydenwilliams picked up the difference.

drydenwilliams commented 2 years ago

Just thought we can improve over time, so let's get this merged in @mrchrisadams

mrchrisadams commented 2 years ago

OK @drydenwilliams - agreed. I'll merge this in, so we can get a new release, and then a make an issue to refactor this.