DemandForge
Country-level electricity load analysis and projection.
DemandForge is a Python-based workflow for analyzing and projecting country-level electricity load curves. It leverages weather data, electricity consumption data, and population statistics to model the relationship between temperature and electricity demand.
Features
- Thermosensitivity Analysis: Calculates the sensitivity of electricity load to temperature changes for both winter and summer periods.
- Data Fetching: Automatically fetches data from various sources, including:
- Workflow Management: Uses Snakemake to manage the data processing workflow, ensuring reproducibility and scalability.
- Reporting: Generates detailed reports, including CSV files with results, plots of thermosensitivity by hour, and a comprehensive PDF report.
Workflow
The project is orchestrated by a Snakefile that defines the entire data processing pipeline. The workflow consists of two main parts:
- Fetching: The
workflow/rules/fetch.smkrule fetches all the necessary data from the respective sources. - Processing: The
workflow/rules/process.smkrule processes the raw data, performs the thermosensitivity analysis, and generates the final reports.
The main steps in the workflow are:
- Fetch country borders.
- Fetch ENTSO-E load data for specified countries and years.
- Fetch ERA5 temperature data.
- Fetch GHSL population data.
- Calculate population-weighted temperature.
- Perform thermosensitivity analysis.
- Generate and upload reports.
Installation
-
Clone the repository:
git clone <repository-url> cd demandforge
-
Install dependencies: The project uses
pipfor dependency management. The required packages are listed in thepyproject.tomlfile.To install the core dependencies:
pip install .
To install dependencies for the workflow and notebooks:
pip install .[workflow,notebooks]
Usage
-
Configure the analysis: The analysis is configured through the
config/config.yamlfile. In this file, you can specify the countries, years, and other parameters for the analysis. -
Run the workflow: To run the entire workflow, use the following command:
snakemake --cores <number-of-cores>
This will execute the entire pipeline, from fetching the data to generating the final reports. The results will be saved in the directory specified in the
config.yamlfile.
Load projection usage
The project_load_curve function in demandforge/load_projection.py allows you to project future electricity load curves based on a reference year and scaling factors. This function can be used independently of the main Snakemake workflow. If the necessary combined load data for the reference year is not available locally, the function will automatically attempt to download it from a remote Google Cloud Storage bucket.
Example Usage
Here's how to use the project_load_curve function:
from demandforge.load_projection import project_load_curve
# Project load for Germany (DE) from a 2020 reference to 2030
# with a 2% yearly growth rate for baseload and EV load.
projected_df = project_load_curve(
country="DE",
reference_year=2020,
target_year=2030,
baseload_yearly_growth_rate=0.02,
ev_yearly_growth_rate=0.02
)
print(projected_df.head())
In this example, we project the load curve for Germany from 2020 to 2030. We specify a 2% annual growth rate for both the baseload and electric vehicle (EV) load components. You can also specify target energy values directly instead of growth rates for each component (baseload, winter thermosensitive, summer thermosensitive, and EV load).
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License. See the LICENCE.md file for details.
Metadata
Release files for demandforge 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| demandforge-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / demandforge-0.2.3-py3-none-any.whl
| Download URL | demandforge-0.2.3-py3-none-any.whl |
|---|---|
| Size | 41.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f838bda9d4c58212dd2dba52c352a82ad0b70c84cc90d4f1e9a688c76186e633
|
|
BLAKE2b-256 checksum How to use checksums |
dd1324531d81006533319bc85964a385a7d5409fd6b4173a9155e69a24f6b1b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|