diff --git a/.github/workflows/check-precommit-applied.yml b/.github/workflows/check-precommit-applied.yml index 521faf66..ec171297 100644 --- a/.github/workflows/check-precommit-applied.yml +++ b/.github/workflows/check-precommit-applied.yml @@ -13,17 +13,17 @@ jobs: steps: # Checkout full repo history to ensure diff calculation works - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v6 with: python-version: '3.12' # Cache pre-commit environments - name: Cache pre-commit hooks - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ~/.cache/pre-commit key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bac8cf63..6edad5fa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,12 +23,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 # Fetch all history for mike to work properly - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.12" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81ceba59..2231a27b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: # If no specific notes found, use a default message if [ ! -s release_notes.md ]; then - echo "Release $VERSION of PyPSA-China (PIK)" > release_notes.md + echo "Release $VERSION of PyPSA-China" > release_notes.md echo "" >> release_notes.md echo "For detailed changes, see the [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)." >> release_notes.md fi @@ -60,7 +60,7 @@ jobs: uses: softprops/action-gh-release@v1 with: tag_name: ${{ steps.get_version.outputs.VERSION }} - name: PyPSA-China PIK ${{ steps.get_version.outputs.VERSION }} + name: PyPSA-China ${{ steps.get_version.outputs.VERSION }} body_path: release_notes.md draft: false prerelease: false @@ -121,4 +121,4 @@ jobs: run: | VERSION="${{ steps.get_version.outputs.VERSION }}" echo "πŸ“š Documentation for version $VERSION has been deployed to GitHub Pages" - echo "View at: https://pik-piam.github.io/PyPSA-China-PIK/" + echo "View at: https://pypsa.github.io/PyPSA-China/" diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 078c7df1..d3076c77 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -17,7 +17,7 @@ jobs: steps: # Step 1: Checkout the repository - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # Step 2: Install Miniforge (no env creation here) - name: Setup Miniforge @@ -34,7 +34,7 @@ jobs: # Step 3: Restore full Conda environment cache AFTER setup - name: Restore Conda env cache id: env-cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | /home/runner/miniforge3/envs/pypsa-china diff --git a/.github/workflows/test-docs-build.yml b/.github/workflows/test-docs-build.yml index ee0edc8e..4465b017 100644 --- a/.github/workflows/test-docs-build.yml +++ b/.github/workflows/test-docs-build.yml @@ -24,10 +24,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.12" @@ -50,7 +50,7 @@ jobs: - name: Upload build artifacts if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: docs-build-output path: site/ @@ -67,7 +67,7 @@ jobs: - name: Upload build artifacts if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: failed-build path: site/ diff --git a/CHANGELOG.md b/CHANGELOG.md index c316f138..68a84cfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Official release preparation with versioned documentation -- Comprehensive documentation at https://pik-piam.github.io/PyPSA-China-PIK/ +- Comprehensive documentation at https://pypsa.github.io/PyPSA-China/ - MkDocs-based documentation with Material theme - Support for versioned documentation using mike - GitHub Actions workflow for automated documentation deployment @@ -54,7 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Multiple enhancements to the modeling workflow - Improved data handling and processing -## [1.0.x] - Initial PIK Releases +## [1.0.x] - Initial Release ### Added - Initial PIK adaptation of PyPSA-China @@ -68,10 +68,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Version History Notes -PyPSA-China (PIK) is based on the paper by Zhou et al, which extends a version original developed by Hailiang Liu et al. This changelog tracks changes from version 1.0.0 onwards in the PIK implementation. +PyPSA-China is based on the paper by Zhou et al, which extends a version original developed by Hailiang Liu et al. This changelog tracks changes from version 1.0.0 onwards in the re-implementation. -For detailed information about specific changes, see the [commit history](https://github.com/pik-piam/PyPSA-China-PIK/commits/main) on GitHub. +For detailed information about specific changes, see the [commit history](https://github.com/pypsa/PyPSA-China/commits/main) on GitHub. -[Unreleased]: https://github.com/pik-piam/PyPSA-China-PIK/compare/v1.3.0...HEAD -[1.3.0]: https://github.com/pik-piam/PyPSA-China-PIK/releases/tag/v1.3.0 -[1.2.0]: https://github.com/pik-piam/PyPSA-China-PIK/releases/tag/v1.2.0 +[Unreleased]: https://github.com/pypsa/PyPSA-China/compare/v1.3.0...HEAD +[1.3.0]: https://github.com/pypsa/PyPSA-China/releases/tag/v1.3.0 +[1.2.0]: https://github.com/pypsa/PyPSA-China/releases/tag/v1.2.0 diff --git a/CITATION.cff b/CITATION.cff index 692ffe07..1df5bc7a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,12 +1,16 @@ cff-version: 1.2.0 message: "If you use this software, please cite it as below." type: software -title: "PyPSA-China (PIK): An Open-Source Optimisation Model of the Chinese Energy System" +title: "PyPSA-China: An Open-Source Optimisation Model of the Chinese Energy System" authors: - - name: "PIK RD3-ETL Team" + - name: "PIK Energy Transition Lab" affiliation: "Potsdam Institute for Climate Impact Research (PIK)" -repository-code: "https://github.com/pik-piam/PyPSA-China-PIK" -url: "https://pik-piam.github.io/PyPSA-China-PIK/" + - name: Xiaowei Zhou + affiliation: "Technische UniversitΓ€t Berlin, Germany" + - name: Hailiang Liu + affiliation: "" +repository-code: "https://github.com/pypsa/PyPSA-China" +url: "https://pypsa.github.io/PyPSA-China/" license: MIT (code - data may differ) version: 1.3.2 date-released: 2025-12-02 @@ -19,12 +23,11 @@ keywords: - capacity expansion - PyPSA abstract: > - PyPSA-China (PIK) is an open-source model of the Chinese energy system + PyPSA-China is an open-source model of the Chinese energy system covering electricity and heat. It co-optimizes dispatch and investments under user-set constraints, such as limits to environmental impacts, to minimize costs. The model works at provincial resolution and can simulate - a full year at hourly resolution. This is the PIK implementation, adapted - for coupling with the REMIND integrated assessment model. + a full year at hourly resolution. references: - type: article title: "The role of hydro power, storage and transmission in the decarbonization of the Chinese power system" diff --git a/CITATION.md b/CITATION.md index bdd49a11..c1175c3f 100644 --- a/CITATION.md +++ b/CITATION.md @@ -2,18 +2,18 @@ ## How to Cite -If you use PyPSA-China (PIK) in your research, please cite: +If you use PyPSA-China in your research, please cite: ### Software Citation ```bibtex -@software{pypsa_china_pik, - author = {{PIK RD3-ETL Team}}, - title = {PyPSA-China (PIK): An Open-Source Optimisation Model of the Chinese Energy System}, +@software{pypsa_china, + author = {{PIK RD3-ETL Team, Zhou, Xiaowei}}, + title = {PyPSA-China: An Open-Source Optimisation Model of the Chinese Energy System}, year = {2024}, publisher = {GitHub}, journal = {GitHub repository}, - url = {https://github.com/pik-piam/PyPSA-China-PIK}, + url = {https://github.com/pypsa/PyPSA-China}, version = {1.3.2, doi = {10.5281/zenodo.XXXXXXX} % Add Zenodo DOI when available } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 092d2e7e..cf09029b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to PyPSA-China (PIK) +# Contributing to PyPSA-China -Thank you for your interest in contributing to PyPSA-China (PIK)! This document provides guidelines and instructions for contributing to the project. +Thank you for your interest in contributing to PyPSA-China! This document provides guidelines and instructions for contributing to the project. ## Table of Contents @@ -18,10 +18,10 @@ Thank you for your interest in contributing to PyPSA-China (PIK)! This document 1. **Fork the repository** on GitHub 2. **Clone your fork** locally: ```bash - git clone https://github.com/your-username/PyPSA-China-PIK.git - cd PyPSA-China-PIK + git clone https://github.com/your-username/PyPSA-China.git + cd PyPSA-China ``` -3. **Set up the development environment** following the [installation guide](https://pik-piam.github.io/PyPSA-China-PIK/installation/quick_start/) +3. **Set up the development environment** following the [installation guide](https://pypsa.github.io/PyPSA-China/installation/quick_start/) 4. **Create a branch** for your changes: ```bash git checkout -b feature/your-feature-name @@ -279,14 +279,14 @@ Releases are managed by project maintainers: ## Questions? -- Check the [documentation](https://pik-piam.github.io/PyPSA-China-PIK/) -- Open a [discussion](https://github.com/pik-piam/PyPSA-China-PIK/discussions) +- Check the [documentation](https://pypsa.github.io/PyPSA-China/) +- Open a [discussion](https://github.com/pypsa/PyPSA-China/discussions) - Contact the maintainers via GitHub issues ## License -By contributing to PyPSA-China (PIK), you agree that your contributions will be licensed under the [MIT License](LICENSES/MIT.txt). +By contributing to PyPSA-China, you agree that your contributions will be licensed under the [MIT License](LICENSES/MIT.txt). --- -Thank you for contributing to PyPSA-China (PIK)! πŸŽ‰ +Thank you for contributing to PyPSA-China! πŸŽ‰ diff --git a/README.md b/README.md index c56ce933..4ae73cd1 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,41 @@ # PyPSA-China:An Open-Source Optimisation model of the Chinese Energy System [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://pik-piam.github.io/PyPSA-China-PIK/) -[![GitHub release](https://img.shields.io/github/v/release/pik-piam/PyPSA-China-PIK)](https://github.com/pik-piam/PyPSA-China-PIK/releases) +[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://pypsa.github.io/PyPSA-China/) +[![GitHub release](https://img.shields.io/github/v/release/pypsa/PyPSA-China)](https://github.com/pypsa/PyPSA-China/releases) -PyPSA-China (PIK) is a open-source model of the Chinese energy system covering electricity and heat. It co-optimizes dispatch and investments under user-set constraints, such as limits to environmental impacts, to minimize costs. The model works at provincial resolution and can simulate a full year at hourly resolution. +PyPSA-China is a open-source model of the Chinese energy system covering electricity and heat. It co-optimizes dispatch and investments under user-set constraints, such as limits to environmental impacts, to minimize costs. The model works at provincial resolution and can simulate a full year at hourly resolution. -## PIK version -This is the PIK implementation of the PyPSA-China power model, first published by Hailiang Liu et al for their study of [hydro-power in china](https://doi.org/10.1016/j.apenergy.2019.02.009) and extended by Xiaowei Zhou et al for their ["Multi-energy system horizon planning: Early decarbonisation in China avoids stranded assets"](doi.org/10.1049/ein2.12011) paper. It is adapted from the Zhou version by the [PIK RD3-ETL team](https://www.pik-potsdam.de/en/institute/labs/energy-transition/energy-transition-lab), with the aim of coupling it to the [REMIND](https://www.pik-potsdam.de/en/institute/departments/transformation-pathways/models/remind) integrated assessment model. A reference guide is available as part of the [documentation](https://pik-piam.github.io/PyPSA-China-PIK/). +The PyPSA-China power model, was first developed by H Liu et al for their study of [hydro-power in china](https://doi.org/10.1016/j.apenergy.2019.02.009) and then extended and released by X Zhou et al for their ["Multi-energy system horizon planning: Early decarbonisation in China avoids stranded assets"](doi.org/10.1049/ein2.12011) paper. The current version has been heavily reworked and is currently maintained by the [Potsdam Institute for Climate Impact Studies ETL team](https://www.pik-potsdam.de/en/institute/labs/energy-transition/energy-transition-lab). ## Overview -PyPSA-China should be understood as a modelling worklow, using snakemake as workflow manager, around the [PyPSA python power system analysis](https://pypsa.org/) package. The workflow collects data, builds the power system network and plots the results. It is akin to its more mature sister project, [PyPSA-EUR](https://github.com/PyPSA/pypsa-eur), from which it is derived. +PyPSA-China should be understood as a modelling worklow, using snakemake as workflow manager, around the [PyPSA python power system analysis](https://pypsa.org/) package. The workflow collects data, builds the power system network and plots the results. It is akin to its more mature sibbling, [PyPSA-EUR](https://github.com/PyPSA/pypsa-eur), from which it is derived. -Unlike PyPSA-EUR, which simplifies high resolution electricity grid data to a user-defined network size, the PyPSA-China network is currently fixed to one node per province (with a 340 node version in the works). This is in large part due to data availability issues. +Unlike PyPSA-EUR, which simplifies high resolution electricity grid data to a user-defined network size, the PyPSA-China network is currently fixed to one node per province (a 341 node version in the works and will be released this year) The PyPSA can perform a number of different study types (investment decision, operational decisions, simulate AC power flows). Currently only capacity expansion problems are explicitly implemented in PyPSA-China. -The PyPSA-CHINA-PIK is currently under development. Please contact us if you intend to use it for publications. +PyPSA-China natively supports coupling with the [REMIND](https://www.pik-potsdam.de/en/institute/departments/transformation-pathways/models/remind) integrated assessment model. ## Quick Links -- πŸ“– [Documentation](https://pik-piam.github.io/PyPSA-China-PIK/) +- πŸ“– [Documentation](https://pypsa.github.io/PyPSA-China/) - πŸ“ [Changelog](CHANGELOG.md) -- πŸš€ [Releases](https://github.com/pik-piam/PyPSA-China-PIK/releases) +- πŸš€ [Releases](https://github.com/pypsa/PyPSA-China/releases) - 🀝 [Contributing Guide](CONTRIBUTING.md) - πŸ“‹ [Release Guide](docs/release-guide.md) (for maintainers) # License -The code is released under the [MIT license](https://github.com/irr-github/PyPSA-China-PIK/blob/main/LICENSES/MIT.txt), however some of the data used is more restrictive. +The code is released under the [MIT license](https://github.com/pypsa/PyPSA-China/blob/main/LICENSES/MIT.txt), however some of the data used is more restrictive. # Documentation -The documentation can be found at https://pik-piam.github.io/PyPSA-China-PIK/ +The documentation can be found at https://pypsa.github.io/PyPSA-China/ # Getting started ## Installation -An installation guide is provided at https://pik-piam.github.io/PyPSA-China-PIK/ +An installation guide is provided at https://pypsa.github.io/PyPSA-China/ ## Getting the data You will need to enable data retrieval in the config @@ -49,11 +48,10 @@ enable: Some of the files are very large - expect a slow process! - You can also download the data manually and copy it over to the correct folder. The source and target destinations are the input/output of the `fetch_` rules in `workflow/rules/fetch_data.smk` -- **PIK HPC users only** you can also copy the data from other users ## Usage -Detailed instructions in the documentation. +Detailed instructions in the documentation. ### local execution - local execution can be started (once the environment is activated) with `snakemake` - to customize the options, create `my_config.yaml` and launch `snakemake --configfile `my_config.yaml`. Configuration options are summarised in the documentation. @@ -62,7 +60,3 @@ This is relevant for slurm HPCs and other remotes with a submit job command - The workflow can be launched with `snakemake --profile config/compute_profile` - [PIK HPC users only] use `snakemake --profile config/pik_hpc_profile` - If you are not running on the PIK hpc, you will need make a new profile for your machine under `config//config.yaml` - - - - diff --git a/RELEASE_SETUP.md b/RELEASE_SETUP.md index 4de9af07..eb2cda29 100644 --- a/RELEASE_SETUP.md +++ b/RELEASE_SETUP.md @@ -83,7 +83,7 @@ This document provides a complete summary of the release infrastructure that has ### For Users Users can: -1. View versioned documentation at https://pik-piam.github.io/PyPSA-China-PIK/ +1. View versioned documentation at https://pypsa.github.io/PyPSA-China/ 2. Select specific versions using the version selector 3. Download specific releases from GitHub 4. Track changes via CHANGELOG.md @@ -105,7 +105,7 @@ To create a release: ```bash # Update version in workflow/__init__.py __version__ = "1.3.0" - + # Update CHANGELOG.md with release date ## [1.3.0] - 2025-12-02 ``` @@ -121,7 +121,7 @@ To create a release: - Go to Actions β†’ "Create Release Tag" - Enter version (e.g., `1.3.0`) - Click "Run workflow" - + OR manually: ```bash git tag -a v1.3.0 -m "Release version 1.3.0" @@ -198,7 +198,7 @@ Standardized PR descriptions with checklist 3. **Verify Deployment**: - Check GitHub release page - - Verify documentation at https://pik-piam.github.io/PyPSA-China-PIK/ + - Verify documentation at https://pypsa.github.io/PyPSA-China/ - Test version selector ### Optional Enhancements diff --git a/config/default_config.yaml b/config/default_config.yaml index bfd38cc3..83addfd5 100644 --- a/config/default_config.yaml +++ b/config/default_config.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: : 2025 The PyPSA-China-PIK Authors +# SPDX-FileCopyrightText: : 2025 The PyPSA-China Authors # # SPDX-License-Identifier: CC0-1.0 # DO NOT FORGET TO LOOK AT THE TECHNOLOGY CONFIGURATION FILES @@ -10,7 +10,7 @@ foresight: "overnight" paths: results_dir: "results/" costs_dir: "resources/data/costs/default" - yearly_regional_load: + yearly_regional_load: ac: "resources/data/load/Provincial_Load_2020_2060_MWh.csv" # 2025 load is repalced by the 2024 national bureau of statistics: https://data.stats.gov.cn/easyquery.htm?cn=E0103 # conversion factor to MWh in case ac load file in another unit ac_to_mwh: 1 @@ -20,8 +20,8 @@ edge_paths: current+FCG: "resources/data/grids/edges_current_FCG.csv" current+Neighbor: "resources/data/grids/edges_current_neighbor.csv" - -scenario: + +scenario: co2_pathway: ["exp175default"] # co2_scenarios that will be used topology: "current+FCG" # "current" or "FCG" or "current+FCG" or "current+Neighbor" planning_horizons: @@ -37,7 +37,7 @@ scenario: heating_demand: ["positive"] # emission reduction scenarios (can be selected with scenario.co2_pathway) -co2_scenarios: +co2_scenarios: exp175default: control: "reduction" # price | reduction | budget | None pathway: @@ -91,7 +91,7 @@ atlite: dy: 5 weather_year: 2020 -# renewable potentials and availabilities from Atlite. +# renewable potentials and availabilities from Atlite. # !CARE cutout should match atlite.cutout_name above renewable: onwind: @@ -102,7 +102,7 @@ renewable: # bin by capacity factor resource_classes: min_cf_delta: 0.05 - n: 3 + n: 3 capacity_per_sqkm: 3 # ScholzPhd Tab 4.3.1: 10MW/km^2 potential: simple # or conservative natural_reserves: false @@ -185,9 +185,8 @@ Techs: non_dispatchable: ['Offshore Wind', 'Onshore Wind', 'Solar', 'Solar Residential', "Solar Thermal"] conv_techs: ["CCGT", "CHP gas", "CHP OCGT gas", "gas boiler","coal boiler","coal power plant","CHP coal", "OCGT"] store_techs: ["H2","battery","water tanks","PHS"] - non_dispatchable: ["onwind", "offwind", "solar", "solar thermal"] hydrogen_lines: true - coal_ccs_retrofit: false # currently myopic pathway only. CC = co2 cap + coal_ccs_retrofit: false # currently myopic pathway only. CC = co2 cap ## Nuclear capacity growth limit nuclear_reactors: @@ -320,12 +319,12 @@ lines: security: line_security_margin: 70 # max percent of line capacity - + # brownfield options existing_capacities: add: True # whether to add brownfield capacities grouping_years: [1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060] - collapse_years: True # Treat as a single unit when preparing & solving network + collapse_years: True # Treat as a single unit when preparing & solving network threshold_capacity: 80 # MW techs: ['coal','CHP coal', 'CHP gas', 'OCGT', 'CCGT', 'solar', 'onwind', 'offwind', 'nuclear', "PHS", "biomass"] node_assignment: simple # simple | gps @@ -338,20 +337,20 @@ operational_reserve: contingency: 300000 # MW. Additional reserves on top of fractions # TODO integrate in workflow: split_provinces is currently not supported by build_loads and reporting -nodes: +nodes: split_provinces: False # split (some) provinces (admin l1) using admin l2 (counties/prefectures) # exclude currently only applies if split_provinces is True, will be fixed with integrartion to workflow exclude_provinces: ["Macau", "HongKong"] # list of provinces to exclude from splitting splits: # adminl2 groups per adminl1. {adminl1: {custom_name: [adminl2_names],..}} InnerMongolia: - West: + West: - "Hulunbuir" - "Xing'an" - "Tongliao" - "Chifeng" - "Xilin Gol" - East: + East: - "Alxa" - "Baotou" - "Baynnur" @@ -367,8 +366,8 @@ io: zlib: True # simplification of shapes to save memory. If using GPS for plant node assignment a lower value is preferable. -fetch_regions: - simplify_tol: +fetch_regions: + simplify_tol: eez: 0.5 land: 0.05 @@ -379,6 +378,6 @@ subsidies: Guangdong: -10 Jiangsu: -10 Zhejiang: -10 - Beijing: -11 + Beijing: -11 Tianjin: -11 Shanghai: -11 diff --git a/docs/index.md b/docs/index.md index 2b35174f..f672aaf6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,15 +1,15 @@ -# Welcome to the PyPSA-China-PIK documentation! +# Welcome to the PyPSA-China documentation! -This is the documentation for the Potsdam Institute for Climate Impact Studies' (PIK) **Python Power System Analysis for China** (`PyPSA-China-PIK`) model, maintained by the [Energy Transition Lab](https://www.pik-potsdam.de/en/institute/labs/energy-transition/energy-transition-lab) at PIK. `PyPSA-China-PIK` is an open model to simulate the future of energy in China at provincial level. Currently, electricity and heat are covered as energy sectors. +This is the documentation for the **Python Power System Analysis for China** (`PyPSA-China`) model, maintained by the [Energy Transition Lab](https://www.pik-potsdam.de/en/institute/labs/energy-transition/energy-transition-lab) at the Potsdam Institute for Climate Impact Studies. `PyPSA-China` is an open model to simulate the future of energy in China at provincial level. Currently, electricity and heat are covered as energy sectors. The model can be partially coupled to the [REMIND](https://www.pik-potsdam.de/en/institute/departments/transformation-pathways/models/remind) Integrated Assesment Model to obtain multi-sectoral demand pathways. In this mode, battery electric vehicles can also be modelled. -## What is PyPSA-China-PIK? +## What is PyPSA-China? -`PyPSA-China-PIK` is a highly configurable, open-source and open data power system model that co-optimises investments (capacity expansion) and dispatch of future energy systems in China. The model covers several end-use sectors, including electricity, battery electric vehicles and heat. It comes with default data for costs, technical parameters, loads and existing infrastructure that can easily be replaced. The execution options are controlled by configuration files, meaning the code can be run with limited or even no coding expertise. A highly modular structure also makes it easy to extend the model. +`PyPSA-China` is a highly configurable, open-source and open data power system model that co-optimises investments (capacity expansion) and dispatch of future energy systems in China. The model covers several end-use sectors, including electricity, battery electric vehicles and heat. It comes with default data for costs, technical parameters, loads and existing infrastructure that can easily be replaced. The execution options are controlled by configuration files, meaning the code can be run with limited or even no coding expertise. A highly modular structure also makes it easy to extend the model. -`PyPSA-China-PIK` is built around the [PyPSA](https://pypsa.org/) "Python for Power System Analysis" (pronounced "pipes-ah") energy system modelling toolbox. PyPSA provides python objects that represent mixed AC and DC electricity networks, generators with optional unit commitment or variable generation, storage units and transformers as well as efficient bindings to open-source and commercial solvers. +`PyPSA-China` is built around the [PyPSA](https://pypsa.org/) "Python for Power System Analysis" (pronounced "pipes-ah") energy system modelling toolbox. PyPSA provides python objects that represent mixed AC and DC electricity networks, generators with optional unit commitment or variable generation, storage units and transformers as well as efficient bindings to open-source and commercial solvers. -Currently, hourly (and lower) time resolutions and provincial level demand and transmission are supported. It is possible to improve the spatial resolution as for other `PyPSA` workflows (EUR, USA, earth) if open data is available. +Currently, hourly (and lower) time resolutions and provincial level demand and transmission are supported. It is possible to improve the spatial resolution as for other `PyPSA` workflows (EUR, USA, earth) if open data is available. ## Capabilities @@ -32,9 +32,9 @@ The model has been validated against short term energy trends. **Todo: add figur ## Learning -The model comes with an [installation guide](installation/quick_start), [model overview](model) [basic tutorials](tutorials/running/) and references for the [code](reference/SUMMARY/) and [configuration options](configuration). `PyPSA-China-PIK` is best understood as workflow, managed by the low-code [snakemake tool](https://snakemake.readthedocs.io/en/stable/). It is possible to run the workflow with minimal knowledge of `snakemake` and we have listed a few useful [tricks](tutorials/snakemake_tricks/) but we recommend going over the snakemake documentation. +The model comes with an [installation guide](installation/quick_start), [model overview](model) [basic tutorials](tutorials/running/) and references for the [code](reference/SUMMARY/) and [configuration options](configuration). `PyPSA-China` is best understood as workflow, managed by the low-code [snakemake tool](https://snakemake.readthedocs.io/en/stable/). It is possible to run the workflow with minimal knowledge of `snakemake` and we have listed a few useful [tricks](tutorials/snakemake_tricks/) but we recommend going over the snakemake documentation. -The workflow consists of gathering and preparing relevant data, formulating the problem as a PyPSA network object, minimising the system costs using a solver and post-processing the data. The `atlite` package is used to compute renewable generator availability and potentials. You may want to look into the [PyPSA documentation](https://pypsa.readthedocs.io/en/stable/) and the [atlite documentation](https://atlite.readthedocs.io/en/latest/). +The workflow consists of gathering and preparing relevant data, formulating the problem as a PyPSA network object, minimising the system costs using a solver and post-processing the data. The `atlite` package is used to compute renewable generator availability and potentials. You may want to look into the [PyPSA documentation](https://pypsa.readthedocs.io/en/stable/) and the [atlite documentation](https://atlite.readthedocs.io/en/latest/). ![PyPSA-China Workflow](./assets/img/pypsa-china-workflow.png) @@ -45,7 +45,7 @@ This version has is maintained by the [PIK RD3-ETL team](https://www.pik-potsdam The model is based on the `PyPSA-EUR` work by the Tom Brown Group, originally adapted to China by Hailiang Liu et al for their study of [hydro-power in china](https://doi.org/10.1016/j.apenergy.2019.02.009) and extended by Xiaowei Zhou et al for their ["Multi-energy system horizon planning: Early decarbonisation in China avoids stranded assets"](https://doi.org/10.1049/ein2.12011) paper. It has received significant upgrades. -[![GitHub stars](https://img.shields.io/github/stars/pik-piam/PyPSA-China-PIK?style=social)](https://github.com/pik-piam/PyPSA-China-PIK/stargazers) -[![GitHub forks](https://img.shields.io/github/forks/pik-piam/PyPSA-China-PIK?style=social)](https://github.com/pik-piam/PyPSA-China-PIK/network/members) +[![GitHub stars](https://img.shields.io/github/stars/pypsa/PyPSA-China?style=social)](https://github.com/pypsa/PyPSA-China/stargazers) +[![GitHub forks](https://img.shields.io/github/forks/pypsa/PyPSA-China?style=social)](https://github.com/pypsa/PyPSA-China/network/members) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://pik-piam.github.io/PyPSA-China-PIK/) \ No newline at end of file +[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://pypsa.github.io/PyPSA-China/) diff --git a/docs/installation/quick_start.md b/docs/installation/quick_start.md index 50700983..8034b049 100644 --- a/docs/installation/quick_start.md +++ b/docs/installation/quick_start.md @@ -2,11 +2,11 @@ # Quick Start !!!note "System requirements" - With the low-resolution settings, PyPSA-China-PIK will run on a local machine or laptop. Solving a full year at hourly resolution will require a high performance cluster or server with around 50GB of RAM - depending on your settings. + With the low-resolution settings, PyPSA-China will run on a local machine or laptop. Solving a full year at hourly resolution will require a high performance cluster or server with around 50GB of RAM - depending on your settings. ## Installation -1. **Install the [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) package manager** +1. **Install the [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) package manager** It may be possible to run the workflow with a better manager such as `uv` but it will not work out of the box @@ -14,8 +14,8 @@ !!!note "Conda tips" - Conda is a rather large install with a GUI and features not required by PyPSA-China. You may prefer to use the lighter miniconda, which is our recommendation. - + Conda is a rather large install with a GUI and features not required by PyPSA-China. You may prefer to use the lighter miniconda, which is our recommendation. + You can check whether you already have conda with `which anaconda` or `which conda`. Newer condas have a faster dependcy solver - as the package is rather large we strongly recommend you update to `v> 2024.10`. === "Windows" @@ -23,11 +23,11 @@ !!!note "Conda tips" Conda is a rather large install with a GUI and features not required by PyPSA-China. You may prefer to use the lighter miniconda, which is our recommendation - + You can check whether you already have conda with `where anaconda` or `where conda`. Newer condas have a faster dependcy solver - as the package is rather large we strongly recommend you update to `v> 2024.9`. -2. **Setup the environment**: This can take a long time +2. **Setup the environment**: This can take a long time === "Unix/MacOS/WSL" ```bash title="install dependencies" @@ -45,7 +45,7 @@ ```bash title="activate environment" conda activate pypsa-china ``` - + 4. **Fetch data** @@ -87,4 +87,4 @@ conda activate pypsa-china cd pytest tests/integration - ``` \ No newline at end of file + ``` diff --git a/docs/release-guide.md b/docs/release-guide.md index b9efb26d..d70d3ed7 100644 --- a/docs/release-guide.md +++ b/docs/release-guide.md @@ -1,4 +1,4 @@ -# Release Guide for PyPSA-China (PIK) +# Release Guide for PyPSA-China This guide is for maintainers who are preparing and publishing releases. @@ -54,7 +54,7 @@ Update the CHANGELOG with the new version: Add the version link at the bottom: ```markdown -[X.Y.Z]: https://github.com/pik-piam/PyPSA-China-PIK/releases/tag/vX.Y.Z +[X.Y.Z]: https://github.com/pypsa/PyPSA-China/releases/tag/vX.Y.Z ``` ### 3. Commit Changes @@ -115,11 +115,11 @@ Once the tag is pushed, the Release workflow automatically: After the workflows complete: 1. **Check the GitHub Release**: - - Visit https://github.com/pik-piam/PyPSA-China-PIK/releases + - Visit https://github.com/pypsa/PyPSA-China/releases - Verify the release appears with correct version and notes 2. **Check the Documentation**: - - Visit https://pik-piam.github.io/PyPSA-China-PIK/ + - Visit https://pypsa.github.io/PyPSA-China/ - Verify the version selector shows the new version - Check that content is correct for the new version diff --git a/docs/releases.md b/docs/releases.md index b6d01347..6cf32b43 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1,10 +1,10 @@ # Release Notes -This page provides an overview of releases and how to work with different versions of PyPSA-China (PIK). +This page provides an overview of releases and how to work with different versions of PyPSA-China. ## Current Release -The current stable release is **v1.3.2**. See the [CHANGELOG](https://github.com/pik-piam/PyPSA-China-PIK/blob/main/CHANGELOG.md) for detailed information about changes in this and previous versions. +The current stable release is **v1.3.2**. See the [CHANGELOG](https://github.com/pypsa/PyPSA-China/blob/main/CHANGELOG.md) for detailed information about changes in this and previous versions. ## Documentation @@ -16,7 +16,7 @@ You can view documentation for different versions using the version selector in ## Release Schedule -PyPSA-China (PIK) follows semantic versioning: +PyPSA-China follows semantic versioning: - **Major releases** (X.0.0) - Significant changes, may include breaking changes - **Minor releases** (X.Y.0) - New features, backward compatible @@ -28,8 +28,8 @@ PyPSA-China (PIK) follows semantic versioning: ```bash # Clone the repository -git clone https://github.com/pik-piam/PyPSA-China-PIK.git -cd PyPSA-China-PIK +git clone https://github.com/pypsa/PyPSA-China.git +cd PyPSA-China git checkout v1.3.2 ``` @@ -37,8 +37,8 @@ git checkout v1.3.2 ```bash # Clone the repository -git clone https://github.com/pik-piam/PyPSA-China-PIK.git -cd PyPSA-China-PIK +git clone https://github.com/pypsa/PyPSA-China.git +cd PyPSA-China # Stay on main branch for latest development version ``` @@ -46,8 +46,8 @@ cd PyPSA-China-PIK ```bash # Clone the repository -git clone https://github.com/pik-piam/PyPSA-China-PIK.git -cd PyPSA-China-PIK +git clone https://github.com/pypsa/PyPSA-China.git +cd PyPSA-China git checkout vX.Y.Z # Replace with desired version ``` @@ -73,13 +73,13 @@ When upgrading between versions, please review the CHANGELOG for: If you encounter issues after upgrading or have questions about a specific release: -1. Check the [documentation](https://pik-piam.github.io/PyPSA-China-PIK/) -2. Review [closed issues](https://github.com/pik-piam/PyPSA-China-PIK/issues?q=is%3Aissue+is%3Aclosed) for similar problems -3. Open a new [issue](https://github.com/pik-piam/PyPSA-China-PIK/issues/new/choose) +1. Check the [documentation](https://pypsa.github.io/PyPSA-China/) +2. Review [closed issues](https://github.com/pypsa/PyPSA-China/issues?q=is%3Aissue+is%3Aclosed) for similar problems +3. Open a new [issue](https://github.com/pypsa/PyPSA-China/issues/new/choose) ## Release History -For the complete release history and detailed change information, see the [CHANGELOG](https://github.com/pik-piam/PyPSA-China-PIK/blob/main/CHANGELOG.md). +For the complete release history and detailed change information, see the [CHANGELOG](https://github.com/pypsa/PyPSA-China/blob/main/CHANGELOG.md). ### Version 1.3.2 (2025-12-02) @@ -101,7 +101,7 @@ To stay informed about new releases: ## Contributing to Releases -Interested in contributing to the next release? See our [Contributing Guide](https://github.com/pik-piam/PyPSA-China-PIK/blob/main/CONTRIBUTING.md) for information on: +Interested in contributing to the next release? See our [Contributing Guide](https://github.com/pypsa/PyPSA-China/blob/main/CONTRIBUTING.md) for information on: - How to propose features - Development workflow diff --git a/docs/tutorials/running.md b/docs/tutorials/running.md index 1bc90327..5b43b6c4 100644 --- a/docs/tutorials/running.md +++ b/docs/tutorials/running.md @@ -1,13 +1,13 @@ -# Running the workflow +# Running the workflow ## Snakefile & config -PyPSA-China execution is controlled by the [snakemake](https://snakemake.readthedocs.io/en/stable/) workflow manager. The `snakefile` should be understood as a control file. All implemented functionalities are accessible via the config and CLI args, the control should only be edited if you need new features (or to fix bugs). +PyPSA-China execution is controlled by the [snakemake](https://snakemake.readthedocs.io/en/stable/) workflow manager. The `snakefile` should be understood as a control file. All implemented functionalities are accessible via the config and CLI args, the control should only be edited if you need new features (or to fix bugs). -The workflow is intended to be managed via the config files rather than the CLI argumnents. As explained below, the config files allow the control of nearly all aspects of the PyPSA-China execution. +The workflow is intended to be managed via the config files rather than the CLI argumnents. As explained below, the config files allow the control of nearly all aspects of the PyPSA-China execution. ## Default run (local) -If the pypsa-china environment is [installed & activated](../../installation/quick_start/), you can lauch run a with the default settings +If the pypsa-china environment is [installed & activated](../../installation/quick_start/), you can lauch run a with the default settings ```bash title="launch default run" cd snakemake @@ -44,9 +44,9 @@ You can run any of the modules as standalone python thanks to the `mock_snakemak ## Remote/hpc execution with profiles -The `--profile` arg allows you to specify execution snakemake options via a yaml config file. This is a better alternative to the CLI in many cases. +The `--profile` arg allows you to specify execution snakemake options via a yaml config file. This is a better alternative to the CLI in many cases. -The `--profile` is especially useful for specifying and controlling remote execution, for example on an HPC. You will find a slurm HPC example in the config under `pik_hpc_profile/`. This allows you to set the compute resources per rule. Note that the profile must be called `config.yaml` +The `--profile` is especially useful for specifying and controlling remote execution, for example on an HPC. You will find a slurm HPC example in the config under `pik_hpc_profile/`. This allows you to set the compute resources per rule. Note that the profile must be called `config.yaml` The profile can also include any other snakemake flag, such as re-run conditions and verbosity. @@ -67,7 +67,7 @@ EXAMPLES ARE CURRENTLY UNAVAILABLE It is possible to run each script as standalone using the `mock_snakemake` helper utility. The python file will run the __main__ script, reading the Snakefile. ### specific settings -You can edit the wildcards in mocksnakemake. You can also mock passing a configfile ontop of defaults by adding it to the snakefile (add configfile:"my_config" after the default configs) +You can edit the wildcards in mocksnakemake. You can also mock passing a configfile ontop of defaults by adding it to the snakefile (add configfile:"my_config" after the default configs) # Questions? -Please contact us if needed. Note that pypsa-China-PIK is currently under active development and we recommend waiting until the alpha or first stable release. \ No newline at end of file +Please contact us if needed. Note that PyPSA-China is currently under active development and we recommend waiting until the alpha or first stable release. diff --git a/mkdocs.yml b/mkdocs.yml index 8d68c7a0..1ab3a9cc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,8 +1,8 @@ -site_name: PyPSA China (PIK) #(PIK edition) Documentation -site_url: https://pik-piam.github.io/PyPSA-China-PIK/ -repo_url: https://github.com/pik-piam/PyPSA-China-PIK -repo_name: pik-piam/PyPSA-China-PIK +site_name: PyPSA China Documentation +site_url: https://pypsa.github.io/PyPSA-China/ +repo_url: https://github.com/pypsa/PyPSA-China +repo_name: pypsa/PyPSA-China theme: name: "material" @@ -24,15 +24,15 @@ theme: - scheme: slate toggle: icon: material/toggle-switch - name: Switch to light mode + name: Switch to light mode primary: black accent: amber - scheme: default toggle: - icon: material/toggle-switch-off-outline + icon: material/toggle-switch-off-outline name: Switch to dark mode # primary: deep purple - accent: blue + accent: blue docs_dir: "./docs" nav: @@ -46,8 +46,8 @@ extra: default: latest social: - icon: fontawesome/brands/github - link: https://github.com/pik-piam/PyPSA-China-PIK - name: PyPSA-China-PIK on GitHub + link: https://github.com/pypsa/PyPSA-China + name: PyPSA-China on GitHub # Due to snakemake workflow, we need to include the 'scripts' directory in the python path plugins: @@ -77,4 +77,4 @@ markdown_extensions: alternate_style: true - mdx_math -copyright: © Potsdam Institute for Climate Impact Research (PIK) 2024 \ No newline at end of file +copyright: © Potsdam Institute for Climate Impact Research (PIK) 2024 diff --git a/workflow/__init__.py b/workflow/__init__.py index a9b1d403..97425e14 100644 --- a/workflow/__init__.py +++ b/workflow/__init__.py @@ -1,4 +1,4 @@ """Track version""" -# pypsa-China PIK editions +# pypsa-China __version__ = "1.3.2" diff --git a/workflow/notebooks/compare.ipynb b/workflow/notebooks/compare.ipynb index 44d521f9..5a3a5406 100644 --- a/workflow/notebooks/compare.ipynb +++ b/workflow/notebooks/compare.ipynb @@ -27,17 +27,17 @@ " 2060,\n", "] # , 2070, 2080, 2090, 2100]\n", "result_paths = {}\n", - "# result_paths[\"REMIND downscaled\"] = \"/p/tmp/ivanra/PyPSA-China-clone/PyPSA-China-PIK/results/v-1.1.1_REMIND_EFC_2025-07-24-r2_frozenvoll/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG\"\n", + "# result_paths[\"REMIND downscaled\"] = \"example_path/results/v-1.1.1_REMIND_EFC_2025-07-24-r2_frozenvoll/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG\"\n", "result_paths[\"costs_original\"] = (\n", - " \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/results/v-1.3.0_1128_plot_network/overnight_co2pw-exp175default_topo-current+FCG\"\n", + " \"example_path/results/v-1.3.0_1128_plot_network/overnight_co2pw-exp175default_topo-current+FCG\"\n", ")\n", - "# result_paths[\"coupled (all free)\"] = \"/p/tmp/ivanra/PyPSA-China-clone/PyPSA-China-PIK/results/v-1.1.1_REMIND_EFC_2025-07-25-r3_scale09/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_09scaled_topo-current+FCG\"\n", - "result_paths[\"costs_updated\"] = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/results/v-1.3.0_1201_newcosts/overnight_co2pw-exp175default_topo-current+FCG\"\n", - "result_paths[\"costs_updated_nuclear2700\"] = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/results/v-1.3.0_1201_newcosts_nuclear2700/overnight_co2pw-exp175default_topo-current+FCG\"\n", - "result_paths[\"costs_updated_newcosts\"] = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/results/v-1.3.0_1202_pypsa_china_newcosts_solar3600/overnight_co2pw-exp175default_topo-current+FCG\"\n", + "# result_paths[\"coupled (all free)\"] = \"example_path/results/v-1.1.1_REMIND_EFC_2025-07-25-r3_scale09/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_09scaled_topo-current+FCG\"\n", + "result_paths[\"costs_updated\"] = \"example_path/results/v-1.3.0_1201_newcosts/overnight_co2pw-exp175default_topo-current+FCG\"\n", + "result_paths[\"costs_updated_nuclear2700\"] = \"example_path/results/v-1.3.0_1201_newcosts_nuclear2700/overnight_co2pw-exp175default_topo-current+FCG\"\n", + "result_paths[\"costs_updated_newcosts\"] = \"example_path/results/v-1.3.0_1202_pypsa_china_newcosts_solar3600/overnight_co2pw-exp175default_topo-current+FCG\"\n", "remind_paths = {\n", - " \"load\": \"/p/tmp/ivanra/PyPSA-China-PIK/resources/derived_data/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/remind/yrly_loads.csv\",\n", - " \"remind_export\": \"/p/tmp/ivanra/formatted_remind_outputs/pypsa_export_chris_CHA_v2/\",\n", + " \"load\": \"example_path/resources/derived_data/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/remind/yrly_loads.csv\",\n", + " \"remind_export\": \"example_path/formatted_remind_outputs/pypsa_export_chris_CHA_v2/\",\n", "}\n", "short_names = {\n", " \"Ember\": \"E\",\n", @@ -295,7 +295,7 @@ "\n", "\n", "def set_plot_style(\n", - " style_config_file: PathLike = \"/p/tmp/ivanra/PyPSA-China-PIK/config/plotting_styles/default_style.mplstyle\",\n", + " style_config_file: PathLike = \"example_path/config/plotting_styles/default_style.mplstyle\",\n", " base_styles=[\"classic\"],\n", "):\n", " \"\"\"Set the plot style to base_style(s)\n", @@ -328,7 +328,7 @@ "\n", "\n", "def map_remind_techs(\n", - " mapping_file: os.PathLike = \"/p/tmp/ivanra/PyPSA-China-PIK/config/templates/techmapping_remind_cc.csv\",\n", + " mapping_file: os.PathLike = \"example_path/config/templates/techmapping_remind_cc.csv\",\n", ") -> dict:\n", " \"\"\"Map REMIND technologies to PyPSA-TECHs.\"\"\"\n", " mapping = pd.read_csv(mapping_file)\n", @@ -351,7 +351,7 @@ "\n", "def read_remind_generation(\n", " remind_paths: dict,\n", - " mapping_file: os.PathLike = \"/p/tmp/ivanra/PyPSA-China-PIK/config/templates/techmapping_remind_cc.csv\",\n", + " mapping_file: os.PathLike = \"example_path/config/templates/techmapping_remind_cc.csv\",\n", ") -> pd.DataFrame:\n", " \"\"\"Read the REMIND generation data from the given path.\"\"\"\n", " remind_gen = pd.read_csv(\n", @@ -855,7 +855,7 @@ "outputs": [], "source": [ "set_plot_style(\n", - " style_config_file=\"/p/tmp/ivanra/PyPSA-China-PIK/config/plotting_styles/default_style.mplstyle\",\n", + " style_config_file=\"example_path/config/plotting_styles/default_style.mplstyle\",\n", " base_styles=[\"ggplot\"],\n", ")" ] @@ -1154,7 +1154,7 @@ "outputs": [], "source": [ "mapping = pd.read_csv(\n", - " \"/p/tmp/ivanra/PyPSA-China-PIK/config/templates/techmapping_remind_cc.csv\"\n", + " \"example_path/config/templates/techmapping_remind_cc.csv\"\n", ")\n", "mapping = mapping.query(\"mapper.str.contains('remind')\")\n", "mapping[\"reference\"] = mapping[\"reference\"].apply(to_list)\n", @@ -1181,7 +1181,7 @@ "TWa2MWH = 1e6 * 365 * 24\n", "\n", "remind_gen = pd.read_csv(\n", - " \"/p/tmp/ivanra/formatted_remind_outputs/pypsa_export_chris_CHA/p32_pe2seelTe.csv\",\n", + " \"example_path/formatted_remind_outputs/pypsa_export_chris_CHA/p32_pe2seelTe.csv\",\n", " names=[\"year\", \"region\", \"tech\", \"generation\"],\n", " header=1,\n", ")\n", @@ -1199,7 +1199,7 @@ "outputs": [], "source": [ "remind_load = pd.read_csv(\n", - " \"/p/tmp/ivanra/PyPSA-China-PIK/resources/derived_data/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/remind/yrly_loads.csv\"\n", + " \"example_path/resources/derived_data/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/remind/yrly_loads.csv\"\n", ")\n", "remind_load[\"value\"] *= -1 / 1e6 # Convert to TWh" ] @@ -1212,7 +1212,7 @@ "outputs": [], "source": [ "remind_gen2 = pd.read_csv(\n", - " \"/p/tmp/ivanra/formatted_remind_outputs/pypsa_export_chris_CHA/p32_seelgen.csv\",\n", + " \"example_path/formatted_remind_outputs/pypsa_export_chris_CHA/p32_seelgen.csv\",\n", " names=[\"year\", \"region\", \"tech\", \"generation\"],\n", " header=1,\n", ")\n", @@ -1237,7 +1237,7 @@ "outputs": [], "source": [ "se2se = pd.read_csv(\n", - " \"/p/tmp/ivanra/formatted_remind_outputs/pypsa_export_chris_CHA/p32_se2se.csv\",\n", + " \"example_path/formatted_remind_outputs/pypsa_export_chris_CHA/p32_se2se.csv\",\n", " names=[\"year\", \"region\", \"value\"],\n", " header=1,\n", ")\n", @@ -1367,10 +1367,10 @@ "source": [ "dfs_in = {}\n", "dfs_in[\"REMIND\\n(gas kept free)\"] = (\n", - " \"/p/tmp/ivanra/PyPSA-China-PIK/results/v-1.1.0_REMIND_EFC_2025-07-04_r22_ChrisRemind_freeze_c107/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/\"\n", + " \"example_path/results/v-1.1.0_REMIND_EFC_2025-07-04_r22_ChrisRemind_freeze_c107/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/\"\n", ")\n", "dfs_in[\"unconstrained\"] = (\n", - " \"/p/tmp/ivanra/PyPSA-China-PIK/results/v-1.1.0_REMIND_EFC_2025-07-01-r23_uncoupled_c105/overnight_co2pw-SSP2-PkBudg1000-pseudo-coupled_topo-current+FCG\"\n", + " \"example_path/results/v-1.1.0_REMIND_EFC_2025-07-01-r23_uncoupled_c105/overnight_co2pw-SSP2-PkBudg1000-pseudo-coupled_topo-current+FCG\"\n", ")\n", "prices = []\n", "shares = []\n", diff --git a/workflow/notebooks/dev-brownfield_grades_vre.ipynb b/workflow/notebooks/dev-brownfield_grades_vre.ipynb index 2a711905..eca2b76f 100644 --- a/workflow/notebooks/dev-brownfield_grades_vre.ipynb +++ b/workflow/notebooks/dev-brownfield_grades_vre.ipynb @@ -630,7 +630,7 @@ "outputs": [], "source": [ "import xarray as xr\n", - "p = \"/home/ivanra/documents/PyPSA-China-PIK/resources/derived_data/cutout_China-2020c/profile_onwind-min_cf_delta0.05_n3.nc\"\n", + "p = \"example_path/resources/derived_data/cutout_China-2020c/profile_onwind-min_cf_delta0.05_n3.nc\"\n", "with xr.open_dataset(p) as ds:\n", " if ds.indexes[\"bus\"].empty:\n", " pass\n", diff --git a/workflow/notebooks/dev-fetch-shape.ipynb b/workflow/notebooks/dev-fetch-shape.ipynb index 87be5167..7ced1f0e 100644 --- a/workflow/notebooks/dev-fetch-shape.ipynb +++ b/workflow/notebooks/dev-fetch-shape.ipynb @@ -52,10 +52,10 @@ "outputs": [], "source": [ "gdf = gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_offshore_province.geojson\"\n", + " \"example_path/resources/data/regions/regions_offshore_province.geojson\"\n", ")\n", "with open(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/test.geojson\", \"w\"\n", + " \"example_path/resources/data/regions/test.geojson\", \"w\"\n", ") as f:\n", " f.write(gdf.to_json(drop_id=True))\n", "gdf.crs" @@ -68,7 +68,7 @@ "outputs": [], "source": [ "gdf2 = gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/test.geojson\"\n", + " \"example_path/resources/data/regions/test.geojson\"\n", ")\n", "gdf2.crs" ] @@ -172,10 +172,10 @@ "china_shape = fetch_natural_earth_shape(\"admin_0_countries\", \"ADMIN\", \"China\")\n", "china_shape.plot(ax=ax)\n", "gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_offshore_province.geojson\"\n", + " \"example_path/resources/data/regions/regions_offshore_province.geojson\"\n", ").plot(ax=ax, color=\"red\", alpha=0.5)\n", "gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_offshore.geojson\"\n", + " \"example_path/resources/data/regions/regions_offshore.geojson\"\n", ").plot(ax=ax, color=\"green\", alpha=0.5)" ] }, @@ -186,7 +186,7 @@ "outputs": [], "source": [ "marim = gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_offshore_province.geojson\"\n", + " \"example_path/resources/data/regions/regions_offshore_province.geojson\"\n", ")\n", "marim.plot(lw=3)" ] @@ -361,7 +361,7 @@ "outputs": [], "source": [ "gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/derived_data/regions/provinves_offshore.geojson\"\n", + " \"example_path/resources/derived_data/regions/provinves_offshore.geojson\"\n", ")" ] }, @@ -416,7 +416,7 @@ "wkt_s = \"POLYGON\" + geom.split(\"POLYGON\")[-1].split('\"')[0]\n", "fig, ax = plt.subplots()\n", "gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_offshore.geojson\"\n", + " \"example_path/resources/data/regions/regions_offshore.geojson\"\n", ").plot(ax=ax, color=\"black\")\n", "eez = gpd.GeoDataFrame([{\"geometry\": wkt_loads(wkt_s)}])\n", "eez.plot(ax=ax, color=\"red\")\n", diff --git a/workflow/notebooks/devgem.ipynbd-1.ipynb b/workflow/notebooks/devgem.ipynbd-1.ipynb index edb614c3..68c47398 100644 --- a/workflow/notebooks/devgem.ipynbd-1.ipynb +++ b/workflow/notebooks/devgem.ipynbd-1.ipynb @@ -32,7 +32,7 @@ "metadata": {}, "outputs": [], "source": [ - "base_dir = pathlib.Path(\"/home/ivanra/documents/tmp-pypsa-china/PyPSA-China-PIK/resources/data/existing_infrastructure\")\n", + "base_dir = pathlib.Path(\"example_path/resources/data/existing_infrastructure\")\n", "gem_files = list(base_dir.rglob(\"Global*Tracker*.xlsx\"))\n", "gem_files" ] @@ -79,10 +79,10 @@ "metadata": {}, "outputs": [], "source": [ - "nodes = gpd.read_file(\"/home/ivanra/documents/tmp-pypsa-china/PyPSA-China-PIK/resources/derived_data/regions/provinces_onshore.geojson\")\n", - "# nodes_offshore = gpd.read_file(\"/home/ivanra/documents/tmp-pypsa-china/PyPSA-China-PIK/resources/derived_data/regions/provinces_offshore.geojson\")\n", + "nodes = gpd.read_file(\"example_path/resources/derived_data/regions/provinces_onshore.geojson\")\n", + "# nodes_offshore = gpd.read_file(\"example_path/resources/derived_data/regions/provinces_offshore.geojson\")\n", "# nodes.dropna(how=\"all\", axis=1, inplace=True)\n", - "t = \"/home/ivanra/documents/tmp-pypsa-china/PyPSA-China-PIK/resources/data/existing_infrastructure/Global-Coal-Plant-Tracker-July-2023.xlsx\"\n" + "t = \"example_path/resources/data/existing_infrastructure/Global-Coal-Plant-Tracker-July-2023.xlsx\"\n" ] }, { @@ -317,7 +317,7 @@ "metadata": {}, "outputs": [], "source": [ - "gem_data_all = load_gem_excel(\"/home/ivanra/documents/tmp-pypsa-china/PyPSA-China-PIK/resources/data/existing_infrastructure/gem_data_raw/Global-integrated-Plant-Tracker-July-2025_china.xlsx\", sheetname=\"Power facilities\")\n", + "gem_data_all = load_gem_excel(\"example_path/resources/data/existing_infrastructure/gem_data_raw/Global-integrated-Plant-Tracker-July-2025_china.xlsx\", sheetname=\"Power facilities\")\n", "datasets = {}\n", "for tech in gem_data_all.Type.unique(): \n", " datasets[tech] = gem_data_all[gem_data_all.Type == tech]\n" diff --git a/workflow/notebooks/fix_downloads.ipynb b/workflow/notebooks/fix_downloads.ipynb index b04a3a03..318bef6c 100644 --- a/workflow/notebooks/fix_downloads.ipynb +++ b/workflow/notebooks/fix_downloads.ipynb @@ -19,7 +19,7 @@ "import pathlib\n", "\n", "base = pathlib.Path(\n", - " \"/home/ivanra/Documents/PyPSA-China-main/resources/data/landuse_availability\"\n", + " \"example_path/resources/data/landuse_availability\"\n", ")\n", "PATTERN_TO_FIX = \"968e17d9250655b79f2e8f156beb48e55515a5ba7a21745a098ff46400b8bb8\"\n", "FIX = \"CN\"\n", diff --git a/workflow/notebooks/land_availability.ipynb b/workflow/notebooks/land_availability.ipynb index a2ae1208..aacc5095 100644 --- a/workflow/notebooks/land_availability.ipynb +++ b/workflow/notebooks/land_availability.ipynb @@ -10,7 +10,7 @@ "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "\n", - "file = \"/p/tmp/yanleizh/newpypsa_0913/PyPSA-China-PIK/resources/derived_data/cutout_China-2020c_bare/availability_matrix_onwind.nc\"\n", + "file = \"example_path/resources/derived_data/cutout_China-2020c_bare/availability_matrix_onwind.nc\"\n", "\n", "ds = xr.open_dataset(file)\n", "da = ds[\"__xarray_dataarray_variable__\"]\n", @@ -34,7 +34,7 @@ "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "\n", - "file = \"/p/tmp/yanleizh/newpypsa_0913/PyPSA-China-PIK/resources/derived_data/cutout_China-2020c/availability_matrix_onwind_old.nc\"\n", + "file = \"example_path/resources/derived_data/cutout_China-2020c/availability_matrix_onwind_old.nc\"\n", "\n", "ds = xr.open_dataset(file)\n", "da = ds[\"__xarray_dataarray_variable__\"]\n", diff --git a/workflow/notebooks/land_cover_request_dev.ipynb b/workflow/notebooks/land_cover_request_dev.ipynb index 6d774f7d..4e4b1f54 100644 --- a/workflow/notebooks/land_cover_request_dev.ipynb +++ b/workflow/notebooks/land_cover_request_dev.ipynb @@ -16,7 +16,7 @@ "import geopandas as gpd\n", "\n", "china = gpd.read_file(\n", - " \"/home/ivanra/documents/PyPSA-China-PIK/resources/data/regions/regions_onshore.geojson\"\n", + " \"example_path/resources/data/regions/regions_onshore.geojson\"\n", ")\n", "bbox_china = china.total_bounds[[2, 3, 0, 1]].tolist()" ] diff --git a/workflow/notebooks/marketvalue.ipynb b/workflow/notebooks/marketvalue.ipynb index 4b3a0558..0e27040f 100644 --- a/workflow/notebooks/marketvalue.ipynb +++ b/workflow/notebooks/marketvalue.ipynb @@ -34,8 +34,8 @@ "\n", "logger = logging.getLogger(__name__)\n", "\n", - "# ntw_path = f\"/home/ivanra/downloads/PaperResultsXiaowei_networks/postnetwork-ll-current+Neighbor-exponential175-{PLANNING_YEAR}.nc\"\n", - "ntw_path = \"/p/tmp/yanleizh/PyPSA-China-PIK/results/v-1.1.0_noevcoupling_test0806/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/postnetworks/ntwk_2060.nc\"\n", + "# ntw_path = f\"example_path/PaperResultsXiaowei_networks/postnetwork-ll-current+Neighbor-exponential175-{PLANNING_YEAR}.nc\"\n", + "ntw_path = \"example_path/results/v-1.1.0_noevcoupling_test0806/overnight_co2pw-SSP2-PkBudg1000-CHA-pypsaelh2_topo-current+FCG/postnetworks/ntwk_2060.nc\"\n", "n = pypsa.Network(ntw_path)\n", "results_dir = os.path.dirname(os.path.dirname(ntw_path))\n", "results_dir" @@ -350,7 +350,7 @@ "# import warnings\n", "# warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", "\n", - "# n = pypsa.Network(\"/p/tmp/yanleizh/PyPSA-China-PIK/results/v-0.2.0_test_co2_pr_baseline_0416_SD_withCB_dual/overnight_co2pw-exp175default_topo-current+FCG_proj-positive/prenetworks/ntwk_2060.nc\")\n", + "# n = pypsa.Network(\"example_path/results/v-0.2.0_test_co2_pr_baseline_0416_SD_withCB_dual/overnight_co2pw-exp175default_topo-current+FCG_proj-positive/prenetworks/ntwk_2060.nc\")\n", "# n.optimize(assign_all_duals=True)\n", "\n", "# duals = n.model.dual\n", diff --git a/workflow/notebooks/overwrite_cost.ipynb b/workflow/notebooks/overwrite_cost.ipynb index bd0a1f73..f7fc5ec6 100644 --- a/workflow/notebooks/overwrite_cost.ipynb +++ b/workflow/notebooks/overwrite_cost.ipynb @@ -11,7 +11,7 @@ "\n", "import pandas as pd\n", "\n", - "folder = Path(\"/p/tmp/ivanra/PyPSA-China-PIK/resources/data/costs/default/\")\n", + "folder = Path(\"example_path/resources/data/costs/default/\")\n", "\n", "for csv_file in folder.rglob(\"costs_*.csv\"):\n", " # Extract the year from the filename, e.g., costs_2045.csv -> 2045\n", @@ -43,7 +43,7 @@ "\n", "import pandas as pd\n", "\n", - "folder = Path(\"/p/tmp/ivanra/PyPSA-China-PIK/resources/data/costs/default/\")\n", + "folder = Path(\"example_path/resources/data/costs/default/\")\n", "\n", "for csv_file in folder.rglob(\"costs_*.csv\"):\n", " # Extract the year from the filename, e.g., costs_2045.csv -> 2045\n", diff --git a/workflow/notebooks/plot_network_summary.ipynb b/workflow/notebooks/plot_network_summary.ipynb index fb2edf0a..d66c9e06 100644 --- a/workflow/notebooks/plot_network_summary.ipynb +++ b/workflow/notebooks/plot_network_summary.ipynb @@ -2313,7 +2313,7 @@ "outputs": [], "source": [ "npresolve = pypsa.Network(\n", - " \"/p/tmp/ivanra/PyPSA-China-PIK/results/v-1.1.0_REMIND_EFC_2025-07-21_r27_more_windbins_freeze/overnight_co2pw-SSP2-PkBudg1000-CHA-higher_minwind_cf_topo-current+FCG/prenetworks-brownfield/ntwk_2055.nc\"\n", + " \"example_path/results/v-1.1.0_REMIND_EFC_2025-07-21_r27_more_windbins_freeze/overnight_co2pw-SSP2-PkBudg1000-CHA-higher_minwind_cf_topo-current+FCG/prenetworks-brownfield/ntwk_2055.nc\"\n", ")" ] }, diff --git a/workflow/notebooks/update_cost_data.ipynb b/workflow/notebooks/update_cost_data.ipynb index a162dadf..bb981700 100644 --- a/workflow/notebooks/update_cost_data.ipynb +++ b/workflow/notebooks/update_cost_data.ipynb @@ -37,8 +37,8 @@ "import glob\n", "import os\n", "\n", - "old_dir = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/default\"\n", - "new_dir = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/costs_pypsa_eur/\"\n", + "old_dir = \"example_path/resources/data/costs/default\"\n", + "new_dir = \"example_path/resources/data/costs/costs_pypsa_eur/\"\n", "\n", "target_file = \"costs_2020.csv\" #\n", "\n", @@ -169,8 +169,8 @@ "ALL_YEARS = [2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060]\n", "\n", "TARGET_TECH = \"solar\"\n", - "DEFAULT_DIR = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/default/\"\n", - "lit_path = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\"\n", + "DEFAULT_DIR = \"example_path/resources/data/costs/default/\"\n", + "lit_path = \"example_path/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\"\n", "\n", "lit_df = pd.read_csv(lit_path)\n", "lit_subset = lit_df[\n", @@ -266,8 +266,8 @@ "\n", "TARGET_TECH = \"coal\"\n", "COST_TYPE = \"investment\"\n", - "DEFAULT_DIR = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/default/\"\n", - "lit_path = \"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\"\n", + "DEFAULT_DIR = \"example_path/resources/data/costs/default/\"\n", + "lit_path = \"example_path/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\"\n", "\n", "lit_df = pd.read_csv(lit_path)\n", "\n", @@ -403,7 +403,7 @@ "ALL_YEARS = np.array([2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060])\n", "plot_techs = [\"solar\", \"solar-utility\", \"onwind\", \"offwind\", \"nuclear\", \"coal\"]\n", "\n", - "lit_df = pd.read_csv(\"/p/tmp/yanleizh/pypsa-china-mineral/PyPSA-China-PIK/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\")\n", + "lit_df = pd.read_csv(\"example_path/resources/data/costs/reference_costs/tech_costs_subset_litreview.csv\")\n", "\n", "# ======================\n", "# ======================\n", diff --git a/workflow/scripts/add_existing_baseyear.py b/workflow/scripts/add_existing_baseyear.py index 590347f8..8e370545 100644 --- a/workflow/scripts/add_existing_baseyear.py +++ b/workflow/scripts/add_existing_baseyear.py @@ -2,11 +2,10 @@ Functions to add brownfield capacities to the network for a reference year - adds VREs per grade and corrects technical potential. Best available grade is chosen """ -# SPDX-FileCopyrightText: : 2025 The PyPSA-China-PIK Authors +# SPDX-FileCopyrightText: : 2025 The PyPSA-China Authors # # SPDX-License-Identifier: MIT - import logging import re from types import SimpleNamespace diff --git a/workflow/scripts/build_renewable_profiles.py b/workflow/scripts/build_renewable_profiles.py index 6020bc66..91512096 100644 --- a/workflow/scripts/build_renewable_profiles.py +++ b/workflow/scripts/build_renewable_profiles.py @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: MIT """ -Adapted from pypsa-EUR by the pypsa China-PIK authors +Adapted from pypsa-EUR by the PyPSA-China authors Calculates for each clustered region the (i) installable capacity (based on land-use from :mod:`determine_availability_matrix`) diff --git a/workflow/scripts/build_transport_demand.py b/workflow/scripts/build_transport_demand.py index 147a9285..8597747e 100644 --- a/workflow/scripts/build_transport_demand.py +++ b/workflow/scripts/build_transport_demand.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Contributors to PyPSA-China-PIK +# SPDX-FileCopyrightText: Contributors to PyPSA-China # # SPDX-License-Identifier: MIT """ @@ -98,9 +98,9 @@ def build_transport_demand( traffic_passenger = pd.read_csv( snakemake.input.charging_data_passenger, usecols=["count"] ).squeeze("columns") - traffic_freight = pd.read_csv( - snakemake.input.charging_data_freight, usecols=["count"] - ).squeeze("columns") + traffic_freight = pd.read_csv(snakemake.input.charging_data_freight, usecols=["count"]).squeeze( + "columns" + ) charging_demand_passenger = build_transport_demand( traffic_passenger, nodes, ev_passenger_load, snapshots diff --git a/workflow/scripts/determine_availability_matrix.py b/workflow/scripts/determine_availability_matrix.py index 87c93d10..44c97139 100644 --- a/workflow/scripts/determine_availability_matrix.py +++ b/workflow/scripts/determine_availability_matrix.py @@ -10,7 +10,7 @@ Natural reserves are from https://zenodo.org/records/14875797 The copernicus land monitoring data is/can be fetched by the pipeline. -The GEBCO data is stored in the PyPSA-China-PIK zenodo bundle or must +The GEBCO data is stored in the PyPSA-China zenodo bundle or must be manually downloaded from the `General Bathymetric Chart of the Oceans (GEBCO) `_. diff --git a/workflow/scripts/readers.py b/workflow/scripts/readers.py index b206bc83..6a86ad6c 100644 --- a/workflow/scripts/readers.py +++ b/workflow/scripts/readers.py @@ -1,4 +1,4 @@ -"""File reading support functions for PyPSA-China-PIK workflow. +"""File reading support functions for PyPSA-China workflow. This module provides functions for reading and processing yearly load projections from REMIND data, with support for sector coupling (electric vehicles) and