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

View File

@ -13,7 +13,8 @@ rule plot_network:
overrides="data/override_component_attrs",
network=RESULTS
+ "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:
map=RESULTS
+ "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:
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:
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:
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
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
memory=LOGS
+ "solve_network/elec{weather_year}_s{simpl}_{clusters}_ec_l{ll}_{opts}_memory.log",
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
resources:
mem_mb=memory,
@ -31,9 +37,11 @@ rule solve_network:
rule solve_operations_network:
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:
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:
solver=normpath(
LOGS

View File

@ -11,10 +11,13 @@ rule add_existing_baseyear:
powerplants=RESOURCES + "powerplants.csv",
busmap_s=RESOURCES + "busmap_elec{weather_year}_s{simpl}.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]),
cop_soil_total=RESOURCES + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_air_total=RESOURCES + "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_soil_total=RESOURCES
+ "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_solar="data/existing_infrastructure/solar_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",
network_p=solved_previous_horizon, #solved network at previous time step
costs="data/costs_{planning_horizons}.csv",
cop_soil_total=RESOURCES + "cop_soil_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_air_total=RESOURCES + "cop_air_total_elec{weather_year}_s{simpl}_{clusters}.nc",
cop_soil_total=RESOURCES
+ "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:
RESULTS
+ "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:
input:
overrides="data/override_component_attrs",
pre=RDIR + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
post=RDIR + "/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"
pre=RDIR
+ "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
post=RDIR
+ "/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:
solver=RDIR + "/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",
solver=RDIR
+ "/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
resources: mem_mb=10000
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"
resources:
mem_mb=10000,
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:
input:
overrides="data/override_component_attrs",
pre=RDIR + "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
post=RDIR + "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
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"
pre=RDIR
+ "/prenetworks/elec{weather_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
post=RDIR
+ "/postnetworks/elec{capacity_year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc",
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:
solver=RDIR + "/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",
solver=RDIR
+ "/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
resources: mem_mb=10000
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"
resources:
mem_mb=10000,
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"