/electricitymap

A real-time visualisation of the CO2 emissions of electricity generation

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

electricitymap Slack Status

A real-time visualisation of the GHG and CO2 footprint of electricity generation built with d3.js, optimized for Google Chrome. Try it out at http://www.electricitymap.org.

image

Consider contributing or submit ideas, feature requests or bugs on the issues page.

Data sources

GreenHouse Gas footprint calcuation and data source

The GreenHouse Gas (GHG) footprint of each country is measured from the perspective of a consumer. It represents the GHG footprint of 1 kWh consumed inside a given country, in the gCO2eq unit (meaning each GHG is converted to its CO2 equivalent in terms of global warming potential).

The GHG footprint of each production mode takes into account the construction of production units and their usual lifetimes as calculated by the 2014 IPCC report (see wikipedia entry and co2eq.js).

Each country has a GHG mass flow that depends on neighboring countries. In order to determine the GHG footprint of each country, the set of coupled GHG mass flow balance equations of each countries must be solved simultaneously. This is done by solving the linear system of equations defining the network of GHG exchanges (see co2eq.js).

Real-time electricity data sources

Production capacity data sources

Electricity prices (day-ahead) data sources

Real-time weather data sources

We use the US National Weather Service's Global Forecast System (GFS)'s GFS 0.25 Degree Hourly data. Forecasts are made every 6 hours, with a 1 hour time step. The values extracted are wind speed and direction at 10m altitude, and ground solar irradiance (DSWRF - Downward Short-Wave Radiation Flux), which takes into account cloud coverage. In order to obtain an estimate of those values at current time, an interpolation is made between two forecasts (the one at the beginning of the hour, and the one at the end of the hour).

Topology data

We use the Natural Earth Data Cultural Vectors country subdivisions (map admin subunits).

Contribute

Want to help? Join us on slack at http://slack.tmrow.co. In the meantime, here's some things you can do:

  • check out the issues
  • add your country by writing a parser
  • update an existing parser with a different API if you know one with more data or closer to real-time
  • optimise the code, correct inaccuracies...

You can also see a list of missing informations displayed as warnings in the developer console, or question marks in the country panel:

image

Getting started

To get started, clone or fork the repository, and install Docker.

The frontend will need compiling. In order to do this, open a terminal and run

docker-compose run --rm web npm run watch

This will watch over source file changes, and recompile if needed.

Now that the frontend is compiled, you can run the whole application, consisting of data collection system (the "feeder"), web server and database, by running the following command in a new terminal:

docker-compose up --build

Head over to http://localhost:8000/ and you should see the map! Note: you can also use remote server data using http://localhost:8000/?remote=true.

Once you're done doing your changes, submit a pull request to get them integrated.

Troubleshooting

  • ERROR: Couldn't find env file: env files are used to store sensitive information such as API keys. If you get this error after running docker-compose up, create an empty file named secrets.env in the root folder.

  • ERROR: for X Cannot create container for service X: Invalid bind mount spec "<path>": Invalid volume specification: '<volume spec>'. If you get this error after running docker-compose up on Windows, you should tell docker-compose to properly understand Windows paths by setting the environment variable COMPOSE_CONVERT_WINDOWS_PATHS to 0 by running setx COMPOSE_CONVERT_WINDOWS_PATHS 0. You will also need a recent version of docker-compose. We have successfully seen this fix work with v1.13.0-rc4. More info here: docker/compose#4274.

  • KeyError: 'ENTSOE_TOKEN': in order to request data from the ENTSOE, you need an API key. You can create an account and request your API key by following this link. Once you have it, add it to your secrets.env file.

  • No website found at http://localhost:8000: This can happen if you're running Docker in a virtual machine. Find out docker's IP using docker-machine ip default, and replace localhost by your Docker IP when connecting.

  • ERROR: for mongo Cannot create container for service mongo: C:/ drive is not shared. Please share it in Docker for Windows Settings Docker for Windows requires setting up shared drives (instructions here) but if after entering your Windows system username and password nothing happens (not even an error message) you might need to run Docker for Windows as administrator.