An open API service indexing awesome lists of open source software.

https://github.com/shanewhi/world-energy-data

Python tool for generation of global and national energy system charts, using data from the Global Carbon Project, the National Oceanic and Atmospheric Administration, the Energy Institute and the International Energy Agency.
https://github.com/shanewhi/world-energy-data

anthropocene carbon-emissions coal electricity energy energy-consumption energy-data greenhouse-gas-emissions oil-and-gas pyplot python3 renewable-energy statistics

Last synced: 1 day ago
JSON representation

Python tool for generation of global and national energy system charts, using data from the Global Carbon Project, the National Oceanic and Atmospheric Administration, the Energy Institute and the International Energy Agency.

Awesome Lists containing this project

README

          

world-energy-data

Purpose



Generates charts of annual CO2 emissions, fossil fuel production,
energy consumption, and electricity generation of the world and specified
countries.
Output is displayed at https://www.worldenergydata.org/

Description



This package 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 (chart functions)

  • countries.py (country name translations between datasets)

Software Installation Requirements



Requires installation of Python v3.12.7, and library versions listed below, which can
be done using the terminal commands shown alongside -



  • Python v3.12.7

  • Matplotlib v3.10.3 pip3.12 install matplotlib==3.10.3

  • Matplotlib-extra v0.1.0 pip3.12 install git+https://github.com/chenyulue/matplotlib-extra/

  • Numpy v2.3.1 pip3.12 install numpy==2.3.1

  • Openpyxl v3.1.5 pip3.12 install openpyxl==3.1.5

  • Pandas v2.3.0 pip3.12 install pandas==2.3.0

Input Data Requirements



The following datasets are required, and are included in this package -




  1. Global Carbon Budget 2025 v1.0 in XLSX format.
    Modify this to include the cement carbonation sink and projected values for 2025, as follows -


    1. In sheet titled 'Global Carbon Budget', create a new column named 'fossil emissions including cement carbonation’ and fill with the values of

      'fossil emissions excluding cement carbonation' minus 'cement carbonation sink'

      Add the row 2025 and fill the same column with the projected value from Table 1 of Key Messages from GCB 2025.

    2. In sheet titled 'Fossil Emissions by Category', add the row 2025 and fill with the projected values for coal, oil and gas from the same document above.



  2. Globally averaged marine surface annual mean data and Globally averaged marine surface annual mean growth rates in CSV format from NOAA Global Monitoring Laboratory.

  3. The 2026 Energy Institute Statistical Review of World Energy in consolidated narrow CSV format.



  4. IEA CO2 Emissions by Sector and Total Final Consumption by Source for the world and each selected country.
    Data is obtained by -

    1. Select Country

    2. Select Energy Consumption

    3. Select Total final consumption (TFC) by source

    4. Select Download chart data

    5. Select Energy transition indicators

    6. Select CO2 emissions by sector

    7. Select Download chart data




  5. Linear emission reduction pathways.
    This is the datafile from slide 64 of Figures from the Global Carbon Budget 2024.


  6. World Bank Group Total Population dataset in CSV format.

    Unzip the downloaded archive and rename the CSV file 'world_pop.csv'.

Instructions



  1. Choose a country to profile from those listed in the Energy Institute's Statistical Review. This package does attempt to check that a

    compatible country name has been input, but it's coarse and some may break at run-time (e.g. Yemen, which the Energy Institute

    dataset includes, but only for oil production). This may be improved later.

  2. Edit line 38 of world_energy_data.py (shown below), to include the country name, followed by a comma in the case of a single country

    (a single element tuple must be followed by a comma) -

    # Define countries to profile using tuple.
    countries = ('Total World',)


  3. For data not already included in this repository, obtain and move the IEA datafiles from (4) in Input Data Requirements above, to the

    same folder as this package. If needed, add the IEA's country name to -

    countries.translate_country_name() in countries.py.

  4. Folders will be created named charts CO2, charts country_name and charts Major Emitters

  5. Flags in user_globals.py can be edited to suit preferences.