Merge pull request #373 from PyPSA/snakemake-keys-followup

plot_summary: remove deprecated retrieve_snakemake_keys function
This commit is contained in:
Fabian Hofmann 2022-06-08 17:25:14 +02:00 committed by GitHub
commit 61f994783c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ Description
import os import os
import logging import logging
from _helpers import configure_logging, retrieve_snakemake_keys from _helpers import configure_logging
import pandas as pd import pandas as pd
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -170,12 +170,12 @@ if __name__ == "__main__":
attr='', ext='png', country='all') attr='', ext='png', country='all')
configure_logging(snakemake) configure_logging(snakemake)
paths, config, wildcards, logs, out = retrieve_snakemake_keys(snakemake) config = snakemake.config
summary = wildcards.summary summary = snakemake.wildcards.summary
try: try:
func = globals()[f"plot_{summary}"] func = globals()[f"plot_{summary}"]
except KeyError: except KeyError:
raise RuntimeError(f"plotting function for {summary} has not been defined") raise RuntimeError(f"plotting function for {summary} has not been defined")
func(os.path.join(paths[0], f"{summary}.csv"), config, out[0]) func(os.path.join(snakemake.input[0], f"{summary}.csv"), config, snakemake.output[0])