-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix the import of the new industry module #386
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. The definition of this level is crucial for modules to work properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine to remove it from here (and necessary for schema validation given that the config is merged with the rest of the project config). validating would become There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's important to have it here so that the module makes sure you are specifying the module configuration separately. Otherwise, someone might add all these at the top level, causing conflicts! The only limitation that this might impose is that modules cannot expect the same name, which is good, imo. |
||
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 |
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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just one final improvement. I think we should move this validation within the module's smk. This way, we avoid users skipping validation because they find it cumbersome and always enforce it. That way, we still force users to separate a module's configuration due to Could you test this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense to me, also in terms of separation of concerns. I tested it and it works. |
||
|
||
|
||
module module_industry: | ||
snakefile: "../modules/industry/industry.smk" | ||
config: config["industry"] | ||
use rule * from module_industry as module_industry_* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core bug is fixed by adding
default_target: True
torule all:
This should avoid having to heavily modify the industry module beyond the
schema
improvements.