[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
9b8139abbe
commit
156eccefb7
@ -1498,6 +1498,7 @@ def build_transformation_output_coke(eurostat, fn):
|
||||
df = eurostat.loc[slicer, :].droplevel(level=[2, 3, 4, 5])
|
||||
df.to_csv(fn)
|
||||
|
||||
|
||||
# %%
|
||||
if __name__ == "__main__":
|
||||
if "snakemake" not in globals():
|
||||
@ -1524,8 +1525,9 @@ if __name__ == "__main__":
|
||||
disable_progressbar=snakemake.config["run"].get("disable_progressbar", False),
|
||||
)
|
||||
|
||||
build_transformation_output_coke(eurostat,
|
||||
snakemake.output.transformation_output_coke)
|
||||
build_transformation_output_coke(
|
||||
eurostat, snakemake.output.transformation_output_coke
|
||||
)
|
||||
|
||||
swiss = build_swiss()
|
||||
idees = build_idees(idees_countries)
|
||||
|
@ -257,10 +257,12 @@ def add_coke_ovens(demand, fn, year, factor=0.75):
|
||||
"""
|
||||
|
||||
df = pd.read_csv(fn, index_col=[0, 1]).xs(year, level=1)
|
||||
df = df.rename(columns={'Total all products':'Total'})[fuels.keys()]
|
||||
df = df.rename(columns={"Total all products": "Total"})[fuels.keys()]
|
||||
df = df.rename(columns=fuels).T.groupby(level=0).sum().T
|
||||
df["other"] = df["all"] - df.loc[:, df.columns != "all"].sum(axis=1)
|
||||
df = df.T.reindex_like(demand.xs("Integrated steelworks", axis=1, level=1)).fillna(0)
|
||||
df = df.T.reindex_like(demand.xs("Integrated steelworks", axis=1, level=1)).fillna(
|
||||
0
|
||||
)
|
||||
sel = demand.columns.get_level_values(1) == "Integrated steelworks"
|
||||
demand.loc[:, sel] += factor * df.values
|
||||
|
||||
@ -294,8 +296,7 @@ if __name__ == "__main__":
|
||||
demand = demand.stack(future_stack=True).unstack(level=[0, 2])
|
||||
|
||||
# add energy consumption of coke ovens
|
||||
demand = add_coke_ovens(demand, snakemake.input.transformation_output_coke,
|
||||
year)
|
||||
demand = add_coke_ovens(demand, snakemake.input.transformation_output_coke, year)
|
||||
|
||||
# style and annotation
|
||||
demand.index.name = "TWh/a"
|
||||
|
Loading…
Reference in New Issue
Block a user