-
Notifications
You must be signed in to change notification settings - Fork 210
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 option to adjust load scale for each individual countries #1006
Add option to adjust load scale for each individual countries #1006
Conversation
scripts/build_demand_profiles.py
Outdated
logger.info(f"Load data scaled with scaling factor {scale}.") | ||
gegis_load["Electricity demand"] *= scale | ||
|
||
if scale is not None: |
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.
Great that you have thought about edge cases! However, not sure this particular check makes sense, as if scale
is not defined it would cause an error earlier, at
pypsa-earth/scripts/build_demand_profiles.py
Line 249 in d89a9a3
scale = snakemake.params.load_options["scale"] |
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.
I agree
Hello @virio-andreyana! An amazing idea and very nice implementation. I have only one comment on it. Otherwise, looks perfect 🙂 |
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.
Great contributions @virio-andreyana :D and very interesting indeed!
I've added few comments.
It would be great to have your opinion on this little changes :)
scripts/build_demand_profiles.py
Outdated
logger.info(f"Load data scaled with scaling factor {scale}.") | ||
gegis_load["Electricity demand"] *= scale | ||
|
||
if scale is not None: |
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.
I agree
scripts/build_demand_profiles.py
Outdated
gegis_load["Electricity demand"] *= scale | ||
|
||
if scale is not None: | ||
if isinstance(scale, dict): |
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.
It may be useful to have a "DEFAULT" code, as in some cases, we may like only to describe a subset of users.
In the case it is a dict, I'd read a "DEFAULT" code (with .get("DEFAULT", 1.0)) and use this value for all countries that are not in the list.
What do you think?
scripts/build_demand_profiles.py
Outdated
@@ -246,7 +257,7 @@ def upsample(cntry, group): | |||
load_paths = snakemake.input["load"] | |||
countries = snakemake.params.countries | |||
admin_shapes = snakemake.input.gadm_shapes | |||
scale = snakemake.params.load_options["scale"] | |||
scale = snakemake.params.load_options.get("scale") |
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.
We could do .get("scale", 1.0) to avoid the None case
Co-authored-by: Davide Fioriti <67809479+davide-f@users.noreply.github.com>
for more information, see https://pre-commit.ci
@virio-andreyana is next me. PR is ready to merge. |
Closes # (if applicable).
Changes proposed in this Pull Request
Add option to individually adjust load scale for each country. The code format in the config is the same as focus_weights.
Checklist
doc/configtables/*.csv
and line references are adjusted indoc/configuration.rst
anddoc/tutorial.rst
.doc/release_notes.rst
is amended in the format of previous release notes, including reference to the requested PR.