conference_footprint

compute the CO2 footprint of an academic conference
git clone https://a3nm.net/git/conference_footprint/
Log | Files | Refs | LICENSE

commit b17a2315a857c3c8aeb5dba90e2a8abc18d1a10c
parent 6d58c0fa2be26a773b4e55a3a1c0f7ca2a632488
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 18 Sep 2024 18:17:05 +0200

compute cumulative info and other values

Diffstat:
2024/co2.py | 49++++++++++++++++++++++++++++++-------------------
2024/commands.sh | 3+++
2024/footprints.txt | 270+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024/footprints_withlocal_cumul.txt | 320+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024/trips_with_co2.csv | 14++++++++++++++
5 files changed, 637 insertions(+), 19 deletions(-)

diff --git a/2024/co2.py b/2024/co2.py @@ -31,27 +31,33 @@ num_total = 0 num_short_plane = 0 num_short = 0 dist_plane = 0 +km_by_mode = defaultdict(lambda: 0) +num_by_mode = defaultdict(lambda: 0) -for l in sys.stdin.readlines(): - f = l.strip().split(",") - mode = f[0] - dist = float(f[1]) - co2v = co2(dist, mode) - co2_by_mode[mode] += co2v - co2_total += co2v - num_total += 1 - if mode == "plane": - dist_plane += dist - if dist >= LONG_THRESH: - if mode == "plane": - co2_total_long_plane += co2v - num_total_long_plane += 1 - else: - num_total_long_nonplane += 1 - if dist < LONG_THRESH: - num_short += 1 +with open("footprints.txt", 'w') as fp: + for l in sys.stdin.readlines(): + f = l.strip().split(",") + mode = f[0] + dist = float(f[1]) + co2v = co2(dist, mode) + co2_by_mode[mode] += co2v + print(co2v, file=fp) + co2_total += co2v + num_total += 1 + num_by_mode[mode] += 1 + km_by_mode[mode] += dist if mode == "plane": - num_short_plane += 1 + dist_plane += dist + if dist >= LONG_THRESH: + if mode == "plane": + co2_total_long_plane += co2v + num_total_long_plane += 1 + else: + num_total_long_nonplane += 1 + if dist < LONG_THRESH: + num_short += 1 + if mode == "plane": + num_short_plane += 1 assert (num_short + num_total_long_plane + num_total_long_nonplane == num_total) @@ -68,3 +74,8 @@ print( "flights of over %d km account for %f CO2e emissions (tons) i.e. %f perce % (LONG_THRESH, co2_total_long_plane, 100*co2_total_long_plane/co2_total, num_total_long_plane, num_total)) print("distance by plane: %d" % dist_plane) + +for k in num_by_mode.keys(): + print("num by mode %s: %d" % (k, num_by_mode[k])) +for k in km_by_mode.keys(): + print("dist by mode %s: %d" % (k, km_by_mode[k])) diff --git a/2024/commands.sh b/2024/commands.sh @@ -18,4 +18,7 @@ cat highlights_and_jewels_of_automata_theory_2024_onsite.csv | awk -F '\t' '($9 ./geocode.py < locations.txt > locations_with_latlon.txt ./generate_trips.py 44.84044 -0.5805 0.2 ./co2.py < trips_anonymized.csv +# creates footprints.txt +# 50 is twice the number of local participants +cat <(yes 0 | head -50) <(cat footprints.txt | sort -n | awk '{s+= $0; print s}') > footprints_withlocal_cumul.txt diff --git a/2024/footprints.txt b/2024/footprints.txt @@ -0,0 +1,270 @@ +14800.0 +13579.0 +13542.0 +12210.0 +31857.0 +34336.0 +312290.0 +278069.0 +17353.0 +17390.0 +248196.0 +208131.0 +127968.0 +152478.0 +19499.0 +21127.0 +287419.0 +63233.0 +15022.0 +12839.0 +34484.0 +35705.0 +20942.0 +17797.0 +29970.0 +25419.0 +18870.0 +15318.0 +18093.0 +16909.0 +26714.0 +29674.0 +16243.0 +12913.0 +33596.0 +27750.0 +399806.0 +292468.0 +245358.0 +264044.0 +1266008.0 +304623.0 +34928.0 +38406.0 +304062.0 +68635.0 +514624.0 +485826.0 +362219.0 +378488.0 +32671.0 +32264.0 +43031.0 +47471.0 +47730.0 +51541.0 +29230.0 +26122.0 +15762.0 +17464.0 +180858.0 +31561.0 +298639.0 +365585.0 +197659.0 +288167.0 +24013.0 +27861.0 +24198.0 +30932.0 +25123.0 +26714.0 +66045.0 +19314.0 +26899.0 +33337.0 +297143.0 +289476.0 +247938.0 +235807.0 +23384.0 +29045.0 +125646.0 +168216.0 +18685.0 +20942.0 +210562.0 +209066.0 +40996.0 +33041.0 +26936.0 +23199.0 +40108.0 +50579.0 +18352.0 +16354.0 +34891.0 +36630.0 +286858.0 +296208.0 +30488.0 +34262.0 +28453.0 +26122.0 +40293.0 +39775.0 +21349.0 +17316.0 +20461.0 +21238.0 +36112.0 +35520.0 +339779.0 +274516.0 +33781.0 +32560.0 +1206424.0 +1200344.0 +990432.0 +1236976.0 +208131.0 +235296.0 +22644.0 +27639.0 +33337.0 +31561.0 +75184.0 +77737.0 +18241.0 +15059.0 +1001072.0 +958360.0 +31672.0 +23643.0 +243287.0 +249744.0 +254694.0 +248897.0 +643280.0 +131683.0 +1757576.0 +1719576.0 +391391.0 +280874.0 +18463.0 +18130.0 +33707.0 +32449.0 +29859.0 +25604.0 +16021.0 +16391.0 +11433.0 +16909.0 +13579.0 +15318.0 +34077.0 +25012.0 +29082.0 +39738.0 +27343.0 +28712.0 +24901.0 +34891.0 +33929.0 +39553.0 +248454.0 +204336.0 +191114.0 +187374.0 +18648.0 +15688.0 +256452.0 +237360.0 +1146232.0 +42106.0 +46879.0 +53428.0 +31857.0 +28379.0 +80290.0 +86136.0 +17279.0 +20683.0 +593538.0 +551000.0 +22903.0 +32856.0 +317526.0 +289476.0 +17538.0 +19425.0 +6972.0 +35076.0 +330429.0 +367829.0 +322575.0 +299200.0 +33226.0 +31006.0 +57387.0 +72409.0 +410839.0 +435710.0 +56388.0 +44030.0 +26862.0 +30377.0 +224460.0 +237876.0 +16169.0 +17390.0 +34928.0 +28675.0 +21682.0 +20979.0 +459272.0 +18093.0 +8652.0 +8316.0 +329307.0 +345763.0 +246653.0 +232254.0 +346324.0 +291346.0 +36556.0 +29748.0 +14171.0 +24457.0 +28564.0 +28231.0 +26085.0 +32190.0 +403172.0 +336226.0 +34706.0 +28786.0 +18463.0 +20831.0 +28897.0 +33226.0 +27935.0 +23384.0 +302192.0 +241230.0 +26048.0 +33892.0 +25049.0 +17908.0 +30895.0 +26751.0 +222396.0 +207690.0 +224587.0 +282931.0 +217481.0 +301444.0 +29452.0 +30155.0 +14393.0 +17094.0 +16576.0 +20757.0 +246906.0 +212334.0 +18944.0 +17834.0 +24161.0 +26381.0 diff --git a/2024/footprints_withlocal_cumul.txt b/2024/footprints_withlocal_cumul.txt @@ -0,0 +1,320 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +6972 +15288 +23940 +35373 +47583 +60422 +73335 +86877 +100456 +114035 +128206 +142599 +157399 +172421 +187480 +202798 +218116 +233804 +249566 +265587 +281756 +297999 +314353 +330744 +347320 +364229 +381138 +398232 +415511 +432827 +450180 +467570 +484960 +502424 +519962 +537759 +555593 +573501 +591594 +609687 +627817 +646058 +664410 +682873 +701336 +719984 +738669 +757539 +776483 +795797 +815222 +834721 +855182 +875865 +896622 +917453 +938395 +959337 +980316 +1001443 +1022681 +1044030 +1065712 +1088356 +1111259 +1134458 +1157842 +1181226 +1204869 +1228882 +1253043 +1277241 +1301698 +1326599 +1351611 +1376660 +1401783 +1427202 +1452806 +1478854 +1504939 +1531061 +1557183 +1583564 +1610278 +1636992 +1663743 +1690605 +1717504 +1744440 +1771783 +1799422 +1827172 +1855033 +1882968 +1911199 +1939578 +1968031 +1996595 +2025270 +2053982 +2082768 +2111665 +2140710 +2169792 +2199022 +2228474 +2258148 +2287896 +2317755 +2347725 +2377880 +2408257 +2438745 +2469640 +2500572 +2531578 +2563139 +2594700 +2626372 +2658229 +2690086 +2722276 +2754540 +2786989 +2819549 +2852220 +2885076 +2918117 +2951343 +2984569 +3017906 +3051243 +3084839 +3118546 +3152327 +3186219 +3220148 +3254225 +3288487 +3322823 +3357307 +3392013 +3426904 +3461795 +3496723 +3531651 +3566727 +3602247 +3637952 +3674064 +3710620 +3747250 +3785656 +3825209 +3864947 +3904722 +3944830 +3985123 +4026119 +4068225 +4111256 +4155286 +4202165 +4249636 +4297366 +4347945 +4399486 +4452914 +4509302 +4566689 +4629922 +4695967 +4764602 +4837011 +4912195 +4989932 +5070222 +5156358 +5282004 +5409972 +5541655 +5694133 +5862349 +6043207 +6230581 +6421695 +6619354 +6823690 +7031380 +7239511 +7447642 +7656708 +7867270 +8079604 +8297085 +8519481 +8743941 +8968528 +9200782 +9436078 +9671885 +9909245 +10147121 +10388351 +10631638 +10876996 +11123649 +11370555 +11618493 +11866689 +12115143 +12364040 +12613784 +12868478 +13124930 +13388974 +13663490 +13941559 +14222433 +14505364 +14792222 +15079641 +15367808 +15657284 +15946760 +16238106 +16530574 +16826782 +17123925 +17422564 +17721764 +18023208 +18325400 +18629462 +18934085 +19246375 +19563901 +19886476 +20215783 +20546212 +20882438 +21222217 +21567980 +21914304 +22276523 +22642108 +23009937 +23388425 +23779816 +24179622 +24582794 +24993633 +25429343 +25888615 +26374441 +26889065 +27440065 +28033603 +28676883 +29635243 +30625675 +31626747 +32772979 +33973323 +35179747 +36416723 +37682731 +39402307 +41159883 diff --git a/2024/trips_with_co2.csv b/2024/trips_with_co2.csv @@ -0,0 +1,14 @@ +total CO2e emissions (tons): 41.159883 +for mode train: CO2e emissions (tons): 5.264101 +for mode plane: CO2e emissions (tons): 35.871842 +for mode bus/coach: CO2e emissions (tons): 0.023940 +for distances <2000 km, plane is used for 68/243 trips +for distances >=2000 km, plane is used for 22/27 trips +flights of over 2000 km account for 18149946.000000 CO2e emissions (tons) i.e. 44.096204 percent of total for 22/270 total legs +distance by plane: 201579 +num by mode train: 177 +num by mode plane: 90 +num by mode bus/coach: 3 +dist by mode train: 142273 +dist by mode plane: 201579 +dist by mode bus/coach: 855