{"id":27275267,"url":"https://github.com/richilino/co2-toolkit-net","last_synced_at":"2025-04-11T15:48:14.732Z","repository":{"id":285975441,"uuid":"959953287","full_name":"richilino/co2-toolkit-net","owner":"richilino","description":"A simple NuGet package to calculate CO2 emissions during data transfer.","archived":false,"fork":false,"pushed_at":"2025-04-10T18:11:00.000Z","size":77,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T18:52:54.428Z","etag":null,"topics":["carbon-emissions","carbon-footprint","co2","co2-emissions","dotnet","sustainable-software","sustainable-web-design-model"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/CO2Toolkit","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richilino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-03T16:09:05.000Z","updated_at":"2025-04-10T18:09:40.000Z","dependencies_parsed_at":"2025-04-03T17:36:40.191Z","dependency_job_id":null,"html_url":"https://github.com/richilino/co2-toolkit-net","commit_stats":null,"previous_names":["richilino/co2-toolkit-net"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richilino%2Fco2-toolkit-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richilino%2Fco2-toolkit-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richilino%2Fco2-toolkit-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richilino%2Fco2-toolkit-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richilino","download_url":"https://codeload.github.com/richilino/co2-toolkit-net/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248433786,"owners_count":21102663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carbon-emissions","carbon-footprint","co2","co2-emissions","dotnet","sustainable-software","sustainable-web-design-model"],"created_at":"2025-04-11T15:48:14.180Z","updated_at":"2025-04-11T15:48:14.719Z","avatar_url":"https://github.com/richilino.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet Version](https://img.shields.io/nuget/v/CO2Toolkit)](https://www.nuget.org/packages/CO2Toolkit)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/richilino/co2-toolkit-net/badge)](https://scorecard.dev/viewer/?uri=github.com/richilino/co2-toolkit-net)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](/LICENSE.md)\n\n# :seedling: CO2 Toolkit for .NET\n\nThe **CO2Toolkit** NuGet package provides an easy way to estimate the carbon emissions associated with the consumption of digital content. This package uses the Sustainable Web Design Model V4 from [Sustainable Web Design](https://sustainablewebdesign.org/estimating-digital-emissions/) to calculate the carbon footprint based on various factors such as the amount of data transferred, the energy efficiency of data centres, networks and user devices, and the carbon intensity of the grid.\n\nWith the growing need for more sustainable digital practices, this package provides a simple and accurate way to estimate the environmental impact of digital assets, making it easier to assess and optimise the carbon emissions associated with modern .NET applications.\n\n**Key Features:**\n\n- :earth_africa: Includes recent CO2 emission data for 200+ regions of the world!\n- :rocket: State of the Art CO2 emission model!\n- :brain: Simple and easy to use!\n- :lock: Developed using modern security practices with [verifiable provenance](#provenance)!\n- :white_check_mark: [OSI approved](https://opensource.org/license/mit) and [GPL compatible](https://wiki.gentoo.org/wiki/License_groups/GPL-COMPATIBLE) license!\n\n## Usage\n\n### CO2Calculator Class\n\nThe core functionality of this package is provided by the `CO2Calculator` class, which can be used to calculate the carbon emissions for data transfers.\n\n```csharp\nusing CO2Toolkit;\n\n// Calculation based on World Average Carbon Grid Emissions (2023)\nvar co2Calculator = new CO2Calculator();\n\n// Example: Estimate emissions for 1 GB of data transfer\nvar bytesTransferred = 1_073_741_824;\nvar emissions = co2Calculator.BytesToEmission(bytesTransferred);\n\nConsole.WriteLine($\"Estimated CO2e emissions: {emissions} grams\");\n```\n\nBy default, emissions are calculated using conservative / pessimistic assumptions. If you have more detailed information about your user base and infrastructure, calculations can be further adjusted by passing the following options:\n- **greenHostingFactor [0-1]**: A value of 0 means 0% of your hosting provider's used power comes from renewable or zero-carbon sources. Conversely, a value of 1 means 100% of your hosting provider's used power comes from renewable or zero-carbon sources. *(Default: 0)*\n- **newVisitorRatio [0-1]**: A value that represents the number of website visitors who have never visited your page. *(Default: 1)*\n- **dataCacheRatio [0-1]**: The ratio of data that is cached for returning visitors. *(Default: 0)*\n\n```csharp\nvar co2Calculator = new CO2Calculator(\n    greenHostingFactor: 0.4, // 40% of power from renewables\n    newVisitorRatio: 0.5, // 50% of users have never been on your site\n    dataCacheRatio: 0.75 // 75% of content is cached for returning users\n    );\n```\n\nIf you need a more accurate calculation based on a certain geography, check if your desired region is available in the `ZoneRepository`. This will change the CO2 intensity for the _Operational Energy_ needed to transfer data.\n\n```csharp\nusing CO2Toolkit;\n\n// Calculation based on German Average Carbon Grid Emissions \nvar co2Calculator = new CO2Calculator(zone: ZoneRepository.Germany);\n\n// Example: Estimate emissions for 1 GB of data transfer\nvar bytesTransferred = 1_073_741_824;\nvar emissions = co2Calculator.BytesToEmission(bytesTransferred);\n\nConsole.WriteLine($\"Estimated CO2e emissions: {emissions} grams (${ZoneRepository.Germany.Name}, ${ZoneRepository.Germany.Year})\");\n```\n\n### Documentation\n\nRead about these features and more in our [documentation](https://github.com/richilino/co2-toolkit-net/wiki):\n* Simple Emission Calculation\n* Zones with Custom Energy Mix\n* more coming soon...\n\n## Provenance\n\nReleased package attestations can be verified using the GitHub CLI. Adjust the package name and execute the command below in the directory where the .nupkg is located.\n\n```bash\ngh attestation verify CO2Toolkit.X.X.X.nupkg --owner richilino --predicate-type https://spdx.dev/Document/v2.3 \n```\nFor more detailed attested SBOM information, pass the `--format json` argument as well.\n\n## Acknowledements\n\nAll calculations are based on averaged (yearly) CO2 intensity data from the [Ember Electricity Data Explorer (CC-BY-4.0)](https://ember-energy.org/) and are implemented using the [Sustainable Web Design Model (Version 4)](https://sustainablewebdesign.org/).\n\n## License\n\nThis package is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more details.\n\n## Contributions\n\nContributions are welcome! Please read [Contributing](/CONTRIBUTING.md) to see how you can help improve this package!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichilino%2Fco2-toolkit-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichilino%2Fco2-toolkit-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichilino%2Fco2-toolkit-net/lists"}