From ac639ff600a0eebc4a371852ae6c74f71eb9860e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20Hag=20L=C3=B8vstad?= Date: Fri, 13 Sep 2024 11:19:47 +0200 Subject: [PATCH 1/2] Updated default intensities to 2023 data --- carbontracker/data/carbon-intensities.csv | 374 +++++++++++----------- 1 file changed, 188 insertions(+), 186 deletions(-) diff --git a/carbontracker/data/carbon-intensities.csv b/carbontracker/data/carbon-intensities.csv index a6ebe2f..9dedb1c 100644 --- a/carbontracker/data/carbon-intensities.csv +++ b/carbontracker/data/carbon-intensities.csv @@ -1,188 +1,190 @@ alpha-2,Entity,Code,Year,Carbon intensity of electricity (gCO2/kWh) -AE,United Arab Emirates,ARE,2020,427.86282 -AF,Afghanistan,AFG,2020,115.38463 -AG,Antigua and Barbuda,ATG,2020,687.5 -AL,Albania,ALB,2020,24.482107 -AM,Armenia,ARM,2021,206.94258 -AO,Angola,AGO,2020,168.86728 -AR,Argentina,ARG,2021,347.29196 -AS,American Samoa,ASM,2020,733.3333 -AT,Austria,AUT,2021,81.25418 -AU,Australia,AUS,2021,486.25497 -AW,Aruba,ABW,2020,579.5454 -AZ,Azerbaijan,AZE,2021,481.51907 -BA,Bosnia and Herzegovina,BIH,2021,478.45804 -BB,Barbados,BRB,2020,670.103 -BD,Bangladesh,BGD,2021,446.66843 -BE,Belgium,BEL,2021,139.7274 -BF,Burkina Faso,BFA,2020,631.25 -BG,Bulgaria,BGR,2021,419.39273 -BH,Bahrain,BHR,2020,489.95312 -BI,Burundi,BDI,2021,312.5 -BJ,Benin,BEN,2020,652.17395 -BR,Brazil,BRA,2021,141.77426 -BS,Bahamas,BHS,2020,698.49243 -BT,Bhutan,BTN,2020,23.463686 -BW,Botswana,BWA,2020,800.0 -BY,Belarus,BLR,2021,443.62558 -BZ,Belize,BLZ,2020,474.57626 -CA,Canada,CAN,2021,118.99668 -CF,Central African Republic,CAF,2020,0.0 -CG,Congo,COG,2020,364.14563 -CH,Switzerland,CHE,2021,57.772644 -CK,Cook Islands,COK,2020,500.0 -CL,Chile,CHL,2021,374.46323 -CM,Cameroon,CMR,2020,243.7071 -CN,China,CHN,2021,541.3317 -CO,Colombia,COL,2020,192.62947 -CR,Costa Rica,CRI,2021,30.903326 -CU,Cuba,CUB,2020,575.9049 -CY,Cyprus,CYP,2021,587.49805 -CZ,Czechia,CZE,2021,412.24548 -DE,Germany,DEU,2021,352.42252 -DJ,Djibouti,DJI,2020,800.0 -DK,Denmark,DNK,2021,149.74605 -DM,Dominica,DMA,2020,500.0 -DO,Dominican Republic,DOM,2020,605.7243 -DZ,Algeria,DZA,2020,449.74878 -EC,Ecuador,ECU,2021,137.54825 -EE,Estonia,EST,2021,739.8695 -EG,Egypt,EGY,2021,389.0191 +AE,United Arab Emirates,ARE,2022,561.1348 +AF,Afghanistan,AFG,2022,132.53012 +AG,Antigua and Barbuda,ATG,2022,611.1111 +AL,Albania,ALB,2022,24.285715 +AM,Armenia,ARM,2022,264.53815 +AO,Angola,AGO,2022,174.73436 +AR,Argentina,ARG,2023,354.10287 +AS,American Samoa,ASM,2022,611.1111 +AT,Austria,AUT,2023,110.81243 +AU,Australia,AUS,2023,548.69226 +AW,Aruba,ABW,2022,561.2245 +AZ,Azerbaijan,AZE,2022,671.38904 +BA,Bosnia and Herzegovina,BIH,2023,600.00006 +BB,Barbados,BRB,2022,605.5046 +BD,Bangladesh,BGD,2023,691.4112 +BE,Belgium,BEL,2023,138.1068 +BF,Burkina Faso,BFA,2022,467.5325 +BG,Bulgaria,BGR,2023,335.3338 +BH,Bahrain,BHR,2022,904.6145 +BI,Burundi,BDI,2022,250.00002 +BJ,Benin,BEN,2022,584.0708 +BM,Bermuda,BMU,2022,650.79364 +BR,Brazil,BRA,2023,98.34824 +BS,Bahamas,BHS,2022,660.0986 +BT,Bhutan,BTN,2022,23.333334 +BW,Botswana,BWA,2022,847.9087 +BY,Belarus,BLR,2022,441.74 +BZ,Belize,BLZ,2022,225.80646 +CA,Canada,CAN,2023,170.04251 +CF,Central African Republic,CAF,2022,0.0 +CG,Congo,COG,2022,700.0 +CH,Switzerland,CHE,2023,34.842716 +CK,Cook Islands,COK,2022,250.0 +CL,Chile,CHL,2023,291.1135 +CM,Cameroon,CMR,2022,305.4187 +CN,China,CHN,2023,582.31696 +CO,Colombia,COL,2023,259.51117 +CR,Costa Rica,CRI,2023,53.377815 +CU,Cuba,CUB,2022,637.6096 +CY,Cyprus,CYP,2023,534.3229 +CZ,Czechia,CZE,2023,449.72433 +DE,Germany,DEU,2023,380.95047 +DJ,Djibouti,DJI,2022,692.3078 +DK,Denmark,DNK,2023,151.6503 +DM,Dominica,DMA,2022,529.4118 +DO,Dominican Republic,DOM,2022,580.7799 +DZ,Algeria,DZA,2022,634.611 +EC,Ecuador,ECU,2023,150.22354 +EE,Estonia,EST,2023,416.6667 +EG,Egypt,EGY,2023,570.30554 EH,Western Sahara,ESH,2009,666.6666 -ER,Eritrea,ERI,2020,659.0909 -ES,Spain,ESP,2021,169.03445 -ET,Ethiopia,ETH,2020,25.441698 -FI,Finland,FIN,2021,68.833595 -FJ,Fiji,FJI,2020,292.92926 -FR,France,FRA,2021,58.4792 -GA,Gabon,GAB,2020,294.91525 -GB,United Kingdom,GBR,2021,264.5091 -GD,Grenada,GRD,2020,700.0 -GE,Georgia,GEO,2021,111.374405 -GF,French Guiana,GUF,2020,350.51547 -GH,Ghana,GHA,2020,355.04724 -GL,Greenland,GRL,2020,118.644066 -GM,Gambia,GMB,2020,689.65515 -GN,Guinea,GIN,2020,175.0 -GP,Guadeloupe,GLP,2020,588.6076 -GQ,Equatorial Guinea,GNQ,2020,628.31854 -GR,Greece,GRC,2021,430.25867 -GT,Guatemala,GTM,2020,332.0158 -GU,Guam,GUM,2020,670.58826 -GW,Guinea-Bissau,GNB,2020,750.0 -GY,Guyana,GUY,2020,636.3636 -HK,Hong Kong,HKG,2020,644.89954 -HN,Honduras,HND,2020,358.64594 -HR,Croatia,HRV,2021,131.26709 -HT,Haiti,HTI,2020,606.383 -HU,Hungary,HUN,2021,195.50255 -ID,Indonesia,IDN,2020,624.6789 -IE,Ireland,IRL,2021,381.08688 -IL,Israel,ISR,2020,527.77277 -IN,India,IND,2021,626.0071 -IQ,Iraq,IRQ,2020,419.7325 -IS,Iceland,ISL,2020,28.75471 -IT,Italy,ITA,2021,222.8387 -JM,Jamaica,JAM,2020,532.3383 -JO,Jordan,JOR,2020,432.20337 -JP,Japan,JPN,2021,416.4962 -KE,Kenya,KEN,2021,112.37928 -KG,Kyrgyzstan,KGZ,2020,91.52752 -KH,Cambodia,KHM,2020,423.52942 -KI,Kiribati,KIR,2020,666.6667 -KM,Comoros,COM,2020,692.3078 -KN,Saint Kitts and Nevis,KNA,2020,666.6667 -KW,Kuwait,KWT,2020,438.1219 -KY,Cayman Islands,CYM,2020,681.1594 -KZ,Kazakhstan,KAZ,2021,654.9424 -LB,Lebanon,LBN,2020,544.89166 -LC,Saint Lucia,LCA,2020,696.9697 -LK,Sri Lanka,LKA,2020,439.22418 -LR,Liberia,LBR,2020,292.13483 -LS,Lesotho,LSO,2020,20.0 -LT,Lithuania,LTU,2021,209.03082 -LU,Luxembourg,LUX,2021,0.0 -LV,Latvia,LVA,2021,171.61119 -LY,Libya,LBY,2020,496.51044 -MA,Morocco,MAR,2020,571.06445 -ME,Montenegro,MNE,2021,350.6849 -MG,Madagascar,MDG,2020,452.8302 -MK,North Macedonia,MKD,2021,349.11407 -ML,Mali,MLI,2020,465.625 -MM,Myanmar,MMR,2020,311.10156 -MN,Mongolia,MNG,2021,725.97406 -MO,Macao,MAC,2020,482.14288 -MQ,Martinique,MTQ,2020,653.5948 -MR,Mauritania,MRT,2020,522.7273 -MS,Montserrat,MSR,2020,1000.0 -MT,Malta,MLT,2021,406.50406 -MU,Mauritius,MUS,2020,613.1387 -MV,Maldives,MDV,2020,701.7544 -MW,Malawi,MWI,2020,113.20756 -MX,Mexico,MEX,2021,373.80746 -MY,Malaysia,MYS,2021,541.00055 -MZ,Mozambique,MOZ,2020,129.77527 -NA,Namibia,NAM,2020,56.603775 -NC,New Caledonia,NCL,2020,640.0 -NE,Niger,NER,2020,675.00006 -NG,Nigeria,NGA,2020,395.2415 -NI,Nicaragua,NIC,2020,343.34766 -NL,Netherlands,NLD,2021,328.90408 -NO,Norway,NOR,2021,25.080723 -NP,Nepal,NPL,2020,22.653723 -NR,Nauru,NRU,2020,750.0 -NZ,New Zealand,NZL,2021,135.98497 -OM,Oman,OMN,2020,440.53098 -PA,Panama,PAN,2020,183.39417 -PE,Peru,PER,2021,233.97925 -PF,French Polynesia,PYF,2020,469.69696 -PG,Papua New Guinea,PNG,2020,563.6793 -PH,Philippines,PHL,2021,544.3023 -PK,Pakistan,PAK,2021,295.77448 -PL,Poland,POL,2021,727.7765 -PM,Saint Pierre and Miquelon,SPM,2020,800.0 -PR,Puerto Rico,PRI,2020,664.7727 -PT,Portugal,PRT,2021,181.10257 -PY,Paraguay,PRY,2020,23.915686 -QA,Qatar,QAT,2020,442.76172 -RO,Romania,ROU,2021,252.84236 -RS,Serbia,SRB,2021,545.552 -RW,Rwanda,RWA,2020,289.15662 -SA,Saudi Arabia,SAU,2021,568.50006 -SB,Solomon Islands,SLB,2020,700.0 -SC,Seychelles,SYC,2020,698.1133 -SD,Sudan,SDN,2020,259.31232 -SE,Sweden,SWE,2021,11.770537 -SG,Singapore,SGP,2021,463.89664 -SI,Slovenia,SVN,2021,250.87906 -SK,Slovakia,SVK,2021,100.85782 -SL,Sierra Leone,SLE,2020,47.61905 -SN,Senegal,SEN,2021,534.4203 -SO,Somalia,SOM,2020,648.6486 -SR,Suriname,SUR,2020,298.7013 -SS,South Sudan,SSD,2020,698.1133 -ST,Sao Tome and Principe,STP,2020,600.0 -SV,El Salvador,SLV,2021,245.827 -SZ,Eswatini,SWZ,2020,203.12498 -TC,Turks and Caicos Islands,TCA,2020,720.00006 -TD,Chad,TCD,2020,678.5714 -TG,Togo,TGO,2020,576.92316 -TH,Thailand,THA,2021,503.15494 -TJ,Tajikistan,TJK,2021,83.28969 -TM,Turkmenistan,TKM,2020,412.32855 -TN,Tunisia,TUN,2021,470.38147 -TO,Tonga,TON,2020,666.6667 -TR,Turkey,TUR,2021,429.6388 -TT,Trinidad and Tobago,TTO,2020,497.9688 -UA,Ukraine,UKR,2021,240.50241 -UG,Uganda,UGA,2020,77.0878 -US,United States,USA,2021,357.2021 -UY,Uruguay,URY,2021,152.38716 -UZ,Uzbekistan,UZB,2020,426.88644 -VC,Saint Vincent and the Grenadines,VCT,2020,533.3333 -VU,Vanuatu,VUT,2020,571.4286 -WS,Samoa,WSM,2020,500.0 -YE,Yemen,YEM,2020,538.46155 -ZA,South Africa,ZAF,2021,664.73755 -ZM,Zambia,ZMB,2020,120.77597 -ZW,Zimbabwe,ZWE,2020,279.0279 +ER,Eritrea,ERI,2022,631.5789 +ES,Spain,ESP,2023,174.05005 +ET,Ethiopia,ETH,2022,24.643318 +FI,Finland,FIN,2023,79.158325 +FJ,Fiji,FJI,2022,288.46158 +FO,Faroe Islands,FRO,2022,404.76193 +FR,France,FRA,2023,56.03859 +GA,Gabon,GAB,2022,491.59662 +GB,United Kingdom,GBR,2023,237.58902 +GD,Grenada,GRD,2022,640.0 +GE,Georgia,GEO,2023,167.59389 +GF,French Guiana,GUF,2021,217.82178 +GH,Ghana,GHA,2022,484.00003 +GI,Gibraltar,GIB,2022,600.00006 +GL,Greenland,GRL,2022,178.57143 +GM,Gambia,GMB,2022,666.6667 +GN,Guinea,GIN,2022,236.84212 +GP,Guadeloupe,GLP,2021,500.0 +GQ,Equatorial Guinea,GNQ,2022,591.83673 +GR,Greece,GRC,2023,336.57352 +GT,Guatemala,GTM,2022,328.26752 +GU,Guam,GUM,2022,622.8572 +GW,Guinea-Bissau,GNB,2022,625.0 +GY,Guyana,GUY,2022,640.3509 +HK,Hong Kong,HKG,2022,699.49915 +HN,Honduras,HND,2022,282.26477 +HR,Croatia,HRV,2023,204.96161 +HT,Haiti,HTI,2022,567.3077 +HU,Hungary,HUN,2023,204.18994 +ID,Indonesia,IDN,2022,675.9309 +IE,Ireland,IRL,2023,290.805 +IL,Israel,ISR,2022,582.9271 +IN,India,IND,2023,713.4407 +IQ,Iraq,IRQ,2022,688.81396 +IS,Iceland,ISL,2022,27.679918 +IT,Italy,ITA,2023,330.71823 +JM,Jamaica,JAM,2022,555.55554 +JO,Jordan,JOR,2022,540.92365 +JP,Japan,JPN,2023,485.39236 +KE,Kenya,KEN,2023,70.491806 +KG,Kyrgyzstan,KGZ,2022,147.2924 +KH,Cambodia,KHM,2022,417.70712 +KI,Kiribati,KIR,2022,666.6667 +KM,Comoros,COM,2022,642.8572 +KN,Saint Kitts and Nevis,KNA,2022,636.36365 +KW,Kuwait,KWT,2023,649.1634 +KY,Cayman Islands,CYM,2022,642.8571 +KZ,Kazakhstan,KAZ,2023,821.3909 +LB,Lebanon,LBN,2022,599.005 +LC,Saint Lucia,LCA,2022,666.6666 +LK,Sri Lanka,LKA,2022,509.78134 +LR,Liberia,LBR,2022,227.84811 +LS,Lesotho,LSO,2022,20.0 +LT,Lithuania,LTU,2023,160.07195 +LU,Luxembourg,LUX,2023,105.26315 +LV,Latvia,LVA,2023,123.2 +LY,Libya,LBY,2022,818.6922 +MA,Morocco,MAR,2023,630.01416 +ME,Montenegro,MNE,2023,417.07318 +MG,Madagascar,MDG,2022,436.44064 +MK,North Macedonia,MKD,2023,565.3451 +ML,Mali,MLI,2022,407.99997 +MM,Myanmar,MMR,2023,398.89804 +MN,Mongolia,MNG,2023,775.30865 +MO,Macao,MAC,2022,448.97958 +MQ,Martinique,MTQ,2021,523.17883 +MR,Mauritania,MRT,2022,464.7059 +MS,Montserrat,MSR,2022,1000.0 +MT,Malta,MLT,2023,459.14395 +MU,Mauritius,MUS,2022,632.47864 +MV,Maldives,MDV,2022,611.7647 +MW,Malawi,MWI,2022,66.66667 +MX,Mexico,MEX,2023,507.24512 +MY,Malaysia,MYS,2022,605.83136 +MZ,Mozambique,MOZ,2022,135.64668 +NA,Namibia,NAM,2022,59.25926 +NC,New Caledonia,NCL,2022,660.5839 +NE,Niger,NER,2022,670.88605 +NG,Nigeria,NGA,2023,523.24725 +NI,Nicaragua,NIC,2022,265.11627 +NL,Netherlands,NLD,2023,267.62177 +NO,Norway,NOR,2023,30.080084 +NP,Nepal,NPL,2022,24.43992 +NR,Nauru,NRU,2022,750.0 +NZ,New Zealand,NZL,2023,112.75831 +OM,Oman,OMN,2023,564.63495 +PA,Panama,PAN,2022,161.67665 +PE,Peru,PER,2023,266.47754 +PF,French Polynesia,PYF,2022,442.85715 +PG,Papua New Guinea,PNG,2022,507.24634 +PH,Philippines,PHL,2023,610.68835 +PK,Pakistan,PAK,2023,440.6085 +PL,Poland,POL,2023,661.92584 +PM,Saint Pierre and Miquelon,SPM,2022,600.0 +PR,Puerto Rico,PRI,2022,678.7377 +PT,Portugal,PRT,2023,165.55257 +PY,Paraguay,PRY,2023,23.75506 +QA,Qatar,QAT,2023,602.5005 +RO,Romania,ROU,2023,240.58281 +RS,Serbia,SRB,2023,636.06226 +RW,Rwanda,RWA,2022,316.32654 +SA,Saudi Arabia,SAU,2022,706.7905 +SB,Solomon Islands,SLB,2022,700.0 +SC,Seychelles,SYC,2022,564.5161 +SD,Sudan,SDN,2022,263.15787 +SE,Sweden,SWE,2023,40.694878 +SG,Singapore,SGP,2023,470.7832 +SI,Slovenia,SVN,2023,231.27463 +SK,Slovakia,SVK,2023,116.773544 +SL,Sierra Leone,SLE,2022,50.0 +SN,Senegal,SEN,2022,511.59793 +SO,Somalia,SOM,2022,578.9473 +SR,Suriname,SUR,2022,349.28232 +SS,South Sudan,SSD,2022,629.0322 +ST,Sao Tome and Principe,STP,2022,642.8572 +SV,El Salvador,SLV,2023,271.46817 +SZ,Eswatini,SWZ,2022,172.41379 +TC,Turks and Caicos Islands,TCA,2022,653.8462 +TD,Chad,TCD,2022,628.5714 +TG,Togo,TGO,2022,443.1818 +TH,Thailand,THA,2023,549.5827 +TJ,Tajikistan,TJK,2022,116.85825 +TM,Turkmenistan,TKM,2022,1306.0251 +TN,Tunisia,TUN,2023,563.95624 +TO,Tonga,TON,2022,625.0 +TT,Trinidad and Tobago,TTO,2022,681.5286 +UA,Ukraine,UKR,2022,259.69302 +UG,Uganda,UGA,2022,44.526905 +US,United States,USA,2023,369.47318 +UY,Uruguay,URY,2023,128.78789 +UZ,Uzbekistan,UZB,2022,1167.6029 +VC,Saint Vincent and the Grenadines,VCT,2022,529.4118 +VU,Vanuatu,VUT,2022,571.4286 +WS,Samoa,WSM,2022,473.68423 +YE,Yemen,YEM,2022,566.1016 +ZA,South Africa,ZAF,2023,707.6856 +ZM,Zambia,ZMB,2022,111.96713 +ZW,Zimbabwe,ZWE,2022,297.87234 From e19d66beb75d1f097055333361561fd9ae300880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20Hag=20L=C3=B8vstad?= Date: Fri, 13 Sep 2024 11:35:25 +0200 Subject: [PATCH 2/2] Updated world default and PUE --- carbontracker/constants.py | 6 +++++- carbontracker/loggerutil.py | 2 +- carbontracker/tracker.py | 2 +- tests/test_tracker.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/carbontracker/constants.py b/carbontracker/constants.py index 01caafa..04f0791 100644 --- a/carbontracker/constants.py +++ b/carbontracker/constants.py @@ -9,6 +9,10 @@ # https://uptimeinstitute.com/uptime_assets/6768eca6a75d792c8eeede827d76de0d0380dee6b5ced20fde45787dd3688bfe-2022-data-center-industry-survey-en.pdf PUE_2022 = 1.55 +# https://journal.uptimeinstitute.com/global-pues-are-they-going-anywhere/ +PUE_2023 = 1.58 + # World-wide average carbon intensity of electricity production in 2019. # https://www.iea.org/reports/global-energy-co2-status-report-2019/emissions -WORLD_2019_CARBON_INTENSITY = 475 +# 2024 update: Now uses number from https://www.statista.com/statistics/943137/global-emissions-intensity-power-sector-by-country/ +WORLD_2019_CARBON_INTENSITY = 481 diff --git a/carbontracker/loggerutil.py b/carbontracker/loggerutil.py index 00adfab..fd06d38 100644 --- a/carbontracker/loggerutil.py +++ b/carbontracker/loggerutil.py @@ -140,7 +140,7 @@ def _log_initial_info(self): self.info(f"{__package__} version {metadata.version(__package__)}") self.info( "Only predicted and actual consumptions are multiplied by a PUE " - f"coefficient of {constants.PUE_2022} (Rhonda Ascierto, 2022, Uptime " + f"coefficient of {constants.PUE_2023} (Daniel Bizo, 2023, Uptime " "Institute Global Data Center Survey)." ) diff --git a/carbontracker/tracker.py b/carbontracker/tracker.py index ad6887e..2e94ad3 100644 --- a/carbontracker/tracker.py +++ b/carbontracker/tracker.py @@ -232,7 +232,7 @@ def total_energy_per_epoch(self): for comp in self.components: energy_usage = comp.energy_usage(self.epoch_times) total_energy += energy_usage - return total_energy * constants.PUE_2022 + return total_energy * constants.PUE_2023 def _handle_error(self, error): err_str = traceback.format_exc() diff --git a/tests/test_tracker.py b/tests/test_tracker.py index 22bb005..a3db21b 100644 --- a/tests/test_tracker.py +++ b/tests/test_tracker.py @@ -283,7 +283,7 @@ def test_total_energy_per_epoch(self): total_energy = self.thread.total_energy_per_epoch() - expected_total_energy = np.array([3.0, 5.0, 7.0]) * constants.PUE_2022 + expected_total_energy = np.array([3.0, 5.0, 7.0]) * constants.PUE_2023 np.testing.assert_array_equal(total_energy, expected_total_energy) @mock.patch("os._exit")