Sovereign 8s.is mirror of standardgalactic/NetZero2050
  • Jupyter Notebook 99.8%
  • Python 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ziheng Zhu 86bed3d12e
Clarify contents of sp_status.pkl file
Updated description of sp_status.pkl in README.
2026-03-22 16:16:13 +08:00
DemandProfNorm Add files via upload 2025-12-09 19:53:07 +08:00
Plots ddd 2025-12-22 09:16:47 +00:00
README.md Clarify contents of sp_status.pkl file 2026-03-22 16:16:13 +08:00
solve_gispo_lp.py Add files via upload 2026-01-16 21:22:33 +08:00

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:

  1. 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 the Plots/ directory).
  2. 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

  1. Install Python: Download and install Python from https://www.python.org/.
  2. Install Plotting Dependencies: Run pip install jupyter pandas matplotlib seaborn geopandas to set up the environment.
  3. Run Notebooks: Open the Jupyter Notebooks named Figure1.ipynb through Figure7c.ipynb to 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 load partial_0.lp on 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)

  1. Install Python: Download and install Python from https://www.python.org/.
  2. 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-Python for 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.

  1. Download and unzip the GISPO_LP.zip archive from this repository.

  2. Ensure the provided Python script solve_gispo_lp.py is placed in the same directory as the GISPO_LP folder (or adjust the path accordingly).

  3. 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 (or Optimal).
  • 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.

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:

  1. Clone the NetZero2050 repository.
  2. Follow the instructions in that repository's README to set up the input data (downloaded from the GlobalRenewableEnergyResource repo).
  3. Run the main model script (e.g., run_gispo_main.py) to generate new .lp files.
  4. 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.