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

Add params as PyPSA-Earth #330

Open
Tracked by #312
davide-f opened this issue Jun 6, 2024 · 3 comments
Open
Tracked by #312

Add params as PyPSA-Earth #330

davide-f opened this issue Jun 6, 2024 · 3 comments
Assignees

Comments

@davide-f
Copy link
Member

davide-f commented Jun 6, 2024

No description provided.

@davide-f davide-f mentioned this issue Jun 6, 2024
18 tasks
@energyLS energyLS self-assigned this Jun 6, 2024
@energyLS
Copy link
Collaborator

energyLS commented Jun 6, 2024

Davide:

  • Add function argument which includes ??
  • drop snakemake.config and replace by ??

@energyLS
Copy link
Collaborator

energyLS commented Jun 6, 2024

@Eddy-JV and @energyLS will work on this, @davide-f supports with hints etc.

@davide-f
Copy link
Member Author

davide-f commented Jun 6, 2024

Davide:

  • Add function argument which includes ??
  • drop snakemake.config and replace by ??

* Add function argument which includes

To add context here, it is common that within functions we have "snakemake.{anything}", for example here

e_initial = (snakemake.config["fossil_reserves"]).get("oil", 0) * 1e6
for the function add_oil(n, costs)

The recommendation for that case may be for example to revise the arguments as appropriate, like:
add_oil(n, oil_reserve [or oil_options], costs)
where oil_options is specified in the main as oil_options = snakemake.params["fossil_reserves"] or oil_reserve = snakemake.params["fossil_reserves"].get("oil", 0.0) for example.

* drop snakemake.config and replace by ??

Inside the scripts, as mentioned above, it is typical that we use values in snakemake.config to change the outputs.
However, when passed through config, snakemake does not understand that when that parameter is changed, the rule shall be retriggered.
To allow that, the object shall be retrieved using snakemake.params instead.
To do so, there is the need to add the params field in snakefile for all rules and change the scripts to load parameters from there,
See https://github.com/pypsa-meets-earth/pypsa-earth/blob/b23cb9ba07f2f061a71de23cad5293fc42a89990/Snakefile#L150-L153

I'd recommend to start from very simple rules to begin with, definitely not prepare_sector_network

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants