[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-04-30 08:54:48 +00:00
parent 4bc6a3af4d
commit e8772c3340
5 changed files with 119 additions and 53 deletions

View File

@ -17,7 +17,8 @@ if config["enable"].get("prepare_links_p_nom", False):
script: script:
"../scripts/prepare_links_p_nom.py" "../scripts/prepare_links_p_nom.py"
if config["enable"].get('retrieve_opsd_load_data', True):
if config["enable"].get("retrieve_opsd_load_data", True):
rule build_electricity_demand: rule build_electricity_demand:
input: input:
@ -33,15 +34,23 @@ if config["enable"].get('retrieve_opsd_load_data', True):
script: script:
"../scripts/build_electricity_demand.py" "../scripts/build_electricity_demand.py"
if config["enable"].get('retrieve_artificial_load_data', False):
if config["enable"].get("retrieve_artificial_load_data", False):
rule build_artificial_load_data: rule build_artificial_load_data:
input: ancient("data/load_artificial_raw.csv") input:
output: RESOURCES + "load{weather_year}.csv" ancient("data/load_artificial_raw.csv"),
log: LOGS + "build_artificial_load_data{weather_year}.log" output:
resources: mem_mb=5000, RESOURCES + "load{weather_year}.csv",
conda: "../envs/environment.yaml" log:
script: "../scripts/build_artificial_load_data.py" LOGS + "build_artificial_load_data{weather_year}.log",
resources:
mem_mb=5000,
conda:
"../envs/environment.yaml"
script:
"../scripts/build_artificial_load_data.py"
rule build_powerplants: rule build_powerplants:
input: input:
@ -155,15 +164,22 @@ if config["enable"].get("build_cutout", False):
"../scripts/build_cutout.py" "../scripts/build_cutout.py"
rule build_cutout_year: rule build_cutout_year:
input: rules.build_cutout.input input:
output: protected("cutouts/" + CDIR + "{cutout}-{weather_year}.nc") rules.build_cutout.input,
log: "logs/" + CDIR + "build_cutout/{cutout}-{weather_year}.log" output:
benchmark: "benchmarks/" + CDIR + "build_cutout_{cutout}-{weather_year}" protected("cutouts/" + CDIR + "{cutout}-{weather_year}.nc"),
log:
"logs/" + CDIR + "build_cutout/{cutout}-{weather_year}.log",
benchmark:
"benchmarks/" + CDIR + "build_cutout_{cutout}-{weather_year}"
threads: ATLITE_NPROCESSES threads: ATLITE_NPROCESSES
resources: mem_mb=ATLITE_NPROCESSES * 1000 resources:
mem_mb=ATLITE_NPROCESSES * 1000,
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: "../scripts/build_cutout.py" script:
"../scripts/build_cutout.py"
if config["enable"].get("build_natura_raster", False): if config["enable"].get("build_natura_raster", False):
@ -319,8 +335,10 @@ rule simplify_network:
regions_offshore=RESOURCES + "regions_offshore.geojson", regions_offshore=RESOURCES + "regions_offshore.geojson",
output: output:
network=RESOURCES + "networks/elec{weather_year}_s{simpl}.nc", network=RESOURCES + "networks/elec{weather_year}_s{simpl}.nc",
regions_onshore=RESOURCES + "regions_onshore_elec{weather_year}_s{simpl}.geojson", regions_onshore=RESOURCES
regions_offshore=RESOURCES + "regions_offshore_elec{weather_year}_s{simpl}.geojson", + "regions_onshore_elec{weather_year}_s{simpl}.geojson",
regions_offshore=RESOURCES
+ "regions_offshore_elec{weather_year}_s{simpl}.geojson",
busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv", busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv",
connection_costs=RESOURCES + "connection_costs{weather_year}_s{simpl}.csv", connection_costs=RESOURCES + "connection_costs{weather_year}_s{simpl}.csv",
log: log:
@ -339,8 +357,10 @@ rule simplify_network:
rule cluster_network: rule cluster_network:
input: input:
network=RESOURCES + "networks/elec{weather_year}_s{simpl}.nc", network=RESOURCES + "networks/elec{weather_year}_s{simpl}.nc",
regions_onshore=RESOURCES + "regions_onshore_elec{weather_year}_s{simpl}.geojson", regions_onshore=RESOURCES
regions_offshore=RESOURCES + "regions_offshore_elec{weather_year}_s{simpl}.geojson", + "regions_onshore_elec{weather_year}_s{simpl}.geojson",
regions_offshore=RESOURCES
+ "regions_offshore_elec{weather_year}_s{simpl}.geojson",
busmap=ancient(RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv"), busmap=ancient(RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv"),
custom_busmap=( custom_busmap=(
"data/custom_busmap_elec_s{simpl}_{clusters}.csv" "data/custom_busmap_elec_s{simpl}_{clusters}.csv"
@ -350,8 +370,10 @@ rule cluster_network:
tech_costs=COSTS, tech_costs=COSTS,
output: output:
network=RESOURCES + "networks/elec{weather_year}_s{simpl}_{clusters}.nc", network=RESOURCES + "networks/elec{weather_year}_s{simpl}_{clusters}.nc",
regions_onshore=RESOURCES + "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson", regions_onshore=RESOURCES
regions_offshore=RESOURCES + "regions_offshore_elec{weather_year}_s{simpl}_{clusters}.geojson", + "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson",
regions_offshore=RESOURCES
+ "regions_offshore_elec{weather_year}_s{simpl}_{clusters}.geojson",
busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}_{clusters}.csv", busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}_{clusters}.csv",
linemap=RESOURCES + "linemap_elec{weather_year}_s{simpl}_{clusters}.csv", linemap=RESOURCES + "linemap_elec{weather_year}_s{simpl}_{clusters}.csv",
log: log:
@ -393,9 +415,13 @@ rule prepare_network:
output: output:
RESOURCES + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", RESOURCES + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
log: log:
LOGS + "prepare_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.log", LOGS
+ "prepare_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.log",
benchmark: benchmark:
(BENCHMARKS + "prepare_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}") (
BENCHMARKS
+ "prepare_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}"
)
threads: 1 threads: 1
resources: resources:
mem_mb=4000, mem_mb=4000,

View File

@ -13,7 +13,8 @@ rule plot_network:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
network=RESULTS network=RESULTS
+ "postnetworks/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", + "postnetworks/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
regions=RESOURCES + "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson", regions=RESOURCES
+ "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson",
output: output:
map=RESULTS map=RESULTS
+ "maps/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf", + "maps/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",

View File

@ -5,19 +5,25 @@
rule solve_network: rule solve_network:
input: input:
network=RESOURCES + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", network=RESOURCES
+ "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
output: output:
network=RESULTS + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", network=RESULTS
+ "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
log: log:
solver=normpath( solver=normpath(
LOGS + "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log" LOGS
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log"
), ),
python=LOGS python=LOGS
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log", + "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
memory=LOGS memory=LOGS
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_memory.log", + "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_memory.log",
benchmark: benchmark:
BENCHMARKS + "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}" (
BENCHMARKS
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}"
)
threads: 4 threads: 4
resources: resources:
mem_mb=memory, mem_mb=memory,
@ -31,9 +37,11 @@ rule solve_network:
rule solve_operations_network: rule solve_operations_network:
input: input:
network=RESULTS + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", network=RESULTS
+ "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
output: output:
network=RESULTS + "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc", network=RESULTS
+ "networks/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc",
log: log:
solver=normpath( solver=normpath(
LOGS LOGS

View File

@ -11,10 +11,13 @@ rule add_existing_baseyear:
powerplants=RESOURCES + "powerplants.csv", powerplants=RESOURCES + "powerplants.csv",
busmap_s=RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv", busmap_s=RESOURCES + "busmap_elec{weather_year}_s{simpl}.csv",
busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}_{clusters}.csv", busmap=RESOURCES + "busmap_elec{weather_year}_s{simpl}_{clusters}.csv",
clustered_pop_layout=RESOURCES + "pop_layout_elec{weather_year}_s{simpl}_{clusters}.csv", clustered_pop_layout=RESOURCES
+ "pop_layout_elec{weather_year}_s{simpl}_{clusters}.csv",
costs="data/costs_{}.csv".format(config["scenario"]["planning_horizons"][0]), costs="data/costs_{}.csv".format(config["scenario"]["planning_horizons"][0]),
cop_soil_total=RESOURCES + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc", cop_soil_total=RESOURCES
cop_air_total=RESOURCES + "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc", + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_air_total=RESOURCES
+ "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc",
existing_heating="data/existing_infrastructure/existing_heating_raw.csv", existing_heating="data/existing_infrastructure/existing_heating_raw.csv",
existing_solar="data/existing_infrastructure/solar_capacity_IRENA.csv", existing_solar="data/existing_infrastructure/solar_capacity_IRENA.csv",
existing_onwind="data/existing_infrastructure/onwind_capacity_IRENA.csv", existing_onwind="data/existing_infrastructure/onwind_capacity_IRENA.csv",
@ -48,8 +51,10 @@ rule add_brownfield:
+ "prenetworks/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", + "prenetworks/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network_p=solved_previous_horizon, #solved network at previous time step network_p=solved_previous_horizon, #solved network at previous time step
costs="data/costs_{planning_horizons}.csv", costs="data/costs_{planning_horizons}.csv",
cop_soil_total=RESOURCES + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc", cop_soil_total=RESOURCES
cop_air_total=RESOURCES + "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc", + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_air_total=RESOURCES
+ "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc",
output: output:
RESULTS RESULTS
+ "prenetworks-brownfield/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", + "prenetworks-brownfield/elec{weather_year}_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",

View File

@ -41,31 +41,57 @@ rule solve_sector_network:
rule solve_operations_network_other_year: rule solve_operations_network_other_year:
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
pre=RDIR + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc", pre=RDIR
post=RDIR + "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc", + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
output: RDIR + "/operations/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}.nc" post=RDIR
shadow: "shallow" + "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
output:
RDIR
+ "/operations/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}.nc",
shadow:
"shallow"
log: log:
solver=RDIR + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_solver.log", solver=RDIR
python=RDIR + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_python.log", + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_solver.log",
python=RDIR
+ "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_python.log",
threads: 4 threads: 4
resources: mem_mb=10000 resources:
benchmark: RDIR + "/benchmarks/solve_operations_network/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}" mem_mb=10000,
script: "../scripts/solve_operations_network_other_year.py" benchmark:
(
RDIR
+ "/benchmarks/solve_operations_network/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}"
)
script:
"../scripts/solve_operations_network_other_year.py"
rule solve_operations_network_other_year_myopic: rule solve_operations_network_other_year_myopic:
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
pre=RDIR + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc", pre=RDIR
post=RDIR + "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc", + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
previous=solved_previous_year post=RDIR
output: RDIR + "/operations/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_myopic.nc" + "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
shadow: "shallow" previous=solved_previous_year,
output:
RDIR
+ "/operations/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_myopic.nc",
shadow:
"shallow"
log: log:
solver=RDIR + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_solver.log", solver=RDIR
python=RDIR + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_python.log", + "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_solver.log",
python=RDIR
+ "/logs/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}_python.log",
threads: 4 threads: 4
resources: mem_mb=10000 resources:
benchmark: RDIR + "/benchmarks/solve_operations_network_myopic/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}" mem_mb=10000,
script: "../scripts/solve_operations_network_other_year_myopic.py" benchmark:
(
RDIR
+ "/benchmarks/solve_operations_network_myopic/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}_{weather_year}"
)
script:
"../scripts/solve_operations_network_other_year_myopic.py"