Electricity Demand Data
A Python-based project focused on collecting, processing, and forecasting hourly electricity demand data.
https://github.com/open-energy-transition/demandcast
Category: Energy Systems
Sub Category: Load and Demand Forecasting
Keywords from Contributors
energy-system-model
Last synced: about 3 hours ago
JSON representation
Repository metadata
Retrieve historic electricity demand, weather and socioeconomic data and generate synthetic future demand predictions using ML models
- Host: GitHub
- URL: https://github.com/open-energy-transition/demandcast
- Owner: open-energy-transition
- License: agpl-3.0
- Created: 2025-01-26T19:48:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-02T14:43:54.000Z (about 2 months ago)
- Last Synced: 2026-03-25T23:14:44.075Z (2 days ago)
- Language: Python
- Homepage: https://open-energy-transition.github.io/demandcast/
- Size: 147 MB
- Stars: 27
- Watchers: 1
- Forks: 5
- Open Issues: 6
- Releases: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: security.md
README.md
Table of Contents
- About
- Documentation
- Contributing
- Repository structure
- DemandCast structure
- Data sources
- Getting started
- Development workflow
- Maintainers
- License
About
DemandCast is a Python-based project focused on collecting, processing, and forecasting hourly electricity demand data. The aim of this project is to support energy planning studies by using machine learning models to generate hourly time series of future electricity demand or for countries without available data.
Features
- Retrieval of hourly and sub-hourly electricity demand data from public sources.
- Retrieval of weather and socio-economic data.
- Training and validation of machine learning models.
- Forecasting using trained machine learning models.
- Modular design for adding new countries or data sources.
- Support for reproducible, containerized development.
Feature roadmap
The project is in active development and we are always looking for suggestions and contributions. Below is a non-exhaustive list of planned features:
- Add support to forecast electricity demand in user-defined subnational regions.
- Enhance model training by integrating new datasets:
- New countries and subdivisions with available electricity demand data,
- Sectoral electricity demand (agriculture, industry, transport, buildings),
- Adoption of EVs, air conditioning, and heat pumps.
- Add and test new machine learning models for forecasting (e.g., timesfm).
- Add quality checks of electricity demand time series.
- Improve validation by considering simultaneity of peaks between actual and forecast electricity demand.
- Package the project for easier installation and usage.
Documentation
The documentation is currently hosted on GitHub pages connected to this repository. It is built with mkdocs.
To run it locally:
cd webpage
uv run mkdocs serve
Other online resources include:
- Paper accepted at the NeurIPS 2025 Workshop: Tackling Climate Change with Machine Learning.
- Poster presented at the NeurIPS 2025 Workshop.
- Video presentation recorded for the NeurIPS 2025 Workshop.
Contributing
We welcome contributions in the form of:
- Country-specific data retrieval modules
- New or improved forecasting models
- Documentation and testing enhancements
Please follow the repository’s structure and submit your changes via pull request.
We also would like to hear your feedback and suggestions. You can share your thoughts by completing this short survey.
Repository structure
demandcast/
├── .github/ # Github specifics such as actions
├── demandcast/
│ ├── checks/ # Modules to perform data availability and quality checks
│ ├── config/ # Configuration files for all scripts
│ ├── figures/ # Modules to plot figures and resulting figures
│ ├── ml_models/ # Machine learning models for forecasting electricity demand
│ ├── retrievals/ # Modules to retrieve data from various sources
│ ├── shapes/ # Scripts to generate shapes for non-standard subdivisions and resulting shapefiles
│ ├── tests/ # Unit tests for the utilities and retrieval scripts
│ ├── utils/ # Shared utilities for data fetching, processing, and uploading
│ ├── .dockerignore # Files and directories to ignore in Docker build context
│ ├── .env # API keys (not included in repo)
│ ├── .python-version # Python version for the environment
│ ├── Dockerfile # Dockerfile to create an image for the project
│ ├── assemble.py # Script to assemble/preprocess data
│ ├── check.py # Script to run data checks
│ ├── cross_validate.py # Script to cross-validate models
│ ├── forecast.py # Script to generate forecasts
│ ├── plot.py # Script to generate plots for the data
│ ├── pyproject.toml # Project configuration and dependencies
│ ├── retrieve.py # Main script to download and process data
│ ├── run_all.sh # Shell script to run all processes sequentially
│ ├── train.py # Script to train models
│ ├── upload.py # Script to upload data
│ ├── uv.lock # Locked dependencies for the project
│ └── validate.py # Script to validate data
├── webpage/ # Documentation website files (MkDocs)
├── .gitattributes # Git attributes for handling line endings
├── .gitignore # File lists that git ignores
├── .pre-commit-config.yaml # Pre-commit configuration
├── CONTRIBUTING.md # Guide to contributing
├── LICENSE # License file
├── README.md # Project overview and instructions
├── ruff.toml # Ruff configuration
└── security.md # Security policy
DemandCast structure

