diff --git a/Snakefile b/Snakefile index a69c4258..71291b8a 100644 --- a/Snakefile +++ b/Snakefile @@ -6,18 +6,6 @@ from snakemake.utils import validate, min_version, makedirs configfile: "config/default.yaml" validate(config, "config/schema.yaml") -# >>>>>> Include modules >>>>>> -# Industry -configfile: "modules/industry/config.yaml" -validate(config, "modules/industry/schema.yaml") - -module module_industry: - snakefile: "modules/industry/industry.smk" - config: config["industry"] -use rule * from module_industry as module_industry_* -# <<<<<< Include modules <<<<<< - - root_dir = config["root-directory"] + "/" if config["root-directory"] not in ["", "."] else "" __version__ = open(f"{root_dir}VERSION").readlines()[0].strip() test_dir = f"{root_dir}tests/" @@ -38,6 +26,7 @@ include: "./rules/nuclear.smk" include: "./rules/transport.smk" include: "./rules/sync.smk" include: "./rules/heat.smk" +include: "./rules/modules.smk" min_version("8.10") localrules: all, clean wildcard_constraints: @@ -83,6 +72,7 @@ onerror: rule all: message: "Generate euro-calliope pre-built models and run tests." localrule: True + default_target: True input: "build/logs/continental/test.success", "build/logs/national/test.success", diff --git a/modules/industry/schema.yaml b/modules/industry/schema.yaml index 25f58945..6ae77ec6 100644 --- a/modules/industry/schema.yaml +++ b/modules/industry/schema.yaml @@ -1,55 +1,50 @@ $schema: https://json-schema.org/draft/2020-12/schema type: object -additionalProperties: true +additionalProperties: false properties: - industry: - description: Module subsection to ensure no name conflicts are possible between modules. + inputs: type: object additionalProperties: false + description: Inputs are paths of prerequired files. properties: - inputs: - type: object - additionalProperties: false - description: Inputs are paths of prerequired files. - properties: - path-energy-balances: - type: string - description: | - Annual energy balance file. - Columns [cat_code,carrier_code,unit,country,year,value]. - path-cat-names: - type: string - description: | - Category mapping file. - Columns [cat_code,top_cat,sub_cat_contribution,sub_cat_1,sub_cat_2,jrc_idees]. - path-carrier-names: - type: string - description: | - Carrier mapping file. - Columns [carrier_code,carrier_name,hh_carrier_name,com_carrier_name,ind_carrier_name,oth_carrier_name]. - path-jrc-industry-energy: - type: string - description: | - JRC processed industry energy demand .nc file. - path-jrc-industry-production: - type: string - description: | - JRC processed industrial production .nc file. - outputs: - type: object - description: Outputs are paths for the files produced by the module. - params: + path-energy-balances: + type: string + description: | + Annual energy balance file. + Columns [cat_code,carrier_code,unit,country,year,value]. + path-cat-names: + type: string + description: | + Category mapping file. + Columns [cat_code,top_cat,sub_cat_contribution,sub_cat_1,sub_cat_2,jrc_idees]. + path-carrier-names: + type: string + description: | + Carrier mapping file. + Columns [carrier_code,carrier_name,hh_carrier_name,com_carrier_name,ind_carrier_name,oth_carrier_name]. + path-jrc-industry-energy: + type: string + description: | + JRC processed industry energy demand .nc file. + path-jrc-industry-production: + type: string + description: | + JRC processed industrial production .nc file. + outputs: + type: object + description: Outputs are paths for the files produced by the module. + params: + type: object + additionalProperties: false + description: Parameters allow users to configure module behaviour. + properties: + steel: type: object additionalProperties: false - description: Parameters allow users to configure module behaviour. + description: "Parameters specific to the 'Iron and steel' industry category." properties: - steel: - type: object - additionalProperties: false - description: "Parameters specific to the 'Iron and steel' industry category." - properties: - recycled-steel-share: - type: number - description: "Share of recycled metal in the H-DRI steel process." - minimum: 0 - maximum: 1 + recycled-steel-share: + type: number + description: "Share of recycled metal in the H-DRI steel process." + minimum: 0 + maximum: 1 diff --git a/rules/modules.smk b/rules/modules.smk new file mode 100644 index 00000000..c2eac4ed --- /dev/null +++ b/rules/modules.smk @@ -0,0 +1,9 @@ +# Industry +configfile: "./modules/industry/config.yaml" +validate(config["industry"], "../modules/industry/schema.yaml") + + +module module_industry: + snakefile: "../modules/industry/industry.smk" + config: config["industry"] +use rule * from module_industry as module_industry_*