Created
January 23, 2025 13:07
Revisions
-
thibaudcolas created this gist
Jan 23, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ import { co2 } from "@tgwf/co2"; const swdmV4 = new co2({ model: "swd", version: 4 }); // Figures as of 2025-01-23 // https://sustainablewebdesign.org/digital-carbon-ratings/ const ratings = { "A+": 272.51, A: 531.15, B: 975.85, C: 1410.39, D: 1875.01, E: 2419.56, F: 2419.57, }; /** * Re-calculate the Digital Carbon Rating Scale thresholds for each percentile transfer size, * to compare with official figures. */ Object.entries(ratings).forEach(([rating, ratingValue]) => { const estimate = swdmV4.perVisitTrace(ratingValue * 1000, false, { gridIntensity: { device: 494, dataCenter: 494, networks: 494, }, firstVisitPercentage: 1, returnVisitPercentage: 0, dataReloadRatio: 0, }); console.log(`${rating}: ${estimate.co2}`); });