Data sources
The table below provides an overview of the data sources currently used in DemandCast for hourly and sub-hourly electricity demand, weather, and socio-economic data for both historical and forecasted periods.
| Data type | Historical data source | Forecast data source |
|---|---|---|
| Hourly and sub-hourlyelectricity demand | Various public sources listed in theAwesome Electricity Demand repository | -- |
| Temperature | ERA5 | CMIP6 |
| Gridded population | SEDAC GPW v4 | Wang X. et al. (2022) |
| National population | World Bank | IIASA SSP Database |
| Gridded GDP, PPP | Wang T. et al. (2022) | Wang T. et al. (2022) |
| National GDP per capita, PPP | World Bank, IMF | IIASA SSP Database |
| National annual electricitydemand per capita | Ember, World Bank | IIASA SSP Database |
The map below shows the countries and subdivisions for which retrieval modules of electricity demand data are currently available in DemandCast.
You can find the code that we used to retrieve the data in their respective files inside the demandcast/retrievals folder.
You can find the electricity demand data that we retrieved at different points in time in this Google Cloud Storage bucket (freely accessible with a Google account). Alternatively, the direct links to the data have the following format:
https://storage.googleapis.com/demandcast_data/{variable}/{country_or_subdivision_code}.parquet
Basic getting started guide
An extended getting started guide is available in the documentation.
1. Clone the repository
git clone https://github.com/open-energy-transition/demandcast.git
cd demandcast
2. Set up your environment
This project uses uv as a package manager to install the required dependencies and create an environment stored in .venv.
uv can be used within the provided Dockerfile or installed standalone (see installing uv).
The demandcast folder contains a pyproject.toml file that defines all the dependencies for the project.
To set up the environment, run:
cd demandcast
uv sync
Alternatively, you may use a package manager of your choice (e.g., conda) to install the dependencies listed in the pyproject.toml. If you choose this approach, please adjust the commands below to align with the conventions of your selected package manager.
3. Run scripts
Scripts can be run directly using:
cd demandcast
uv run script.py
Scripts accept configuration files to customize their behavior. Configuration files are located in demandcast/config/. The default name of the configuration file is {script_name}_config.yaml.
Jupyter notebooks (details) can be launched with:
cd demandcast
uv run --with jupyter jupyter lab --allow-root
Development workflow
Run tests and check test coverage
cd demandcast
uv run pytest --cov=utils --cov-report=term-missing
Pre-commit and lint code
To ensure code quality, we use pre-commit hooks. These hooks automatically run checks on your code before committing changes. Among the pre-commit hooks, we also use ruff to enforce code style and linting. All the pre-commit hooks are defined in the .pre-commit-config.yaml file.
To run pre-commit hooks, you can use:
uvx pre-commit
Maintainers
The project is maintained by the Open Energy Transition team. The team members currently involved in this project are:
- Enrico Antonini (enrico.antonini at openenergytransition dot org)
- Vamsi Priya Goli (goli.vamsi at openenergytransition dot org)
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
Owner metadata
- Name: open-energy-transition
- Login: open-energy-transition
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/131007753?v=4
- Repositories: 1
- Last ynced at: 2023-05-03T12:28:56.288Z
- Profile URL: https://github.com/open-energy-transition
GitHub Events
Total
- Release event: 1
- Delete event: 24
- Pull request event: 36
- Issues event: 14
- Watch event: 5
- Issue comment event: 9
- Push event: 265
- Pull request review comment event: 54
- Pull request review event: 59
- Create event: 21
Last Year
- Release event: 1
- Delete event: 24
- Pull request event: 36
- Issues event: 14
- Watch event: 5
- Issue comment event: 9
- Push event: 265
- Pull request review comment event: 54
- Pull request review event: 59
- Create event: 21
Committers metadata
Last synced: 3 days ago
Total Commits: 68
Total Committers: 4
Avg Commits per committer: 17.0
Development Distribution Score (DDS): 0.574
Commits in past year: 63
Committers in past year: 4
Avg Commits per committer in past year: 15.75
Development Distribution Score (DDS) in past year: 0.54
| Name | Commits | |
|---|---|---|
| Enrico Antonini | 5****i | 29 |
| Kevin Steijn | 1****s | 18 |
| Goli Vamsi Priya | g****2@g****m | 17 |
| pre-commit-ci[bot] | 6****] | 4 |
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 6
Total pull requests: 93
Average time to close issues: about 1 month
Average time to close pull requests: 14 days
Total issue authors: 3
Total pull request authors: 4
Average comments per issue: 0.5
Average comments per pull request: 0.26
Merged pull request: 65
Bot issues: 0
Bot pull requests: 5
Past year issues: 6
Past year pull requests: 90
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 13 days
Past year issue authors: 3
Past year pull request authors: 4
Past year average comments per issue: 0.5
Past year average comments per pull request: 0.26
Past year merged pull request: 62
Past year bot issues: 0
Past year bot pull requests: 5
Top Issue Authors
- ElectricMountains (3)
- eantonini (2)
- nd8696 (1)
Top Pull Request Authors
- eantonini (34)
- ElectricMountains (27)
- Vamsipriya22 (27)
- pre-commit-ci[bot] (5)
Top Issue Labels
- Enhancement (4)
- Bug (2)
Top Pull Request Labels
- Python (70)
- Docs (34)
- GitHub Actions (20)
Dependencies
- python 3.12 build
- mkdocs-material >=9.5.50
- 106 dependencies
- python 3.12 build
- dask >=2025.3.0
- dotenv >=0.9.9
- fastapi [standard]>=0.115.12
- matplotlib >=3.10.1
- netcdf4 >=1.7.2
- pandas >=2.2.3
- pyarrow >=19.0.1
- pycountry >=24.6.1
- pycountry-convert >=0.7.2
- scikit-learn >=1.6.1
- tqdm >=4.67.1
- xarray >=2025.7.1
- xgboost-cpu >=3.0.0
- babel 2.17.0
- backrefs 5.9
- certifi 2025.7.14
- charset-normalizer 3.4.2
- click 8.2.1
- colorama 0.4.6
- demandcast-documentation 0.1.0
- ghp-import 2.1.0
- idna 3.10
- jinja2 3.1.6
- markdown 3.8.2
- markupsafe 3.0.2
- mergedeep 1.3.4
- mkdocs 1.6.1
- mkdocs-get-deps 0.2.0
- mkdocs-material 9.6.15
- mkdocs-material-extensions 1.3.1
- packaging 25.0
- paginate 0.5.7
- pathspec 0.12.1
- platformdirs 4.3.8
- pygments 2.19.2
- pymdown-extensions 10.16
- python-dateutil 2.9.0.post0
- pyyaml 6.0.2
- pyyaml-env-tag 1.1
- requests 2.32.4
- six 1.17.0
- urllib3 2.5.0
- watchdog 6.0.0
- actions/checkout v4 composite
- docker/build-push-action v5 composite
- docker/login-action v3 composite
- docker/metadata-action v5 composite
- docker/setup-buildx-action v3 composite
- sigstore/cosign-installer v3.5.0 composite
- actions/cache v4 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- beautifulsoup4 >=4.13.3
- cartopy >=0.24.1
- cdsapi >=0.7.5
- countryinfo >=0.1.2
- cpi >=2.0.8
- dask >=2025.11.0
- entsoe-py >=0.6.18
- geopandas >=1.0.1
- google-cloud-storage >=3.1.0
- logging >=0.4.9.6
- matplotlib >=3.10.0
- nepali-datetime >=1.0.8.4
- netcdf4 >=1.7.3
- numpy >=2.2.2
- openpyxl >=3.1.5
- pandas >=2.2.3
- py7zr >=0.22.0
- pyarrow >=19.0.0
- pycountry >=24.6.1
- pycountry-convert >=0.7.2
- pytest >=8.4.0
- python-dotenv >=1.0.1
- pytz >=2025.1
- pyyaml >=6.0.3
- rasterio >=1.4.3
- rioxarray >=0.19.0
- sdmx1 >=2.22.0
- shapely >=2.0.7
- tailwind-colors >=1.3.0
- timezonefinder >=6.5.9
- tqdm >=4.67.1
- xarray >=2025.1.2
- xlrd >=2.0.1
- actions/labeler v5 composite
- annotated-types 0.7.0
- anyio 4.9.0
- certifi 2025.4.26
- cftime 1.6.4.post1
- click 8.1.8
- cloudpickle 3.1.1
- colorama 0.4.6
- contourpy 1.3.2
- coverage 7.10.6
- cycler 0.12.1
- dask 2025.4.0
- dnspython 2.7.0
- dotenv 0.9.9
- email-validator 2.2.0
- fastapi 0.115.12
- fastapi-cli 0.0.7
- fonttools 4.57.0
- fsspec 2025.3.2
- h11 0.16.0
- httpcore 1.0.9
- httptools 0.6.4
- httpx 0.28.1
- idna 3.10
- iniconfig 2.1.0
- jinja2 3.1.6
- joblib 1.4.2
- kiwisolver 1.4.8
- locket 1.0.0
- markdown-it-py 3.0.0
- markupsafe 3.0.2
- matplotlib 3.10.1
- mdurl 0.1.2
- model-xgboost 0.1.0
- netcdf4 1.7.2
- numpy 2.2.5
- packaging 25.0
- pandas 2.2.3
- partd 1.4.2
- pillow 11.2.1
- pluggy 1.6.0
- pprintpp 0.4.0
- pyarrow 19.0.1
- pycountry 24.6.1
- pycountry-convert 0.7.2
- pydantic 2.11.5
- pydantic-core 2.33.2
- pygments 2.19.1
- pyparsing 3.2.3
- pytest 8.4.1
- pytest-cov 6.2.1
- pytest-mock 3.14.1
- python-dateutil 2.9.0.post0
- python-dotenv 1.1.0
- python-multipart 0.0.20
- pytz 2025.2
- pyyaml 6.0.2
- repoze-lru 0.7
- rich 14.0.0
- rich-toolkit 0.14.6
- scikit-learn 1.6.1
- scipy 1.15.2
- shellingham 1.5.4
- six 1.17.0
- sniffio 1.3.1
- starlette 0.46.2
- threadpoolctl 3.6.0
- toolz 1.0.0
- tqdm 4.67.1
- typer 0.16.0
- typing-extensions 4.13.2
- typing-inspection 0.4.1
- tzdata 2025.2
- uvicorn 0.34.2
- uvloop 0.21.0
- watchfiles 1.0.5
- websockets 15.0.1
- wheel 0.45.1
- xarray 2025.7.1
- xgboost-cpu 3.0.0
- actions/checkout v4 composite
- actions/setup-python v5 composite
- astral-sh/setup-uv v5 composite
- pre-commit/action v3.0.1 composite
Score: 4.882801922586371