From 0553108e3d2e722d13e91cac65b7f823b81dc1cd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 18:23:30 +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/snakemake/snakefmt: v0.9.0 → v0.10.0](https://github.com/snakemake/snakefmt/compare/v0.9.0...v0.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 d90f5cb9..5c41e781 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.9.0 + rev: v0.10.0 hooks: - id: snakefmt From 39890630efc3bc1b2356ef274faf9fbebf92ce82 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 18:23:48 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- rules/build_electricity.smk | 16 +++++++----- rules/build_sector.smk | 49 +++++++++++++++++++++---------------- rules/collect.smk | 14 +++++------ rules/postprocess.smk | 40 +++++++++++++++++------------- rules/retrieve.smk | 8 +++--- 5 files changed, 73 insertions(+), 54 deletions(-) diff --git a/rules/build_electricity.smk b/rules/build_electricity.smk index 6b092638..89f4f736 100644 --- a/rules/build_electricity.smk +++ b/rules/build_electricity.smk @@ -401,18 +401,22 @@ rule add_electricity: if str(fn).startswith("data/") }, base_network=RESOURCES + "networks/base.nc", - line_rating=RESOURCES + "networks/line_rating.nc" - if config["lines"]["dynamic_line_rating"]["activate"] - else RESOURCES + "networks/base.nc", + line_rating=( + RESOURCES + "networks/line_rating.nc" + if config["lines"]["dynamic_line_rating"]["activate"] + else RESOURCES + "networks/base.nc" + ), tech_costs=COSTS, regions=RESOURCES + "regions_onshore.geojson", powerplants=RESOURCES + "powerplants.csv", hydro_capacities=ancient("data/bundle/hydro_capacities.csv"), geth_hydro_capacities="data/geth2015_hydro_capacities.csv", unit_commitment="data/unit_commitment.csv", - fuel_price=RESOURCES + "monthly_fuel_price.csv" - if config["conventional"]["dynamic_fuel_price"] - else [], + fuel_price=( + RESOURCES + "monthly_fuel_price.csv" + if config["conventional"]["dynamic_fuel_price"] + else [] + ), load=RESOURCES + "load.csv", nuts3_shapes=RESOURCES + "nuts3_shapes.geojson", ua_md_gdp="data/GDP_PPP_30arcsec_v3_mapped_default.csv", diff --git a/rules/build_sector.smk b/rules/build_sector.smk index a8f419c3..c25c8673 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -797,15 +797,19 @@ rule prepare_sector_network: dsm_profile=RESOURCES + "dsm_profile_s{simpl}_{clusters}.csv", co2_totals_name=RESOURCES + "co2_totals.csv", co2="data/bundle-sector/eea/UNFCCC_v23.csv", - biomass_potentials=RESOURCES - + "biomass_potentials_s{simpl}_{clusters}_" - + "{}.csv".format(config["biomass"]["year"]) - if config["foresight"] == "overnight" - else RESOURCES - + "biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv", - costs="data/costs_{}.csv".format(config["costs"]["year"]) - if config["foresight"] == "overnight" - else "data/costs_{planning_horizons}.csv", + biomass_potentials=( + RESOURCES + + "biomass_potentials_s{simpl}_{clusters}_" + + "{}.csv".format(config["biomass"]["year"]) + if config["foresight"] == "overnight" + else RESOURCES + + "biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv" + ), + costs=( + "data/costs_{}.csv".format(config["costs"]["year"]) + if config["foresight"] == "overnight" + else "data/costs_{planning_horizons}.csv" + ), profile_offwind_ac=RESOURCES + "profile_offwind-ac.nc", profile_offwind_dc=RESOURCES + "profile_offwind-dc.nc", h2_cavern=RESOURCES + "salt_cavern_potentials_s{simpl}_{clusters}.csv", @@ -831,18 +835,21 @@ rule prepare_sector_network: cop_air_total=RESOURCES + "cop_air_total_elec_s{simpl}_{clusters}.nc", cop_air_rural=RESOURCES + "cop_air_rural_elec_s{simpl}_{clusters}.nc", cop_air_urban=RESOURCES + "cop_air_urban_elec_s{simpl}_{clusters}.nc", - solar_thermal_total=RESOURCES - + "solar_thermal_total_elec_s{simpl}_{clusters}.nc" - if config["sector"]["solar_thermal"] - else [], - solar_thermal_urban=RESOURCES - + "solar_thermal_urban_elec_s{simpl}_{clusters}.nc" - if config["sector"]["solar_thermal"] - else [], - solar_thermal_rural=RESOURCES - + "solar_thermal_rural_elec_s{simpl}_{clusters}.nc" - if config["sector"]["solar_thermal"] - else [], + solar_thermal_total=( + RESOURCES + "solar_thermal_total_elec_s{simpl}_{clusters}.nc" + if config["sector"]["solar_thermal"] + else [] + ), + solar_thermal_urban=( + RESOURCES + "solar_thermal_urban_elec_s{simpl}_{clusters}.nc" + if config["sector"]["solar_thermal"] + else [] + ), + solar_thermal_rural=( + RESOURCES + "solar_thermal_rural_elec_s{simpl}_{clusters}.nc" + if config["sector"]["solar_thermal"] + else [] + ), output: RESULTS + "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", diff --git a/rules/collect.smk b/rules/collect.smk index 1d977da1..dc0a94cc 100644 --- a/rules/collect.smk +++ b/rules/collect.smk @@ -29,7 +29,7 @@ rule prepare_elec_networks: input: expand( RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", - **config["scenario"] + **config["scenario"], ), @@ -38,7 +38,7 @@ rule prepare_sector_networks: expand( RESULTS + "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", - **config["scenario"] + **config["scenario"], ), @@ -46,7 +46,7 @@ rule solve_elec_networks: input: expand( RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", - **config["scenario"] + **config["scenario"], ), @@ -55,7 +55,7 @@ rule solve_sector_networks: expand( RESULTS + "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", - **config["scenario"] + **config["scenario"], ), @@ -64,7 +64,7 @@ rule solve_sector_networks_perfect: expand( RESULTS + "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc", - **config["scenario"] + **config["scenario"], ), @@ -73,11 +73,11 @@ rule validate_elec_networks: expand( RESULTS + "figures/.statistics_plots_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}", - **config["scenario"] + **config["scenario"], ), expand( RESULTS + "figures/.validation_{kind}_plots_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}", **config["scenario"], - kind=["production", "prices", "cross_border"] + kind=["production", "prices", "cross_border"], ), diff --git a/rules/postprocess.smk b/rules/postprocess.smk index 3045d0da..2e90d233 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -153,38 +153,44 @@ rule make_summary: input: expand( RESULTS + "maps/power-network-s{simpl}-{clusters}.pdf", - **config["scenario"] + **config["scenario"], ), networks=expand( RESULTS + "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", - **config["scenario"] + **config["scenario"], + ), + costs=( + "data/costs_{}.csv".format(config["costs"]["year"]) + if config["foresight"] == "overnight" + else "data/costs_{}.csv".format(config["scenario"]["planning_horizons"][0]) ), - costs="data/costs_{}.csv".format(config["costs"]["year"]) - if config["foresight"] == "overnight" - else "data/costs_{}.csv".format(config["scenario"]["planning_horizons"][0]), ac_plot=expand( RESULTS + "maps/power-network-s{simpl}-{clusters}.pdf", - **config["scenario"] + **config["scenario"], ), costs_plot=expand( RESULTS + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf", - **config["scenario"] + **config["scenario"], ), h2_plot=expand( - RESULTS - + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-h2_network_{planning_horizons}.pdf" - if config["sector"]["H2_network"] - else [], - **config["scenario"] + ( + RESULTS + + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-h2_network_{planning_horizons}.pdf" + if config["sector"]["H2_network"] + else [] + ), + **config["scenario"], ), ch4_plot=expand( - RESULTS - + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-ch4_network_{planning_horizons}.pdf" - if config["sector"]["gas_network"] - else [], - **config["scenario"] + ( + RESULTS + + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-ch4_network_{planning_horizons}.pdf" + if config["sector"]["gas_network"] + else [] + ), + **config["scenario"], ), output: nodal_costs=RESULTS + "csvs/nodal_costs.csv", diff --git a/rules/retrieve.smk b/rules/retrieve.smk index 05bbefd8..2980583f 100644 --- a/rules/retrieve.smk +++ b/rules/retrieve.smk @@ -191,9 +191,11 @@ if config["enable"]["retrieve"]: input: HTTP.remote( "data.open-power-system-data.org/time_series/{version}/time_series_60min_singleindex.csv".format( - version="2019-06-05" - if config["snapshots"]["end"] < "2019" - else "2020-10-06" + version=( + "2019-06-05" + if config["snapshots"]["end"] < "2019" + else "2020-10-06" + ) ), keep_local=True, static=True,