From 2fa4c2524063199c259521fee152ee0f94376d86 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 20:05:58 +0000 Subject: [PATCH 01/44] [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: v0.14.0 → v1.0.0](https://github.com/fsfe/reuse-tool/compare/v0.14.0...v1.0.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 f4f2d637..21a55d3d 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: v0.14.0 + rev: v1.0.0 hooks: - id: reuse From d29441d8714aef1bf5c4b50f83e8d4426fbe156d Mon Sep 17 00:00:00 2001 From: nnhjy Date: Wed, 28 Sep 2022 20:33:50 +0200 Subject: [PATCH 02/44] update deprecated syntax --- scripts/plot_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/plot_summary.py b/scripts/plot_summary.py index c48571ba..c05db561 100644 --- a/scripts/plot_summary.py +++ b/scripts/plot_summary.py @@ -92,7 +92,7 @@ def plot_costs(infn, config, fn=None): print(df.sum()) - new_index = (preferred_order & df.index).append( + new_index = (preferred_order.intersection(df.index)).append( df.index.difference(preferred_order) ) @@ -149,7 +149,7 @@ def plot_energy(infn, config, fn=None): print(df.sum()) - new_index = (preferred_order & df.index).append( + new_index = (preferred_order.intersection(df.index)).append( df.index.difference(preferred_order) ) From 721c8f9235d1b90ddb8a5f2df62f065288ee0a42 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Oct 2022 20:31:00 +0000 Subject: [PATCH 03/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.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 21a55d3d..9bd98e4f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: # Formatting with "black" coding style - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 22.10.0 hooks: # Format Python files - id: black From 26fa33b414140781ffaa2abbb20457a0114f99b8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 20:01:25 +0000 Subject: [PATCH 04/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.2.1 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.2.1...v2.2.2) --- .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 9bd98e4f..1d4fbf8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: # Find common spelling mistakes in comments and docstrings - repo: https://github.com/codespell-project/codespell - rev: v2.2.1 + rev: v2.2.2 hooks: - id: codespell args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom'] # Ignore capital case words, e.g. country codes From 73b0645c138dadf9fc1e349095dc1870e3f0f970 Mon Sep 17 00:00:00 2001 From: Adrian Odenweller Date: Tue, 25 Oct 2022 14:29:07 +0200 Subject: [PATCH 05/44] Fix network directory path in make_summary --- scripts/make_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 873a2a8b..3d28ee25 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -556,9 +556,9 @@ if __name__ == "__main__": opts="Co2L-24H", country="all", ) - network_dir = os.path.join("..", "results", "networks") + network_dir = os.path.join("..", "results", "networks", snakemake.config["run"]["name"]) else: - network_dir = os.path.join("results", "networks") + network_dir = os.path.join("results", "networks", snakemake.config["run"]["name"]) configure_logging(snakemake) config = snakemake.config From dcd16e32a88385fb1fe8366da4de9807ce33baf3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:23:17 +0000 Subject: [PATCH 06/44] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/make_summary.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 3d28ee25..0d12a04c 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -556,9 +556,13 @@ if __name__ == "__main__": opts="Co2L-24H", country="all", ) - network_dir = os.path.join("..", "results", "networks", snakemake.config["run"]["name"]) + network_dir = os.path.join( + "..", "results", "networks", snakemake.config["run"]["name"] + ) else: - network_dir = os.path.join("results", "networks", snakemake.config["run"]["name"]) + network_dir = os.path.join( + "results", "networks", snakemake.config["run"]["name"] + ) configure_logging(snakemake) config = snakemake.config From 0b2989c9876723bcd3e4f581da497fa7a61a7731 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 31 Oct 2022 11:47:21 +0100 Subject: [PATCH 07/44] build_natura_raster: fix out_shapes --- scripts/build_natura_raster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_natura_raster.py b/scripts/build_natura_raster.py index 0b5ce34f..33e4cf99 100644 --- a/scripts/build_natura_raster.py +++ b/scripts/build_natura_raster.py @@ -84,7 +84,7 @@ if __name__ == "__main__": # adjusted boundaries shapes = gpd.read_file(snakemake.input.natura).to_crs(3035) - raster = ~geometry_mask(shapes.geometry, out_shape[::-1], transform) + raster = ~geometry_mask(shapes.geometry, out_shape, transform) raster = raster.astype(rio.uint8) with rio.open( From d04e19f9a8201bfb6b6a46239849191b3c571b68 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Tue, 1 Nov 2022 10:39:14 +0000 Subject: [PATCH 08/44] fix tutorial config links --- doc/tutorial.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 75bd350b..297c2c10 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -61,14 +61,16 @@ It is also possible to allow less or more carbon-dioxide emissions. Here, we lim .. literalinclude:: ../config.tutorial.yaml :language: yaml - :lines: 35,37 + :start-at: electricity: + :end-before: exentable_carriers: PyPSA-Eur also includes a database of existing conventional powerplants. We can select which types of powerplants we like to be included: .. literalinclude:: ../config.tutorial.yaml :language: yaml - :lines: 35,51 + :start-at: extendable_carriers: + :end-before: max_hours: To accurately model the temporal and spatial availability of renewables such as wind and solar energy, we rely on historical weather data. It is advisable to adapt the required range of coordinates to the selection of countries. @@ -83,14 +85,21 @@ For example, we may want to use the ERA-5 dataset for solar and not the default .. literalinclude:: ../config.tutorial.yaml :language: yaml - :lines: 63,106,107 + :start-at: be-03-2013-era5: + :end-at: module: + +.. literalinclude:: ../config.tutorial.yaml + :language: yaml + :start-at: solar: + :end-at: cutout: Finally, it is possible to pick a solver. For instance, this tutorial uses the open-source solvers CBC and Ipopt and does not rely on the commercial solvers Gurobi or CPLEX (for which free academic licenses are available). .. literalinclude:: ../config.tutorial.yaml :language: yaml - :lines: 188,198,199 + :start-at: solver: + :end-before: plotting: .. note:: From d6fd5132a0ac31a12797dfc5460508608acd0c3a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 19:37:17 +0000 Subject: [PATCH 09/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/keewis/blackdoc: v0.3.7 → v0.3.8](https://github.com/keewis/blackdoc/compare/v0.3.7...v0.3.8) --- .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 1d4fbf8c..49795f5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,7 +45,7 @@ repos: args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] - repo: https://github.com/keewis/blackdoc - rev: v0.3.7 + rev: v0.3.8 hooks: - id: blackdoc From 9eab3caf9301cb9824e49f7a611452edbf1791d9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Nov 2022 20:20:13 +0000 Subject: [PATCH 10/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/snakemake/snakefmt: v0.6.1 → v0.7.0](https://github.com/snakemake/snakefmt/compare/v0.6.1...v0.7.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 49795f5b..6a7ae623 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,7 @@ repos: # Format Snakemake rule / workflow files - repo: https://github.com/snakemake/snakefmt - rev: v0.6.1 + rev: v0.7.0 hooks: - id: snakefmt From 727688749c09092ba9703a425713c823d710c1bb Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 15 Nov 2022 07:45:13 +0100 Subject: [PATCH 11/44] build_bus_regions: fix shapely deprecation --- scripts/build_bus_regions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py index a26aaeb7..6e6fdd32 100644 --- a/scripts/build_bus_regions.py +++ b/scripts/build_bus_regions.py @@ -107,7 +107,7 @@ def voronoi_partition_pts(points, outline): polygons.append(poly) - return np.array(polygons, dtype=object) + return polygons if __name__ == "__main__": From 643a62049b2a2667c4e38b13a89ccd0a687a9e1b Mon Sep 17 00:00:00 2001 From: martacki Date: Fri, 25 Nov 2022 11:08:35 +0100 Subject: [PATCH 12/44] solve_network: move extra_functionality to args --- scripts/solve_network.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 4127b273..6c50c99b 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -392,7 +392,6 @@ def solve_network(n, config, opts="", **kwargs): n, solver_name=solver_name, solver_options=solver_options, - extra_functionality=extra_functionality, **kwargs ) else: @@ -403,7 +402,6 @@ def solve_network(n, config, opts="", **kwargs): track_iterations=track_iterations, min_iterations=min_iterations, max_iterations=max_iterations, - extra_functionality=extra_functionality, **kwargs ) return n @@ -432,6 +430,7 @@ if __name__ == "__main__": n, snakemake.config, opts, + extra_functionality=extra_functionality, solver_dir=tmpdir, solver_logfile=snakemake.log.solver, ) From 94e5f160b0f46764c4c95eed6a7de90ef3d65717 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Nov 2022 10:16:21 +0000 Subject: [PATCH 13/44] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 6c50c99b..d1331b0d 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -389,10 +389,7 @@ def solve_network(n, config, opts="", **kwargs): if skip_iterations: network_lopf( - n, - solver_name=solver_name, - solver_options=solver_options, - **kwargs + n, solver_name=solver_name, solver_options=solver_options, **kwargs ) else: ilopf( From 5220d805647056c2645bd242e96741e4177d1919 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Nov 2022 21:18:51 +0000 Subject: [PATCH 14/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.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 6a7ae623..7333be98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: "^LICENSES" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-merge-conflict - id: end-of-file-fixer From 253f6f6bccd448628fe071df80d9a584c7b766d8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 20:21:06 +0000 Subject: [PATCH 15/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/macisamuele/language-formatters-pre-commit-hooks: v2.4.0 → v2.5.0](https://github.com/macisamuele/language-formatters-pre-commit-hooks/compare/v2.4.0...v2.5.0) - [github.com/fsfe/reuse-tool: v1.0.0 → v1.1.0](https://github.com/fsfe/reuse-tool/compare/v1.0.0...v1.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7333be98..62933f30 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,7 @@ repos: # Do YAML formatting (before the linter checks it for misses) - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.4.0 + rev: v2.5.0 hooks: - id: pretty-format-yaml args: [--autofix, --indent, "2", --preserve-quotes] @@ -87,6 +87,6 @@ repos: # Check for FSFE REUSE compliance (licensing) - repo: https://github.com/fsfe/reuse-tool - rev: v1.0.0 + rev: v1.1.0 hooks: - id: reuse From 01cc146733058bff81032474109c302a76aaab4e Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 6 Dec 2022 14:38:40 +0100 Subject: [PATCH 16/44] lift minimum pypsa version, pyomo 6.4.3 compatibility --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 16d6f374..8cbb0336 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -10,7 +10,7 @@ dependencies: - python>=3.8 - pip -- pypsa>=0.20 +- pypsa>=0.21.2 - atlite>=0.2.9 - dask From aba84201b71714a3e783d4b372aa093865b665de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 20:56:00 +0000 Subject: [PATCH 17/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/isort: 5.10.1 → 5.11.0](https://github.com/PyCQA/isort/compare/5.10.1...5.11.0) - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62933f30..1038991c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: # Sort package imports alphabetically - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.0 hooks: - id: isort args: ["--profile", "black", "--filter-files"] @@ -51,7 +51,7 @@ repos: # Formatting with "black" coding style - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: # Format Python files - id: black From b7899787cf2c565d91856076d270a58d4d54ac11 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 16 Dec 2022 10:50:20 +0000 Subject: [PATCH 18/44] Fix load variable in reserve constraint --- scripts/solve_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index d1331b0d..bcb786f0 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -278,7 +278,7 @@ def add_operational_reserve_margin_constraint(n, config): ).sum(1) # Total demand at t - demand = n.loads_t.p.sum(1) + demand = n.loads_t.p_set.sum(1) # VRES potential of non extendable generators capacity_factor = n.generators_t.p_max_pu[vres_i.difference(ext_i)] From 3dac13ac3bae6886fb82723c39fec01d87e54b49 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 16 Dec 2022 10:58:24 +0000 Subject: [PATCH 19/44] Update release_notes.rst --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 812712bc..b1b56416 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -12,6 +12,8 @@ Upcoming Release * Carriers of generators can now be excluded from aggregation in clustering network and simplify network. +* Bugfix in the reserve constraint will increase demand related reserve requirements + PyPSA-Eur 0.6.1 (20th September 2022) ===================================== From 9e61e30ff45a13da92dbce2f0c7f69721d480e99 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 16 Dec 2022 11:00:39 +0000 Subject: [PATCH 20/44] Fix EQ constraint in case no hydro exist --- scripts/solve_network.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index d1331b0d..575cd078 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -216,18 +216,21 @@ def add_EQ_constraints(n, o, scaling=1e-1): .T.groupby(ggrouper, axis=1) .apply(join_exprs) ) - lhs_spill = ( - linexpr( - ( - -n.snapshot_weightings.stores * scaling, - get_var(n, "StorageUnit", "spill").T, + if not n.storage_units_t.inflow.empty: + lhs_spill = ( + linexpr( + ( + -n.snapshot_weightings.stores * scaling, + get_var(n, "StorageUnit", "spill").T, + ) ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) ) - .T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ) - lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("") - lhs = lhs_gen + lhs_spill + lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("") + lhs = lhs_gen + lhs_spill + else: + lhs = lhs_gen define_constraints(n, lhs, ">=", rhs, "equity", "min") From 17a8bc3c3999ab58af20eea8d4e61ab2267cd62b Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 16 Dec 2022 11:06:36 +0000 Subject: [PATCH 21/44] Update release_notes.rst --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 812712bc..2d2eae23 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -12,6 +12,8 @@ Upcoming Release * Carriers of generators can now be excluded from aggregation in clustering network and simplify network. +* Fix EQ constraint for the case no hydro inflow is available + PyPSA-Eur 0.6.1 (20th September 2022) ===================================== From d36a44f23c64b4661f5ce57305bf1b88caebc833 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 20:31:18 +0000 Subject: [PATCH 22/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/isort: 5.11.0 → v5.11.3](https://github.com/PyCQA/isort/compare/5.11.0...v5.11.3) - [github.com/PyCQA/docformatter: v1.5.0 → v1.5.1](https://github.com/PyCQA/docformatter/compare/v1.5.0...v1.5.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1038991c..f1527e44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: # Sort package imports alphabetically - repo: https://github.com/PyCQA/isort - rev: 5.11.0 + rev: v5.11.3 hooks: - id: isort args: ["--profile", "black", "--filter-files"] @@ -39,7 +39,7 @@ repos: # Make docstrings PEP 257 compliant - repo: https://github.com/PyCQA/docformatter - rev: v1.5.0 + rev: v1.5.1 hooks: - id: docformatter args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] From 09d89130b578da932d8b38d34f855f13de68242e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 21:14:52 +0000 Subject: [PATCH 23/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/isort: v5.11.3 → 5.11.4](https://github.com/PyCQA/isort/compare/v5.11.3...5.11.4) - [github.com/snakemake/snakefmt: v0.7.0 → v0.8.0](https://github.com/snakemake/snakefmt/compare/v0.7.0...v0.8.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1527e44..bb48c2db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: # Sort package imports alphabetically - repo: https://github.com/PyCQA/isort - rev: v5.11.3 + rev: 5.11.4 hooks: - id: isort args: ["--profile", "black", "--filter-files"] @@ -74,7 +74,7 @@ repos: # Format Snakemake rule / workflow files - repo: https://github.com/snakemake/snakefmt - rev: v0.7.0 + rev: v0.8.0 hooks: - id: snakefmt From 06bee06d5623a6c05853806a4cf356a39ec3e11d Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 10:51:02 +0100 Subject: [PATCH 24/44] update pypsa, vresutils master, lift fione restriction --- envs/environment.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 8cbb0336..276c7868 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -10,7 +10,7 @@ dependencies: - python>=3.8 - pip -- pypsa>=0.21.2 +- pypsa>=0.21.3 - atlite>=0.2.9 - dask @@ -24,7 +24,7 @@ dependencies: - yaml - pytables - lxml -- powerplantmatching>=0.5.4 +- powerplantmatching>=0.5.5 - numpy - pandas - geopandas>=0.11.0 @@ -37,7 +37,7 @@ dependencies: - pyomo - matplotlib - proj -- fiona <= 1.18.20 # Till issue https://github.com/Toblerity/Fiona/issues/1085 is not solved +- fiona - country_converter # Keep in conda environment when calling ipython @@ -56,5 +56,5 @@ dependencies: - pyxlsb - pip: - - vresutils>=0.3.1 + - git+https://github.com/fresna/vresutils.git#egg=vresutils - tsam>=1.1.0 From 8bd840c252c208180f063fb93ef28bb5a8a3a8ca Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 11:30:33 +0100 Subject: [PATCH 25/44] limit numpy < 1.24 --- envs/environment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 276c7868..9476dd6b 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -25,7 +25,7 @@ dependencies: - pytables - lxml - powerplantmatching>=0.5.5 -- numpy +- numpy<1.24 - pandas - geopandas>=0.11.0 - xarray @@ -56,5 +56,5 @@ dependencies: - pyxlsb - pip: - - git+https://github.com/fresna/vresutils.git#egg=vresutils + - vresutils>=0.3.1 - tsam>=1.1.0 From 70d07d561fe370f22b7fd8ec599ec8accd37ebc1 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 11:42:32 +0100 Subject: [PATCH 26/44] address pandas deprecations --- scripts/build_shapes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_shapes.py b/scripts/build_shapes.py index 79409a26..dff6313d 100644 --- a/scripts/build_shapes.py +++ b/scripts/build_shapes.py @@ -145,7 +145,7 @@ def eez(country_shapes, eez, country_list): lambda s: _simplify_polys(s, filterremote=False) ) s = gpd.GeoSeries( - {k: v for k, v in s.iteritems() if v.distance(country_shapes[k]) < 1e-3} + {k: v for k, v in s.items() if v.distance(country_shapes[k]) < 1e-3} ) s = s.to_frame("geometry") s.index.name = "name" From e14382239e9513324638a87e4819e1d007eaae7b Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 11:43:02 +0100 Subject: [PATCH 27/44] try shapely 2.0 --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 9476dd6b..e35bd888 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -32,7 +32,7 @@ dependencies: - netcdf4 - networkx - scipy -- shapely<2.0 # need to address deprecations +- shapely - progressbar2 - pyomo - matplotlib From 70cea4aea3cb1db977026ec256392814f3e05334 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 11:51:01 +0100 Subject: [PATCH 28/44] revert to shapely<2.0 --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index e35bd888..8f38465a 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -32,7 +32,7 @@ dependencies: - netcdf4 - networkx - scipy -- shapely +- shapely<2.0 - progressbar2 - pyomo - matplotlib From 69a33e3698708673fd0a7b80c5a3a5ff034dd472 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 12:16:02 +0100 Subject: [PATCH 29/44] increase resource requirements of some rules --- Snakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Snakefile b/Snakefile index 1a7cbe9f..f4f37049 100644 --- a/Snakefile +++ b/Snakefile @@ -68,7 +68,7 @@ if config["enable"].get("prepare_links_p_nom", False): "logs/" + RDIR + "prepare_links_p_nom.log", threads: 1 resources: - mem_mb=500, + mem_mb=1500, script: "scripts/prepare_links_p_nom.py" @@ -167,7 +167,7 @@ rule base_network: "benchmarks/" + RDIR + "base_network" threads: 1 resources: - mem_mb=500, + mem_mb=1500, script: "scripts/base_network.py" @@ -190,7 +190,7 @@ rule build_shapes: "logs/" + RDIR + "build_shapes.log", threads: 1 resources: - mem_mb=500, + mem_mb=1500, script: "scripts/build_shapes.py" @@ -657,7 +657,7 @@ rule make_summary: + RDIR + "make_summary/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}.log", resources: - mem_mb=500, + mem_mb=1500, script: "scripts/make_summary.py" @@ -676,7 +676,7 @@ rule plot_summary: + RDIR + "plot_summary/{summary}_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}_{ext}.log", resources: - mem_mb=500, + mem_mb=1500, script: "scripts/plot_summary.py" @@ -706,6 +706,6 @@ rule plot_p_nom_max: + RDIR + "plot_p_nom_max/elec_s{simpl}_{clusts}_{techs}_{country}_{ext}.log", resources: - mem_mb=500, + mem_mb=1500, script: "scripts/plot_p_nom_max.py" From 2aa67bdf9fa0c407b96af40a1b98dee19c2d4e7d Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 13:03:12 +0100 Subject: [PATCH 30/44] add atlite control for progressbar to configs --- config.default.yaml | 1 + config.tutorial.yaml | 1 + test/config.test1.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/config.default.yaml b/config.default.yaml index 0ec5e9fb..b9a30be7 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -86,6 +86,7 @@ electricity: atlite: nprocesses: 4 + show_progress: false # false saves time cutouts: # use 'base' to determine geographical bounds and time span from config # base: diff --git a/config.tutorial.yaml b/config.tutorial.yaml index a3ffc2a9..4c093a3c 100755 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -56,6 +56,7 @@ electricity: atlite: nprocesses: 4 + show_progress: false # false saves time cutouts: be-03-2013-era5: module: era5 diff --git a/test/config.test1.yaml b/test/config.test1.yaml index 15dc8e6e..7c9b0896 100755 --- a/test/config.test1.yaml +++ b/test/config.test1.yaml @@ -54,6 +54,7 @@ electricity: atlite: nprocesses: 4 + show_progress: false # false saves time cutouts: be-03-2013-era5: module: era5 From bb1b37e8ef9e8b5125633a6b4cacc4510bf6ec5e Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 27 Dec 2022 13:16:05 +0100 Subject: [PATCH 31/44] address pandas iteritems deprecation --- scripts/simplify_network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 2c7f8413..12603647 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -217,7 +217,7 @@ def _adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus, out tech, ", ".join( "{:.0f} Eur/MW/a for `{}`".format(d, b) - for b, d in costs.iteritems() + for b, d in costs.items() ), ) ) @@ -369,7 +369,7 @@ def simplify_links(n, costs, config, output, aggregation_strategies=dict()): n.mremove("Link", all_links) static_attrs = n.components["Link"]["attrs"].loc[lambda df: df.static] - for attr, default in static_attrs.default.iteritems(): + for attr, default in static_attrs.default.items(): params.setdefault(attr, default) n.links.loc[name] = pd.Series(params) From 27d4af8e6574d8b39f1a442caa37d896ff1ae876 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 09:31:48 +0100 Subject: [PATCH 32/44] entsoegridkit: additional parameter corrections --- data/parameter_corrections.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/parameter_corrections.yaml b/data/parameter_corrections.yaml index b50fc03a..850d060b 100644 --- a/data/parameter_corrections.yaml +++ b/data/parameter_corrections.yaml @@ -36,12 +36,19 @@ Link: "5583": "7428" # bus0 == bus1 to remove link in remove_unconnected_components (Sardinia) "13588": "7428" # bus0 == bus1 to remove link in remove_unconnected_components (Sardinia) "T23": "6355" # bus0 == bus1 to remove link in remove_unconnected_components (NordBalt) + "14815": "5939" # Kainachtal + "8706": "6448" bus1: index: "12931": "8152" # BorWin3 "5582": "2382" # combine link 5583 + 5582 in 5582 (Sardinia) "13589": "1349" # combine link 13589 + 13588 in 13589 (Sardinia) "14820": "6354" # NordBalt + "14810": "6365" # Skagerrak + "8708": "6448" + "8394": "6695" + "14813": "7052" + "8009": "5939" length: index: "5582": 26.39 # new length of combined links (sum) @@ -53,6 +60,7 @@ Line: bus0: index: "14573": "7179" #fix bus-id substation in PT (220/380kV issue) + "14756": "8577" # Deeside connection v_nom: index: "14573": 220 # 220/380kV issue of substation in PT From e9f3d20432deb548895443dff9e34451a27cdd9f Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 09:33:08 +0100 Subject: [PATCH 33/44] simplify_networks: add control for removing stubs --- config.default.yaml | 2 ++ scripts/simplify_network.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.default.yaml b/config.default.yaml index 0ec5e9fb..20c05727 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -262,6 +262,8 @@ clustering: algorithm: kmeans # choose from: [hac, kmeans] feature: solar+onwind-time # only for hac. choose from: [solar+onwind-time, solar+onwind-cap, solar-time, solar-cap, solar+offwind-cap] etc. exclude_carriers: [] + remove_stubs: true + remove_stubs_across_borders: true cluster_network: algorithm: kmeans feature: solar+onwind-time diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 2c7f8413..38446e46 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -395,7 +395,9 @@ def simplify_links(n, costs, config, output, aggregation_strategies=dict()): def remove_stubs(n, costs, config, output, aggregation_strategies=dict()): logger.info("Removing stubs") - busmap = busmap_by_stubs(n) # ['country']) + across_borders = config["clustering"]["simplify_network"].get("remove_stubs_across_borders", True) + matching_attrs = [] if across_borders else ['country'] + busmap = busmap_by_stubs(n, matching_attrs) connection_costs_to_bus = _compute_connection_costs_to_bus(n, busmap, costs, config) From 780834ad872d90af90fe1558400f82157a8a99a6 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 09:33:36 +0100 Subject: [PATCH 34/44] tyndp: add greenlink and celtic interconnector --- data/links_tyndp.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/links_tyndp.csv b/data/links_tyndp.csv index 8079be72..a0603120 100644 --- a/data/links_tyndp.csv +++ b/data/links_tyndp.csv @@ -24,3 +24,5 @@ Gridlink,Kingsnorth (UK),Warande (FR),160,,1400,in permitting,,https://tyndp.ent NeuConnect,Grain (UK),Fedderwarden (DE),680,,1400,in permitting,,https://tyndp.entsoe.eu/tyndp2018/projects/projects/309,0.716666666666667,51.44,8.046524,53.562763 NordBalt,Klaipeda (LT),Nybro (SE),450,,700,built,,https://en.wikipedia.org/wiki/NordBalt,21.256667,55.681667,15.854167,56.767778 Estlink 1,Harku (EE),Espoo (FI),105,,350,built,,https://en.wikipedia.org/wiki/Estlink,24.560278,59.384722,24.551667,60.203889 +Greenlink,Waterford (IE),Pembroke (UK),,180,500,under construction,,https://tyndp2022-project-platform.azurewebsites.net/projectsheets/transmission/286,-6.987,52.260,-4.986,51.686 +Celtic Interconnector,Aghada (IE),La Martyre (FR),,572,700,under consideration,,https://tyndp2022-project-platform.azurewebsites.net/projectsheets/transmission/107,-8.16642,51.91413,-4.184,48.459 From bb5c5bd14338798c4fabdc412f04852afaeafe8e Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 09:34:28 +0100 Subject: [PATCH 35/44] simplify_networks: add control for removing stubs II --- scripts/simplify_network.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 38446e46..5b8c8f49 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -532,22 +532,20 @@ if __name__ == "__main__": n, technology_costs, snakemake.config, snakemake.output, aggregation_strategies ) - n, stub_map = remove_stubs( - n, - technology_costs, - snakemake.config, - snakemake.output, - aggregation_strategies=aggregation_strategies, - ) + busmaps = [trafo_map, simplify_links_map] - busmaps = [trafo_map, simplify_links_map, stub_map] + cluster_config = snakemake.config["clustering"]["simplify_network"] + if cluster_config.get("remove_stubs", True): + n, stub_map = remove_stubs( + n, + technology_costs, + snakemake.config, + snakemake.output, + aggregation_strategies=aggregation_strategies, + ) + busmaps.append(stub_map) - cluster_config = snakemake.config.get("clustering", {}).get("simplify_network", {}) - if ( - cluster_config.get("clustering", {}) - .get("simplify_network", {}) - .get("to_substations", False) - ): + if cluster_config.get("to_substations", False): n, substation_map = aggregate_to_substations(n, aggregation_strategies) busmaps.append(substation_map) From a08c20d7c88d459e97d9865ae57e757f8f0dc1de Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 09:35:11 +0100 Subject: [PATCH 36/44] build_shapes: cleanup shape union of RS and KV --- scripts/build_shapes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build_shapes.py b/scripts/build_shapes.py index dff6313d..cda27963 100644 --- a/scripts/build_shapes.py +++ b/scripts/build_shapes.py @@ -129,6 +129,8 @@ def countries(naturalearth, country_list): s = df.set_index("name")["geometry"].map(_simplify_polys) if "RS" in country_list: s["RS"] = s["RS"].union(s.pop("KV")) + # cleanup shape union + s["RS"] = Polygon(s["RS"].exterior.coords) return s From 9e1eec9c9d20df50e913850bc58031fdcb5e161f Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 11:10:19 +0100 Subject: [PATCH 37/44] env: add pygeos dependency --- envs/environment.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/envs/environment.yaml b/envs/environment.yaml index 8f38465a..ec2fbb5f 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -54,6 +54,7 @@ dependencies: - pytz - tabula-py - pyxlsb +- pygeos - pip: - vresutils>=0.3.1 From 67b3c964d4a028b56aa2f5f620eee5650b6e5133 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 11:11:13 +0100 Subject: [PATCH 38/44] env: add pygeos dependency >= 0.11 --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index ec2fbb5f..2574e413 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -54,7 +54,7 @@ dependencies: - pytz - tabula-py - pyxlsb -- pygeos +- pygeos>=0.11 - pip: - vresutils>=0.3.1 From 8b363fe108781e00d043daa1f2b069596332e88c Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 11:21:52 +0100 Subject: [PATCH 39/44] env: remove pygeos dependency --- envs/environment.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 2574e413..8f38465a 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -54,7 +54,6 @@ dependencies: - pytz - tabula-py - pyxlsb -- pygeos>=0.11 - pip: - vresutils>=0.3.1 From c17ae85f9b094271f96bf2e712fca453681b61bd Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 12:15:17 +0100 Subject: [PATCH 40/44] HVDC links Sweden Germany parameter correction --- data/parameter_corrections.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/data/parameter_corrections.yaml b/data/parameter_corrections.yaml index 850d060b..df15738a 100644 --- a/data/parameter_corrections.yaml +++ b/data/parameter_corrections.yaml @@ -49,6 +49,7 @@ Link: "8394": "6695" "14813": "7052" "8009": "5939" + "5601": "7052" # Link Sweden - Lübeck length: index: "5582": 26.39 # new length of combined links (sum) From c9dc64e0eda88468af26ec750b70b231ef6f2b08 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 28 Dec 2022 15:10:45 +0100 Subject: [PATCH 41/44] limit matplotlib < 3.6 --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 8f38465a..490268e8 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -35,7 +35,7 @@ dependencies: - shapely<2.0 - progressbar2 - pyomo -- matplotlib +- matplotlib<3.6 - proj - fiona - country_converter From 0cf6d47afbac9d273f27e37f84592c5fb4b430db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 21:56:40 +0000 Subject: [PATCH 42/44] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/simplify_network.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 42f7daac..7ed17923 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -395,8 +395,10 @@ def simplify_links(n, costs, config, output, aggregation_strategies=dict()): def remove_stubs(n, costs, config, output, aggregation_strategies=dict()): logger.info("Removing stubs") - across_borders = config["clustering"]["simplify_network"].get("remove_stubs_across_borders", True) - matching_attrs = [] if across_borders else ['country'] + across_borders = config["clustering"]["simplify_network"].get( + "remove_stubs_across_borders", True + ) + matching_attrs = [] if across_borders else ["country"] busmap = busmap_by_stubs(n, matching_attrs) connection_costs_to_bus = _compute_connection_costs_to_bus(n, busmap, costs, config) From db51a6eba08914474a366a93f3d33b3a5ec9acc6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 21:25:31 +0000 Subject: [PATCH 43/44] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/docformatter: v1.5.1 → v1.6.0.rc1](https://github.com/PyCQA/docformatter/compare/v1.5.1...v1.6.0.rc1) - [github.com/macisamuele/language-formatters-pre-commit-hooks: v2.5.0 → v2.6.0](https://github.com/macisamuele/language-formatters-pre-commit-hooks/compare/v2.5.0...v2.6.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb48c2db..1b3a4dfc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: # Make docstrings PEP 257 compliant - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.6.0.rc1 hooks: - id: docformatter args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] @@ -67,7 +67,7 @@ repos: # Do YAML formatting (before the linter checks it for misses) - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.5.0 + rev: v2.6.0 hooks: - id: pretty-format-yaml args: [--autofix, --indent, "2", --preserve-quotes] From 8bdba5653a51e42ac1651b8def36f1b4a3a0999a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 21:27:19 +0000 Subject: [PATCH 44/44] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/_helpers.py | 1 - scripts/add_electricity.py | 1 - scripts/build_bus_regions.py | 1 - scripts/build_load_data.py | 1 - scripts/cluster_network.py | 1 - scripts/make_summary.py | 2 -- scripts/simplify_network.py | 18 ++++++++++++------ scripts/solve_network.py | 1 - 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts/_helpers.py b/scripts/_helpers.py index ba88efb2..127e42a8 100644 --- a/scripts/_helpers.py +++ b/scripts/_helpers.py @@ -28,7 +28,6 @@ def configure_logging(snakemake, skip_handlers=False): skip_handlers : True | False (default) Do (not) skip the default handlers created for redirecting output to STDERR and file. """ - import logging kwargs = snakemake.config.get("logging", dict()).copy() diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 3d9babfd..85391a64 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -111,7 +111,6 @@ def calculate_annuity(n, r): discount rate of r, e.g. annuity(20, 0.05) * 20 = 1.6 """ - if isinstance(r, pd.Series): return pd.Series(1 / n, index=r.index).where( r == 0, r / (1.0 - 1.0 / (1.0 + r) ** n) diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py index 6e6fdd32..ef4cc396 100644 --- a/scripts/build_bus_regions.py +++ b/scripts/build_bus_regions.py @@ -69,7 +69,6 @@ def voronoi_partition_pts(points, outline): ------- polygons : N - ndarray[dtype=Polygon|MultiPolygon] """ - points = np.asarray(points) if len(points) == 1: diff --git a/scripts/build_load_data.py b/scripts/build_load_data.py index 482256ba..780a651e 100755 --- a/scripts/build_load_data.py +++ b/scripts/build_load_data.py @@ -189,7 +189,6 @@ def manual_adjustment(load, fn_load, powerstatistics): Manual adjusted and interpolated load time-series with UTC timestamps x ISO-2 countries """ - if powerstatistics: if "MK" in load.columns: if "AL" not in load.columns or load.AL.isnull().values.all(): diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index 63fec077..80998b20 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -222,7 +222,6 @@ def distribute_clusters(n, n_clusters, focus_weights=None, solver_name="cbc"): """ Determine the number of clusters per country. """ - L = ( n.loads_t.p_set.mean() .groupby(n.loads.bus) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 0d12a04c..4c3c675a 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -235,7 +235,6 @@ def calculate_supply(n, label, supply): calculate the max dispatch of each component at the buses where the loads are attached. """ - load_types = n.buses.carrier.unique() for i in load_types: @@ -296,7 +295,6 @@ def calculate_supply_energy(n, label, supply_energy): calculate the total dispatch of each component at the buses where the loads are attached. """ - load_types = n.buses.carrier.unique() for i in load_types: diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 42f7daac..7aa7a732 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -111,11 +111,15 @@ def simplify_network_to_380(n): """ Fix all lines to a voltage level of 380 kV and remove all transformers. - The function preserves the transmission capacity for each line while updating - its voltage level, line type and number of parallel bundles (num_parallel). + The function preserves the transmission capacity for each line while + updating + its voltage level, line type and number of parallel bundles + (num_parallel). - Transformers are removed and connected components are moved from their - starting bus to their ending bus. The corresponding starting buses are + Transformers are removed and connected components are moved from + their + starting bus to their ending bus. The corresponding starting buses + are removed as well. """ logger.info("Mapping all network lines onto a single 380kV layer") @@ -395,8 +399,10 @@ def simplify_links(n, costs, config, output, aggregation_strategies=dict()): def remove_stubs(n, costs, config, output, aggregation_strategies=dict()): logger.info("Removing stubs") - across_borders = config["clustering"]["simplify_network"].get("remove_stubs_across_borders", True) - matching_attrs = [] if across_borders else ['country'] + across_borders = config["clustering"]["simplify_network"].get( + "remove_stubs_across_borders", True + ) + matching_attrs = [] if across_borders else ["country"] busmap = busmap_by_stubs(n, matching_attrs) connection_costs_to_bus = _compute_connection_costs_to_bus(n, busmap, costs, config) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index bcb786f0..5124852f 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -321,7 +321,6 @@ def add_operational_reserve_margin(n, sns, config): Build reserve margin constraints based on the formulation given in https://genxproject.github.io/GenX/dev/core/#Reserves. """ - define_variables(n, 0, np.inf, "Generator", "r", axes=[sns, n.generators.index]) add_operational_reserve_margin_constraint(n, config)