Python script that generates the following charts -
Global charts:
- Annual atmospheric CO₂ concentration and change
- CO₂ emission sources by share
- Annual CO₂ emissions from fossil fuels and cement
- Annual change of CO₂ emissions from fossil fuels and cement
- Annual coal, oil and gas CO₂ emissions
Global or national charts (for user-specified countries):
- Annual Fossil Fuel (FF) CO₂ emissions and national shares of FF CO₂ emissions
- Change of annual FF CO₂ emissions
- Annual coal, oil and gas production
- Country shares of coal, oil and gas production
- Shares of Energy consumption prior to partial conversions to Electricity (Primary Energy) for most recent year
- Annual Energy Consumption by share prior to partial conversions to Electricity (Primary Energy)
- Annual FF consumption prior to partial conversions to Electricity (Primary Energy)
- Annual change of FF consumption prior to partial conversions to Electricity (Primary Energy)
- Shares of Energy Consumption after partial conversions to Electricity (Final Energy), & Electricity Generation for the most recent year.
- Annual Energy Consumption by share after partial conversions to Electricity (Final Energy) Annual Energy Consumption by share prior to partial conversions to Electricity (Primary Energy)
- Annual Energy Consumption after partial conversions to Electricity (Final Energy)
- Annual change of Energy Consumption after partial conversions to Electricity (Final Energy)
- Annual Electricity Generation by share
- Annual Electricity Generation
- Annual change of Electricity Generation
Consists of the following files:
- world_energy_data.py (main executable)
- user_globals.py (global definitions)
- collate.py (extracts and arranges country specific data from input dataset)
- process.py (calculations)
- output.py (chart calls)
- chart.py (generic chart functions)
- countries.py (country name translations to make them compatible with IEA dataset)
Required input (all are provided in this repository):
- Global Carbon Budget in .xlsx format from https://globalcarbonbudgetdata.org/latest-data.html
- NOAA ESRL CO2 data in CSV format from https://gml.noaa.gov/ccgg/trends/gl_data.html
- Energy Institute Statistical Review of World Energy data from https://www.energyinst.org/statistical-review/resources-and-data-downloads (Direct link is https://www.energyinst.org/__data/assets/file/0003/1055694/Consolidated-Dataset-Narrow-format.csv)
- IEA annual energy balances in JSON format.
Instructions for use (code below is within single quotes):
- Choose a country to profile from those listed in the Energy Institute's data listed above.
- Edit the existing profile commands in world_energy_data.py to include 'profile("Country_Name")', where Country_Name is an exact duplicate of the name of the country selected in (1).
- Browse one of the IEA JSON files listed in (4) above to identify the IEA's equivalent country name.
- If the IEA version of Country_Name differs, edit countries.iea_country_name() to translate Country_Name to the IEA equivalent.
- Save all and using a terminal, enter the command 'python3 world_energy_data.py'
- Folders will be created named 'charts CO2' for global CO2 charts (generated on each execution), and 'charts Country_Name' for national, or World, energy charts.
- If need be, edit flags in user_globals.py to suit user preferences.
Written by Shane White, [email protected], using Python v3.12.2