Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add co2 equivalences in text report #97

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,28 @@ class CO2FootprintFactory implements TraceObserverFactory {
co2eSummaryFile.println("Total CO2e footprint measures of this workflow run")
co2eSummaryFile.println("CO2e emissions: ${HelperFunctions.convertToReadableUnits(total_co2,3)}g")
co2eSummaryFile.println("Energy consumption: ${HelperFunctions.convertToReadableUnits(total_energy,3)}Wh")

List equivalences = computeCO2footprintEquivalences()
List<GString> readableEquivalences = new ArrayList<GString>();
if (equivalences[0]){
tillenglert marked this conversation as resolved.
Show resolved Hide resolved
readableEquivalences.add("- ${HelperFunctions.convertToScientificNotation(equivalences[0])} km travelled by car")
}
if (equivalences[1]){
readableEquivalences.add("- Monthly co2 absorption of ${HelperFunctions.convertToScientificNotation(equivalences[1])} trees")
}
if (equivalences[2]){
readableEquivalences.add("- ${HelperFunctions.convertToScientificNotation(equivalences[2])} flights from paris to london")
}
if (equivalences[3]){
readableEquivalences.add("- ${HelperFunctions.convertToScientificNotation(equivalences[3])}% of a flight from paris to london")
}
if (readableEquivalences.any()) {
co2eSummaryFile.println("\nWhich equals: ")
for (var readableEquivalence : readableEquivalences) {
co2eSummaryFile.println(readableEquivalence)
}
}

co2eSummaryFile.println("\nThe calculation of these values is based on the carbon footprint computation method developed in the Green Algorithms project.")
co2eSummaryFile.println("Lannelongue, L., Grealey, J., Inouye, M., Green Algorithms: Quantifying the Carbon Footprint of Computation. Adv. Sci. 2021, 2100707. https://doi.org/10.1002/advs.202100707")
co2eSummaryFile.println()
Expand Down
Loading