- Jupyter Notebook 99.8%
- Python 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| DemandProfNorm | ||
| Plots | ||
| README.md | ||
| solve_gispo_lp.py | ||
Source Data, Figure Reproduction, and Linear Programming Instances for the GISPO Model
Overview
This repository serves two parallel functions for the Global Integrated Sustainable Power-system Optimization (GISPO) model:
- Figure Reproduction (Plotting): Source data and Jupyter Notebooks for plotting results as reported in the article manuscript
https://www.researchsquare.com/article/rs-7265214/v1(stored in thePlots/directory). - Linear Programming (LP) Solving: Guidance and standalone LP problem files generated by the GISPO model, stored in Zenodo (https://doi.org/10.5281/zenodo.17618090). These files correspond to the "Base Scenario" analyzed in the manuscript.
Part 1: Figure Reproduction and Data Analysis
The Plots/ directory contains the data and Jupyter Notebooks (.ipynb) used to generate the figures presented in the manuscript.
1.1 System Requirements (Plotting)
- RAM: 16GB RAM is recommended to load the datasets and run the plotting notebooks smoothly.
- Software Dependencies: Python 3.9+
- Python Libraries:
jupyter,pandas,matplotlib,seaborn,geopandas(optional, for spatial maps). - GIS Software: While the code and data are fully available and reproducible, please note that some spatial figures (such as those visualizing grid territories) require ArcGIS (or an open-source alternative like QGIS) to perfectly replicate the visual styling and mapping layouts seen in the paper. The raw shapefiles are provided in
data/shp/for this purpose.
1.2 Setup and Reproduction
- Install Python: Download and install Python from
https://www.python.org/. - Install Plotting Dependencies: Run
pip install jupyter pandas matplotlib seaborn geopandasto set up the environment. - Run Notebooks: Open the Jupyter Notebooks named
Figure1.ipynbthroughFigure7c.ipynbto reproduce the corresponding charts.
1.3 Understanding the Pickle (PKL) Files (Core Model Components)
As noted by reviewers, the .pkl (Pickle) files constitute a core component of the model's high-resolution operational outputs. Within the data/ directory, you will find files such as:
data/sp_prof/sp_status.pkl: Contains the hourly shadow prices derived from the Base scenario for each power grid.data/storage/soc_status.pkl: Contains the continuous State of Charge (SoC) status for energy storage systems across different grids.
Why are these stored as PKL?
The GISPO model simulates power systems at an hourly resolution across numerous regions and technologies. This results in highly complex, multi-dimensional data structures (e.g., Pandas DataFrames with MultiIndexes, or deeply nested dictionaries). We use Python's native .pkl format because it preserves these exact data structures and types natively. Converting these specific core components to standard .csv files would result in a massive loss of structural integrity and make the data exceedingly difficult to parse and reuse.
How to read and use the PKL files:
These files are designed to be easily loaded back into Python for analysis or plotting. You can load them using the pandas library:
import pandas as pd
# Example: Loading the storage State of Charge (SoC) status
soc_data = pd.read_pickle('data/storage/soc_status.pkl')
# Display the structure of the loaded data
print(soc_data.head())
Once loaded, the data will behave exactly as it did within the original GISPO model environment, allowing for seamless reproducibility of the core model dynamics.
Part 2: Solving the Linear Programming (LP) Instances
This section provides instructions for solving the LP problem files for all power regions in the base scenario. GISPO solves the problem by partitioning it into sub-regions based on the power grid topology. The folder includes partial_x.lp files (where x is from 0 to 8, 0 for the world and 1 to 8 for each sub-region).
2.1 System Requirements (LP Solving)
- RAM: 16GB RAM is required to load the smaller instances (e.g.,
partial_8.lp). For the largest full-scale instances (e.g.,partial_0.lp, 31.9 GB), a higher-performance server with at least 2000 GB RAM and 196 cores is recommended. Attempting to loadpartial_0.lpon a standard laptop may result in a memory crash and is therefore not suggested. - Disk Space: At least 100 GB of free space to store the unzipped LP files and solution outputs.
- Processor: A multi-core processor is recommended for parallel barrier solving.
- Software Dependencies: Python 3.9+
- Solver: A commercial-grade LP solver is recommended due to the scale of the problem. We utilized Gurobi Optimizer version 10.0.
- Python Libraries:
gurobipy(or the equivalent Python API for your chosen solver).
2.2 Installation Guide (LP Solving)
- Install Python: Download and install Python from
https://www.python.org/. - Install Solver: Ensure your solver (e.g., Gurobi) is installed, and a valid license is active. For Gurobi, see
https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Pythonfor installation of the python interface.
2.3 Demo: Instructions to Run
To demonstrate the reproducibility of the model, we strongly recommend starting with the smallest instance (partial_8.lp, ~398 MB) to verify the environment and solver configuration.
-
Download and unzip the
GISPO_LP.ziparchive from this repository. -
Ensure the provided Python script
solve_gispo_lp.pyis placed in the same directory as theGISPO_LPfolder (or adjust the path accordingly). -
Run the script via terminal/command prompt:
# Option 1: Run the default demo (targets partial_8.lp) python solve_gispo_lp.py # Option 2: Specify a path to a specific file python solve_gispo_lp.py GISPO_LP/partial_8.lp
Expected Output: The solver will output the log detailing the pre-solve, iteration process (Barrier/Simplex), and final objective value.
- Expected Status:
Optimization was successful(orOptimal). - Expected Run Time:
- For
partial_8.lp(Demo): Approximately 20 minutes on a standard desktop. - For
partial_0.lp(Full Scale): This requires a high-performance server.
- For
2.4 Instructions for Use (Source Code & Custom Data)
The .lp files in this archive are static snapshots of the model instances used in the paper. To generate new LP files with different parameters, inputs, or for other regions, please refer to our source code and data generation repositories.
- LP Files:
https://doi.org/10.5281/zenodo.17618090 - Data Generation:
https://github.com/mrziheng/GlobalRenewableEnergyResource
Reproduction Instructions:
- Clone the
NetZero2050repository. - Follow the instructions in that repository's README to set up the input data (downloaded from the
GlobalRenewableEnergyResourcerepo). - Run the main model script (e.g.,
run_gispo_main.py) to generate new.lpfiles. - Solve the generated files using the method described in the "Demo" section above.
License
This project is licensed under the CC-BY 4.0 License.