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 1/2] [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 2/2] [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)