Build Status PyPI version Documentation Status


openelec is a general tool for finding opportunities in electricity access. Able to create national-level plans for achieving universal electricity access, as well as optimise town/village-level mini-grid, densification and standalone systems. In addition, the tool provides functionality to find private-sector off-grid opportunities.

The library has a currently not very user-friendly Python API for scripting/notebook use.
There is also a demonstration web interface running here (static front-end on AWS S3 with serverless backend on Lambda) and a short blog post here.

The clusters for modelling are created using the separate clusterize tool.


A tool for modelling the optimal pathways to improving electricity access.
Described in my blog post here: Modelling the optimum way to achieve universal electrification


A tool for optimising rural mini-grid systems and LV networks using OpenStreetMap building data and a minimum spanning tree approach to network optimisation.
Described in my blog post here: A Flask app for mini-grid planning with a cost-optimised spanning tree

Web App usage (click to get proper resolution)

Web App demo

Model usage

To get to grips with the API and steps in the model, open the Jupyter notebook example.ipynb. This repository includes the input data needed to do a test run for Lesotho, so it should be a matter of opening the notebook and running all cells.

It also includes test data for a small village in central Lesotho to run the local version of the model.



openelec requires Python >= 3.5 with the following packages installed:

  • flask >= 1.0.2 (only for the web app)
  • numpy >= 1.14.2
  • pandas >= 0.22.0
  • geopandas >= 0.4.0 (0.4.0 had API breaking changes so this version is needed)
  • shapely >= 1.6.4
  • scipy >= 1.0.0
  • scikit-learn >= 0.17.1
  • pyproj ==

Additionally these packages are needed for running the Jupyter notebook:

  • matplotlib
  • jupyter
  • folium
  • descartes

Install with pip

pip install openelec

Install from GitHub

Download or clone the repository and install the required packages (preferably in a virtual environment):

git clone
cd gridfinder
pip install -r requirements.txt

You can run ./ in the directory, which will do an entire run through using the test data and confirm whether everything is set up properly.


Built using sphinx. Available here. Build API reference with:

cd openelec/docscd
sphinx-apidoc -o . ../openelec
make html

Indices and tables