Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonise wildcards #1223

Merged
merged 10 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ test:
snakemake solve_all_networks -call --configfile config.tutorial.yaml configs/scenarios/config.NG.yaml
snakemake solve_all_networks_monte -call --configfile config.tutorial.yaml test/config.monte_carlo.yaml
snakemake solve_all_networks -call --configfile config.tutorial.yaml test/config.landlock.yaml
snakemake -c4 solve_sector_networks --configfile config.tutorial.yaml test/config.test1.yaml
snakemake -c4 solve_sector_networks --configfile config.tutorial.yaml test/config.sector.yaml
echo "All tests completed successfully."

setup:
@@ -24,5 +24,5 @@ clean:
snakemake -j1 solve_all_networks --delete-all-output --configfile config.tutorial.yaml configs/scenarios/config.NG.yaml
snakemake -j1 solve_all_networks_monte --delete-all-output --configfile test/config.monte_carlo.yaml
snakemake -j1 run_all_scenarios --delete-all-output --configfile test/config.landlock.yaml
snakemake -j1 solve_sector_networks --delete-all-output --configfile test/config.test1.yaml
snakemake -j1 solve_sector_networks --delete-all-output --configfile test/config.sector.yaml
echo "Clean-up complete."
6 changes: 3 additions & 3 deletions scripts/add_brownfield.py
Original file line number Diff line number Diff line change
@@ -232,9 +232,9 @@ def disable_grid_expansion_if_limit_hit(n):
snakemake = mock_snakemake(
"add_brownfield",
simpl="",
clusters="10",
ll="c1.0",
opts="Co2L",
clusters="4",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="144H",
discountrate=0.071,
4 changes: 2 additions & 2 deletions scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
@@ -586,11 +586,11 @@ def add_heating_capacities_installed_before_baseyear(
simpl="",
clusters="4",
ll="c1",
opts="Co2L",
opts="Co2L-4H",
planning_horizons="2030",
sopts="144H",
discountrate=0.071,
demand="DF",
demand="AB",
h2export="120",
)

6 changes: 3 additions & 3 deletions scripts/add_export.py
Original file line number Diff line number Diff line change
@@ -211,9 +211,9 @@ def create_export_profile():
snakemake = mock_snakemake(
"add_export",
simpl="",
clusters="10",
ll="c1.0",
opts="Co2L",
clusters="4",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="144H",
discountrate="0.071",
2 changes: 1 addition & 1 deletion scripts/augmented_line_connections.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ def haversine(p):
from _helpers import mock_snakemake

snakemake = mock_snakemake(
"augmented_line_connections", network="elec", simpl="", clusters="54"
"augmented_line_connections", network="elec", simpl="", clusters="4"
)

configure_logging(snakemake)
2 changes: 1 addition & 1 deletion scripts/build_base_energy_totals.py
Original file line number Diff line number Diff line change
@@ -357,7 +357,7 @@ def calc_sector(sector):
snakemake = mock_snakemake(
"build_base_energy_totals",
simpl="",
clusters=19,
clusters=4,
demand="AB",
planning_horizons=2030,
)
2 changes: 1 addition & 1 deletion scripts/build_base_industry_totals.py
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ def create_industry_base_totals(df):
snakemake = mock_snakemake(
"build_base_industry_totals",
planning_horizons=2030,
demand="EG",
demand="AB",
)

# Loading config file and wild cards
2 changes: 1 addition & 1 deletion scripts/build_clustered_population_layouts.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
snakemake = mock_snakemake(
"build_clustered_population_layouts",
simpl="",
clusters=38,
clusters=4,
)

cutout_path = (
2 changes: 1 addition & 1 deletion scripts/build_cop_profiles.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ def coefficient_of_performance(delta_T, source="air"):
snakemake = mock_snakemake(
"build_cop_profiles",
simpl="",
clusters=15,
clusters=4,
)

for area in ["total", "urban", "rural"]:
4 changes: 2 additions & 2 deletions scripts/build_existing_heating_distribution.py
Original file line number Diff line number Diff line change
@@ -170,9 +170,9 @@ def build_existing_heating():
snakemake = mock_snakemake(
"build_existing_heating_distribution",
simpl="",
clusters=4,
clusters="4",
planning_horizons=2030,
demand="DF",
demand="AB",
)

build_existing_heating()
2 changes: 1 addition & 1 deletion scripts/build_heat_demand.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
if "snakemake" not in globals():
from _helpers import mock_snakemake

snakemake = mock_snakemake("build_heat_demand", simpl="", clusters="10")
snakemake = mock_snakemake("build_heat_demand", simpl="", clusters="4")

time = pd.date_range(freq="h", **snakemake.params.snapshots)
cutout_config = snakemake.input.cutout
8 changes: 4 additions & 4 deletions scripts/build_industrial_database.py
Original file line number Diff line number Diff line change
@@ -499,12 +499,12 @@ def create_paper_df():
"build_industrial_database",
simpl="",
clusters="4",
ll="c1.0",
opts="Co2L",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="144H",
discountrate="0.071",
demand="DF",
discountrate=0.071,
demand="AB",
)

industrial_database_steel = create_steel_db()
4 changes: 2 additions & 2 deletions scripts/build_industrial_distribution_key.py
Original file line number Diff line number Diff line change
@@ -123,9 +123,9 @@ def match_technology(df):
snakemake = mock_snakemake(
"build_industrial_distribution_key",
simpl="",
clusters=12,
demand="AB",
clusters="4",
planning_horizons=2050,
demand="AB",
)

regions = gpd.read_file(snakemake.input.regions_onshore)
2 changes: 1 addition & 1 deletion scripts/build_industry_demand.py
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ def country_to_nodal(industrial_production, keys):
snakemake = mock_snakemake(
"build_industry_demand",
simpl="",
clusters=10,
clusters="4",
planning_horizons=2030,
demand="AB",
)
2 changes: 1 addition & 1 deletion scripts/build_solar_thermal_profiles.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
snakemake = mock_snakemake(
"build_solar_thermal_profiles",
simpl="",
clusters=15,
clusters="4",
)

config = snakemake.params.solar_thermal_config
2 changes: 1 addition & 1 deletion scripts/build_temperature_profiles.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
snakemake = mock_snakemake(
"build_temperature_profiles",
simpl="",
clusters=900,
clusters="4",
)

time = pd.date_range(freq="h", **snakemake.params.snapshots)
2 changes: 1 addition & 1 deletion scripts/cluster_network.py
Original file line number Diff line number Diff line change
@@ -657,7 +657,7 @@ def cluster_regions(busmaps, inputs, output):
from _helpers import mock_snakemake

snakemake = mock_snakemake(
"cluster_network", network="elec", simpl="", clusters="min"
"cluster_network", network="elec", simpl="", clusters="4"
)
configure_logging(snakemake)

4 changes: 2 additions & 2 deletions scripts/make_summary.py
Original file line number Diff line number Diff line change
@@ -539,9 +539,9 @@ def to_csv(dfs, dir):
snakemake = mock_snakemake(
"make_summary",
simpl="",
clusters="5",
clusters="4",
ll="copt",
opts="Co2L-3H",
opts="Co2L-4H",
country="all",
)
network_dir = ".."
4 changes: 2 additions & 2 deletions scripts/monte_carlo.py
Original file line number Diff line number Diff line change
@@ -353,9 +353,9 @@ def validate_parameters(
snakemake = mock_snakemake(
"monte_carlo",
simpl="",
clusters="10",
clusters="4",
ll="copt",
opts="Co2L-24H",
opts="Co2L-4H",
unc="m0",
)
configure_logging(snakemake)
10 changes: 5 additions & 5 deletions scripts/override_respot.py
Original file line number Diff line number Diff line change
@@ -73,13 +73,13 @@ def override_values(tech, year, dr):
snakemake = mock_snakemake(
"override_respot",
simpl="",
clusters="16",
ll="c1.0",
opts="Co2L",
clusters="4",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="3H",
demand="AP",
sopts="144H",
discountrate=0.071,
demand="AB",
)

overrides = override_component_attrs(snakemake.input.overrides)
6 changes: 3 additions & 3 deletions scripts/plot_network.py
Original file line number Diff line number Diff line change
@@ -1077,9 +1077,9 @@ def plot_sector_map(
"plot_network",
network="elec",
simpl="",
clusters="100",
ll="copt",
opts="Co2L-3H",
clusters="4",
ll="c1",
opts="Co2L-4H",
attr="p_nom",
ext="pdf",
)
6 changes: 3 additions & 3 deletions scripts/plot_summary.py
Original file line number Diff line number Diff line change
@@ -224,9 +224,9 @@ def plot_energy(infn, snmk, fn=None):
summary="energy",
network="elec",
simpl="",
clusters=10,
ll="copt",
opts="Co2L-24H",
clusters="4",
ll="c1",
opts="Co2L-4H",
attr="",
ext="pdf",
country="all",
12 changes: 6 additions & 6 deletions scripts/prepare_db.py
Original file line number Diff line number Diff line change
@@ -36,14 +36,14 @@
snakemake = mock_snakemake(
"prepare_db",
simpl="",
clusters="244",
ll="c1.0",
opts="Co2L1",
clusters="4",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="720H",
sopts="144H",
discountrate=0.071,
demand="AP",
h2export="0",
demand="AB",
h2export="120",
)

n0 = pypsa.Network(snakemake.input.network)
4 changes: 2 additions & 2 deletions scripts/prepare_energy_totals.py
Original file line number Diff line number Diff line change
@@ -43,8 +43,8 @@ def calculate_end_values(df):
snakemake = mock_snakemake(
"prepare_energy_totals",
simpl="",
clusters=32,
demand="EG",
clusters="4",
demand="AB",
planning_horizons=2030,
)

2 changes: 1 addition & 1 deletion scripts/prepare_gas_network.py
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
snakemake = mock_snakemake(
"prepare_gas_network",
simpl="",
clusters="10",
clusters="4",
)

# configure_logging(snakemake)
4 changes: 2 additions & 2 deletions scripts/prepare_heat_data.py
Original file line number Diff line number Diff line change
@@ -137,9 +137,9 @@ def prepare_heat_data(n):
snakemake = mock_snakemake(
"prepare_heat_data",
simpl="",
clusters="10",
clusters="4",
planning_horizons=2030,
demand="DF",
demand="AB",
)

n = pypsa.Network(snakemake.input.network)
6 changes: 3 additions & 3 deletions scripts/prepare_network.py
Original file line number Diff line number Diff line change
@@ -322,9 +322,9 @@ def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):
snakemake = mock_snakemake(
"prepare_network",
simpl="",
clusters="10",
ll="v0.3",
opts="Co2L-24H",
clusters="4",
ll="c1",
opts="Co2L-4H",
)

configure_logging(snakemake)
10 changes: 5 additions & 5 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
@@ -2916,12 +2916,12 @@ def remove_carrier_related_components(n, carriers_to_drop):
snakemake = mock_snakemake(
"prepare_sector_network",
simpl="",
clusters="19",
ll="c1.0",
opts="Co2L",
clusters="4",
ll="c1",
opts="Co2L-4H",
planning_horizons="2030",
sopts="72H",
discountrate="0.071",
sopts="144H",
discountrate=0.071,
demand="AB",
)

4 changes: 2 additions & 2 deletions scripts/prepare_transport_data.py
Original file line number Diff line number Diff line change
@@ -209,9 +209,9 @@ def prepare_transport_data(n):
snakemake = mock_snakemake(
"prepare_transport_data",
simpl="",
clusters="74",
clusters="4",
planning_horizons="2030",
demand="AB",
planning_horizons=2030,
)

n = pypsa.Network(snakemake.input.network)
6 changes: 3 additions & 3 deletions scripts/solve_network.py
Original file line number Diff line number Diff line change
@@ -971,9 +971,9 @@ def solve_network(n, config, solving={}, opts="", **kwargs):
snakemake = mock_snakemake(
"solve_network",
simpl="",
clusters="54",
ll="copt",
opts="Co2L-1H",
clusters="4",
ll="c1",
opts="Co2L-4H",
)

configure_logging(snakemake)
4 changes: 2 additions & 2 deletions test/config.test1.yaml → test/config.sector.yaml
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ version: 0.5.0
tutorial: true

run:
name: test1
name: sector
shared_cutouts: true

scenario:
clusters: # number of nodes in Europe, any integer between 37 (1 node per country-zone) and several hundred
clusters: # number of nodes
- 4
ll:
- "c1"