Skip to content

Commit

Permalink
Update template rule names
Browse files Browse the repository at this point in the history
  • Loading branch information
brynpickering committed Jul 5, 2024
1 parent 656241c commit 0740e0f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ include: "./rules/modules.smk"
min_version("8.10")
localrules: all, clean
wildcard_constraints:
resolution = "continental|national|regional|ehighways"

ruleorder: techs_and_locations_template > dummy_tech_locations_template
resolution = "continental|national|regional|ehighways",
group_and_tech = "(demand|storage|supply|transmission)\/\w+"
ruleorder: module_with_location_specific_data > module_without_location_specific_data

ALL_CF_TECHNOLOGIES = [
"wind-onshore", "wind-offshore", "open-field-pv",
Expand Down Expand Up @@ -94,30 +94,30 @@ rule all_tests:
)


rule techs_and_locations_template:
message: "Create {wildcards.resolution} definition file for {wildcards.tech_and_group}."
rule module_with_location_specific_data:
message: "Create {wildcards.resolution} definition file for {wildcards.group_and_tech}."
input:
template = techs_template_dir + "{tech_and_group}.yaml.jinja",
locations = "build/data/{resolution}/{tech_and_group}.csv"
template = techs_template_dir + "{group_and_tech}.yaml.jinja",
locations = "build/data/{resolution}/{group_and_tech}.csv"
params:
scaling_factors = config["scaling-factors"],
capacity_factors = config["capacity-factors"]["average"],
max_power_densities = config["parameters"]["maximum-installable-power-density"],
heat_pump_shares = config["parameters"]["heat-pump"]["heat-pump-shares"],
wildcard_constraints:
# Exclude all outputs that have their own `techs_and_locations_template` implementation
tech_and_group = "(?!transmission\/|supply\/biofuel).*"
group_and_tech = "(?!transmission\/|supply\/biofuel).*"
conda: "envs/default.yaml"
output: "build/models/{resolution}/techs/{tech_and_group}.yaml"
output: "build/models/{resolution}/techs/{group_and_tech}.yaml"
script: "scripts/template_techs.py"

use rule techs_and_locations_template as dummy_tech_locations_template with:
use rule module_with_location_specific_data as module_without_location_specific_data with:
# For all cases where we don't have any location-specific data that we want to supply to the template
input:
template = techs_template_dir + "{tech_and_group}.yaml.jinja",
locations = rules.locations_template.output.csv
template = techs_template_dir + "{group_and_tech}.yaml.jinja",
locations = rules.locations.output.csv

rule no_params_model_template:
rule model_file_without_specific_data:
message: "Create {wildcards.resolution} configuration files from templates where no parameterisation is required."
input:
template = model_template_dir + "{template}",
Expand All @@ -128,7 +128,7 @@ rule no_params_model_template:
shell: "cp {input.template} {output}"


rule no_params_template:
rule non_model_file_without_specific_data:
message: "Create non-model files from templates where no parameterisation is required."
input:
template = template_dir + "{template}",
Expand All @@ -139,7 +139,7 @@ rule no_params_template:
shell: "cp {input.template} {output}"


rule model_template:
rule model:
message: "Generate top-level {wildcards.resolution} model configuration file from template"
input:
template = model_template_dir + "example-model.yaml.jinja",
Expand Down
2 changes: 1 addition & 1 deletion rules/biofuels.smk
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rule biofuels:
script: "../scripts/biofuels/allocate.py"


rule bio_techs_and_locations_template:
rule biofuel_tech_module:
message: "Create biofuel tech definition file from template."
input:
template = techs_template_dir + "supply/biofuel.yaml.jinja",
Expand Down
2 changes: 1 addition & 1 deletion rules/shapes.smk
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ rule eez:
"""


rule locations_template:
rule locations:
message: "Generate locations configuration file for {wildcards.resolution} resolution from template."
input:
template = model_template_dir + "locations.yaml.jinja",
Expand Down
6 changes: 3 additions & 3 deletions rules/transmission.smk
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ rule entsoe_tyndp_xlsx:
shell: "unzip -o {input} 'TYNDP-2020-Scenario-Datafile.xlsx' -d build/data/national"


rule transmission_entsoe_tyndp_techs_and_locations_template:
rule transmission_entsoe_tyndp_tech_module:
message: "Create YAML file of national-scale links with ENTSO-E TYNDP net-transfer capacities"
input:
template = techs_template_dir + "transmission/electricity-transmission.yaml.jinja",
locations = rules.locations_template.output.csv,
locations = rules.locations.output.csv,
entsoe_tyndp = rules.entsoe_tyndp_xlsx.output[0]
params:
scenario = config["parameters"]["entsoe-tyndp"]["scenario"],
Expand All @@ -39,7 +39,7 @@ rule transmission_entsoe_tyndp_techs_and_locations_template:
script: "../scripts/transmission/template_transmission_entsoe_tyndp.py"


rule transmission_techs_and_locations_template:
rule transmission_linked_neighbours_tech_module:
message: "Link {wildcards.resolution} direct neighbours and neighbours with sea connections with transmission techs from template."
input:
template = techs_template_dir + "transmission/electricity-transmission.yaml.jinja",
Expand Down

0 comments on commit 0740e0f

Please sign in to comment.