Skip to content

Commit

Permalink
Fix industry module import
Browse files Browse the repository at this point in the history
  • Loading branch information
timtroendle committed Jun 1, 2024
1 parent 263935e commit cb3c2f7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 58 deletions.
14 changes: 2 additions & 12 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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:
Expand Down Expand Up @@ -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",
Expand Down
87 changes: 41 additions & 46 deletions modules/industry/schema.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions rules/modules.smk
Original file line number Diff line number Diff line change
@@ -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_*

0 comments on commit cb3c2f7

Please sign in to comment.