From b7aa122fdaeeee6c969d1f5429fdca12892caf07 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 12 Jun 2023 20:40:51 +0200 Subject: [PATCH 1/8] Fixed issue (most likely) introduced when merging PyPSA-Eur with PyPSA-Eur-Sec --- scripts/solve_network.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index e671ffd3..4a40d06a 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -274,13 +274,13 @@ def add_EQ_constraints(n, o, scaling=1e-1): float_regex = "[0-9]*\.?[0-9]+" level = float(re.findall(float_regex, o)[0]) if o[-1] == "c": - ggrouper = n.generators.bus.map(n.buses.country).to_xarray() - lgrouper = n.loads.bus.map(n.buses.country).to_xarray() - sgrouper = n.storage_units.bus.map(n.buses.country).to_xarray() + ggrouper = n.generators.bus.map(n.buses.country) + lgrouper = n.loads.bus.map(n.buses.country) + sgrouper = n.storage_units.bus.map(n.buses.country) else: - ggrouper = n.generators.bus.to_xarray() - lgrouper = n.loads.bus.to_xarray() - sgrouper = n.storage_units.bus.to_xarray() + ggrouper = n.generators.bus + lgrouper = n.loads.bus + sgrouper = n.storage_units.bus load = ( n.snapshot_weightings.generators @ n.loads_t.p_set.groupby(lgrouper, axis=1).sum() @@ -294,7 +294,7 @@ def add_EQ_constraints(n, o, scaling=1e-1): p = n.model["Generator-p"] lhs_gen = ( (p * (n.snapshot_weightings.generators * scaling)) - .groupby(ggrouper) + .groupby(ggrouper.to_xarray()) .sum() .sum("snapshot") ) @@ -303,7 +303,7 @@ def add_EQ_constraints(n, o, scaling=1e-1): spillage = n.model["StorageUnit-spill"] lhs_spill = ( (spillage * (-n.snapshot_weightings.stores * scaling)) - .groupby(sgrouper) + .groupby(sgrouper.to_xarray()) .sum() .sum("snapshot") ) From 691cc7167fc758203e4e1bf9897b730311c0c0c2 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 10:24:08 +0200 Subject: [PATCH 2/8] CI: use setup-micromamba action --- .github/workflows/ci.yaml | 55 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0cdfca1..86dfdacf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,6 @@ on: - cron: "0 5 * * TUE" env: - CONDA_CACHE_NUMBER: 1 # Change this value to manually reset the environment cache DATA_CACHE_NUMBER: 2 jobs: @@ -27,22 +26,12 @@ jobs: strategy: fail-fast: false + max-parallel: 3 matrix: - include: - # Matrix required to handle caching with Mambaforge - - os: ubuntu-latest - label: ubuntu-latest - prefix: /usr/share/miniconda3/envs/pypsa-eur - - - os: macos-latest - label: macos-latest - prefix: /Users/runner/miniconda3/envs/pypsa-eur - - - os: windows-latest - label: windows-latest - prefix: C:\Miniconda3\envs\pypsa-eur - - name: ${{ matrix.label }} + os: + - ubuntu-latest + - macos-latest + - windows-latest runs-on: ${{ matrix.os }} @@ -60,24 +49,29 @@ jobs: - name: Add solver to environment run: | echo -e "- glpk\n- ipopt<3.13.3" >> envs/environment.yaml - if: ${{ matrix.label }} == 'windows-latest' + if: ${{ matrix.os }} == 'windows-latest' - name: Add solver to environment run: | echo -e "- glpk\n- ipopt" >> envs/environment.yaml - if: ${{ matrix.label }} != 'windows-latest' + if: ${{ matrix.os }} != 'windows-latest' - - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 + - name: Setup micromamba + uses: mamba-org/setup-micromamba@v1 with: - miniforge-variant: Mambaforge - miniforge-version: latest - activate-environment: pypsa-eur - use-mamba: true + micromamba-version: latest + environment-file: envs/environment.yaml + log-level: debug + init-shell: bash + cache-environment: false + cache-downloads: true + + - name: Print installed dependencies + run: | + micromamba list - name: Set cache dates run: | - echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV - name: Cache data and cutouts folders @@ -88,17 +82,6 @@ jobs: cutouts key: data-cutouts-${{ env.WEEK }}-${{ env.DATA_CACHE_NUMBER }} - - name: Create environment cache - uses: actions/cache@v3 - id: cache - with: - path: ${{ matrix.prefix }} - key: ${{ matrix.label }}-conda-${{ env.DATE }}-${{ env.CONDA_CACHE_NUMBER }} - - - name: Update environment due to outdated or unavailable cache - run: mamba env update -n pypsa-eur -f envs/environment.yaml - if: steps.cache.outputs.cache-hit != 'true' - - name: Test snakemake workflow run: | conda activate pypsa-eur From 854b3b773c5e56804214e3ce7e470459ebf46e55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Jul 2023 08:25:02 +0000 Subject: [PATCH 3/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86dfdacf..701002f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: fail-fast: false max-parallel: 3 matrix: - os: + os: - ubuntu-latest - macos-latest - windows-latest From e0942d4544d411304f50cc9dc14c910e0c01ac77 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 10:58:38 +0200 Subject: [PATCH 4/8] CI: enable environment cache --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86dfdacf..2a14d4f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -63,13 +63,9 @@ jobs: environment-file: envs/environment.yaml log-level: debug init-shell: bash - cache-environment: false + cache-environment: true cache-downloads: true - - name: Print installed dependencies - run: | - micromamba list - - name: Set cache dates run: | echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV From 9cc5be1c2574f047c0365c7599144022371d56c2 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 11:02:48 +0200 Subject: [PATCH 5/8] add note about supported operating systemds (closes #697) [no ci] --- doc/index.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/index.rst b/doc/index.rst index 314900f7..d702a42c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -224,7 +224,10 @@ The included ``.nc`` files are PyPSA network files which can be imported with Py n = pypsa.Network(filename) +Operating Systems +================= +The PyPSA-Eur workflow is continuously tested for Linux, macOS and Windows (WSL only). .. toctree:: From 81fcaf774022632e834fe008c3e25d7fd1c3f036 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 15:03:13 +0200 Subject: [PATCH 6/8] follow-up: remove unnecessary conda calls --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d8e2ff3e..c2be3909 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -80,8 +80,6 @@ jobs: - name: Test snakemake workflow run: | - conda activate pypsa-eur - conda list snakemake -call solve_elec_networks --configfile config/test/config.electricity.yaml --rerun-triggers=mtime snakemake -call all --configfile config/test/config.overnight.yaml --rerun-triggers=mtime snakemake -call all --configfile config/test/config.myopic.yaml --rerun-triggers=mtime From 2baeecbc4e2c482ce47c141db493254059117c6a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:31:09 +0000 Subject: [PATCH 7/8] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/fsfe/reuse-tool: v2.0.0 → v2.1.0](https://github.com/fsfe/reuse-tool/compare/v2.0.0...v2.1.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fb0dbf0..006673b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -87,6 +87,6 @@ repos: # Check for FSFE REUSE compliance (licensing) - repo: https://github.com/fsfe/reuse-tool - rev: v2.0.0 + rev: v2.1.0 hooks: - id: reuse From d96a747566119e4c47a2f74d3d3aeba8178a856a Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 25 Jul 2023 11:54:02 +0200 Subject: [PATCH 8/8] update to technology-data v0.6.0 --- config/config.default.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index bf5156b9..7b4500ae 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -528,7 +528,7 @@ industry: # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs costs: year: 2030 - version: v0.5.0 + version: v0.6.0 rooftop_share: 0.14 # based on the potentials, assuming (0.1 kW/m2 and 10 m2/person) fill_values: FOM: 0