add_electricity: fix missing config key

This commit is contained in:
Fabian 2022-06-10 00:36:07 +02:00
parent 8cbe4e4f9d
commit c68aa028ff

View File

@ -610,7 +610,11 @@ if __name__ == "__main__":
if "estimate_renewable_capacities" not in snakemake.config['electricity']:
logger.warning("Missing key `estimate_renewable_capacities` under config entry `electricity`. "
"In future versions, this will raise an error. ")
"In future versions, this will raise an error. "
"Falling back to whether ``estimate_renewable_capacities_from_capacity_stats`` is in the config.")
if "estimate_renewable_capacities_from_capacity_stats" in snakemake.config['electricity']:
estimate_renewable_caps = {'enable': True, **snakemake.config['electricity']["estimate_renewable_capacities_from_capacity_stats"]}
else:
estimate_renewable_caps = {'enable': False}
if "enable" not in estimate_renewable_caps:
logger.warning("Missing key `enable` under config entry `estimate_renewable_capacities`. "
@ -620,7 +624,7 @@ if __name__ == "__main__":
logger.warning("Missing key `from_opsd` under config entry `estimate_renewable_capacities`. "
"In future versions, this will raise an error. "
"Falling back to whether `renewable_capacities_from_opsd` is non-empty.")
from_opsd = bool(snakemake.config["electricity"]["renewable_capacities_from_opsd"])
from_opsd = bool(snakemake.config["electricity"].get("renewable_capacities_from_opsd", False))
estimate_renewable_caps['from_opsd'] = from_opsd