ecologits-calculator / src /electricity_mix.py
Adrien Banse
fix: mix path
cf1a94c
raw
history blame
5.18 kB
from csv import DictReader
PATH = "src/electricity_mix.csv"
COUNTRY_CODES = [
("๐ŸŒŽ World", "WOR"),
("๐Ÿ‡ช๐Ÿ‡บ Europe", "EEE"),
("๐Ÿ‡ฟ๐Ÿ‡ผ Zimbabwe", "ZWE"),
("๐Ÿ‡ฟ๐Ÿ‡ฒ Zambia", "ZMB"),
("๐Ÿ‡ฟ๐Ÿ‡ฆ South Africa", "ZAF"),
("๐Ÿ‡พ๐Ÿ‡ช Yemen", "YEM"),
("๐Ÿ‡ป๐Ÿ‡ณ Vietnam", "VNM"),
("๐Ÿ‡ป๐Ÿ‡ช Venezuela", "VEN"),
("๐Ÿ‡บ๐Ÿ‡ฟ Uzbekistan", "UZB"),
("๐Ÿ‡บ๐Ÿ‡พ Uruguay", "URY"),
("๐Ÿ‡บ๐Ÿ‡ธ United States", "USA"),
("๐Ÿ‡บ๐Ÿ‡ฆ Ukraine", "UKR"),
("๐Ÿ‡น๐Ÿ‡ฟ Tanzania", "TZA"),
("๐Ÿ‡น๐Ÿ‡ผ Taiwan", "TWN"),
("๐Ÿ‡น๐Ÿ‡น Trinidad and Tobago", "TTO"),
("๐Ÿ‡น๐Ÿ‡ท Turkey", "TUR"),
("๐Ÿ‡น๐Ÿ‡ณ Tunisia", "TUN"),
("๐Ÿ‡น๐Ÿ‡ฒ Turkmenistan", "TKM"),
("๐Ÿ‡น๐Ÿ‡ฏ Tajikistan", "TJK"),
("๐Ÿ‡น๐Ÿ‡ญ Thailand", "THA"),
("๐Ÿ‡น๐Ÿ‡ฌ Togo", "TGO"),
("๐Ÿ‡ธ๐Ÿ‡พ Syrian Arab Republic", "SYR"),
("๐Ÿ‡ธ๐Ÿ‡ป El Salvador", "SLV"),
("๐Ÿ‡ธ๐Ÿ‡ณ Senegal", "SEN"),
("๐Ÿ‡ธ๐Ÿ‡ฐ Slovak Republic", "SVK"),
("๐Ÿ‡ธ๐Ÿ‡ฎ Slovenia", "SVN"),
("๐Ÿ‡ธ๐Ÿ‡ฌ Singapore", "SGP"),
("๐Ÿ‡ธ๐Ÿ‡ช Sweden", "SWE"),
("๐Ÿ‡ธ๐Ÿ‡ฉ Sudan", "SDN"),
("๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Arabia", "SAU"),
("๐Ÿ‡ท๐Ÿ‡บ Russian Federation", "RUS"),
("๐Ÿ‡ท๐Ÿ‡ธ Serbia and Montenegro", "SCG"),
("๐Ÿ‡ท๐Ÿ‡ด Romania", "ROU"),
("๐Ÿ‡ถ๐Ÿ‡ฆ Qatar", "QAT"),
("๐Ÿ‡ต๐Ÿ‡พ Paraguay", "PRY"),
("๐Ÿ‡ต๐Ÿ‡น Portugal", "PRT"),
("๐Ÿ‡ต๐Ÿ‡ฑ Poland", "POL"),
("๐Ÿ‡ต๐Ÿ‡ฐ Pakistan", "PAK"),
("๐Ÿ‡ต๐Ÿ‡ญ Philippines", "PHL"),
("๐Ÿ‡ต๐Ÿ‡ช Peru", "PER"),
("๐Ÿ‡ต๐Ÿ‡ฆ Panama", "PAN"),
("๐Ÿ‡ด๐Ÿ‡ฒ Oman", "OMN"),
("๐Ÿ‡ณ๐Ÿ‡ฟ New Zealand", "NZL"),
("๐Ÿ‡ณ๐Ÿ‡ต Nepal", "NPL"),
("๐Ÿ‡ณ๐Ÿ‡ด Norway", "NOR"),
("๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands", "NLD"),
("๐Ÿ‡ณ๐Ÿ‡ฎ Nicaragua", "NIC"),
("๐Ÿ‡ณ๐Ÿ‡ฌ Nigeria", "NGA"),
("๐Ÿ‡ณ๐Ÿ‡ฆ Namibia", "NAM"),
("๐Ÿ‡ฒ๐Ÿ‡ฟ Mozambique", "MOZ"),
("๐Ÿ‡ฒ๐Ÿ‡พ Malaysia", "MYS"),
("๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico", "MEX"),
("๐Ÿ‡ฒ๐Ÿ‡น Malta", "MLT"),
("๐Ÿ‡ฒ๐Ÿ‡ณ Mongolia", "MNG"),
("๐Ÿ‡ฒ๐Ÿ‡ฒ Myanmar", "MMR"),
("๐Ÿ‡ฒ๐Ÿ‡ฐ North Macedonia", "MKD"),
("๐Ÿ‡ฒ๐Ÿ‡ฉ Moldova", "MDA"),
("๐Ÿ‡ฒ๐Ÿ‡ฆ Morocco", "MAR"),
("๐Ÿ‡ฑ๐Ÿ‡พ Libya", "LBY"),
("๐Ÿ‡ฑ๐Ÿ‡ป Latvia", "LVA"),
("๐Ÿ‡ฑ๐Ÿ‡บ Luxembourg", "LUX"),
("๐Ÿ‡ฑ๐Ÿ‡น Lithuania", "LTU"),
("๐Ÿ‡ฑ๐Ÿ‡ฐ Sri Lanka", "LKA"),
("๐Ÿ‡ฑ๐Ÿ‡ง Lebanon", "LBN"),
("๐Ÿ‡ฐ๐Ÿ‡ฟ Kazakhstan", "KAZ"),
("๐Ÿ‡ฐ๐Ÿ‡ผ Kuwait", "KWT"),
("๐Ÿ‡ฐ๐Ÿ‡ท South Korea", "KOR"),
("๐Ÿ‡ฐ๐Ÿ‡ต North Korea", "PRK"),
("๐Ÿ‡ฐ๐Ÿ‡ญ Cambodia", "KHM"),
("๐Ÿ‡ฐ๐Ÿ‡ฌ Kyrgyz Republic", "KGZ"),
("๐Ÿ‡ฐ๐Ÿ‡ช Kenya", "KEN"),
("๐Ÿ‡ฏ๐Ÿ‡ต Japan", "JPN"),
("๐Ÿ‡ฏ๐Ÿ‡ด Jordan", "JOR"),
("๐Ÿ‡ฏ๐Ÿ‡ฒ Jamaica", "JAM"),
("๐Ÿ‡ฎ๐Ÿ‡น Italy", "ITA"),
("๐Ÿ‡ฎ๐Ÿ‡ธ Iceland", "ISL"),
("๐Ÿ‡ฎ๐Ÿ‡ท Iran", "IRN"),
("๐Ÿ‡ฎ๐Ÿ‡ถ Iraq", "IRQ"),
("๐Ÿ‡ฎ๐Ÿ‡ณ India", "IND"),
("๐Ÿ‡ฎ๐Ÿ‡ฑ Israel", "ISR"),
("๐Ÿ‡ฎ๐Ÿ‡ช Ireland", "IRL"),
("๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia", "IDN"),
("๐Ÿ‡ญ๐Ÿ‡บ Hungary", "HUN"),
("๐Ÿ‡ญ๐Ÿ‡น Haiti", "HTI"),
("๐Ÿ‡ญ๐Ÿ‡ท Croatia", "HRV"),
("๐Ÿ‡ญ๐Ÿ‡ณ Honduras", "HND"),
("๐Ÿ‡ญ๐Ÿ‡ฐ Hong Kong", "HKG"),
("๐Ÿ‡ฌ๐Ÿ‡น Guatemala", "GTM"),
("๐Ÿ‡ฌ๐Ÿ‡ท Greece", "GRC"),
("๐Ÿ‡ฌ๐Ÿ‡ฎ Gibraltar", "GIB"),
("๐Ÿ‡ฌ๐Ÿ‡ญ Ghana", "GHA"),
("๐Ÿ‡ฌ๐Ÿ‡ช Georgia", "GEO"),
("๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom", "GBR"),
("๐Ÿ‡ฌ๐Ÿ‡ฆ Gabon", "GAB"),
("๐Ÿ‡ซ๐Ÿ‡ท France", "FRA"),
("๐Ÿ‡ซ๐Ÿ‡ฎ Finland", "FIN"),
("๐Ÿ‡ช๐Ÿ‡น Ethiopia", "ETH"),
("๐Ÿ‡ช๐Ÿ‡ธ Spain", "ESP"),
("๐Ÿ‡ช๐Ÿ‡ท Eritrea", "ERI"),
("๐Ÿ‡ช๐Ÿ‡ฌ Egypt", "EGY"),
("๐Ÿ‡ช๐Ÿ‡ช Estonia", "EST"),
("๐Ÿ‡ช๐Ÿ‡จ Ecuador", "ECU"),
("๐Ÿ‡ฉ๐Ÿ‡ฟ Algeria", "DZA"),
("๐Ÿ‡ฉ๐Ÿ‡ด Dominican Republic", "DOM"),
("๐Ÿ‡ฉ๐Ÿ‡ฐ Denmark", "DNK"),
("๐Ÿ‡ฉ๐Ÿ‡ช Germany", "DEU"),
("๐Ÿ‡จ๐Ÿ‡ฟ Czech Republic", "CZE"),
("๐Ÿ‡จ๐Ÿ‡พ Cyprus", "CYP"),
("๐Ÿ‡จ๐Ÿ‡บ Cuba", "CUB"),
("๐Ÿ‡จ๐Ÿ‡ท Costa Rica", "CRI"),
("๐Ÿ‡จ๐Ÿ‡ด Colombia", "COL"),
("๐Ÿ‡จ๐Ÿ‡ณ China", "CHN"),
("๐Ÿ‡จ๐Ÿ‡ฒ Cameroon", "CMR"),
("๐Ÿ‡จ๐Ÿ‡ฑ Chile", "CHL"),
("๐Ÿ‡จ๐Ÿ‡ฎ Cote d'Ivoire", "CIV"),
("๐Ÿ‡จ๐Ÿ‡ญ Switzerland", "CHE"),
("๐Ÿ‡จ๐Ÿ‡ฌ Congo", "COG"),
("๐Ÿ‡จ๐Ÿ‡ฉ Democratic Republic of the Congo", "COD"),
("๐Ÿ‡จ๐Ÿ‡ฆ Canada", "CAN"),
("๐Ÿ‡ง๐Ÿ‡พ Belarus", "BLR"),
("๐Ÿ‡ง๐Ÿ‡ผ Botswana", "BWA"),
("๐Ÿ‡ง๐Ÿ‡ท Brazil", "BRA"),
("๐Ÿ‡ง๐Ÿ‡ด Bolivia", "BOL"),
("๐Ÿ‡ง๐Ÿ‡ณ Brunei", "BRN"),
("๐Ÿ‡ง๐Ÿ‡ฏ Benin", "BEN"),
("๐Ÿ‡ง๐Ÿ‡ญ Bahrain", "BHR"),
("๐Ÿ‡ง๐Ÿ‡ฌ Bulgaria", "BGR"),
("๐Ÿ‡ง๐Ÿ‡ช Belgium", "BEL"),
("๐Ÿ‡ง๐Ÿ‡ฉ Bangladesh", "BGD"),
("๐Ÿ‡ง๐Ÿ‡ฆ Bosnia and Herzegovina", "BIH"),
("๐Ÿ‡ฆ๐Ÿ‡ฟ Azerbaijan", "AZE"),
("๐Ÿ‡ฆ๐Ÿ‡บ Australia", "AUS"),
("๐Ÿ‡ฆ๐Ÿ‡น Austria", "AUT"),
("๐Ÿ‡ฆ๐Ÿ‡ท Argentina", "ARG"),
("๐Ÿ‡ฆ๐Ÿ‡ด Angola", "AGO"),
("๐Ÿ‡ฆ Netherlands Antilles", "ANT"),
("๐Ÿ‡ฆ๐Ÿ‡ฒ Armenia", "ARM"),
("๐Ÿ‡ฆ๐Ÿ‡ฑ Albania", "ALB"),
("๐Ÿ‡ฆ๐Ÿ‡ช United Arab Emirates", "ARE")
]
def find_electricity_mix(code: str):
# TODO: Maybe more optimal to construct database at the beginning of the app
# in the same fashion as find_model
res = []
with open(PATH) as fd:
csv = DictReader(fd)
for row in csv:
res += [float(row[code])]
return res