[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-08-07 09:59:06 +00:00
parent 95903eeca7
commit 6a51a1d94e
3 changed files with 15 additions and 12 deletions

View File

@ -342,5 +342,5 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'https://docs.python.org/': ('https://docs.python.org/3', None),
"https://docs.python.org/": ("https://docs.python.org/3", None),
}

View File

@ -170,7 +170,7 @@ def eurostat_per_country(input_eurostat: str, country: str) -> pd.DataFrame:
sheet_name=None,
skiprows=4,
index_col=list(range(4)),
na_values=":"
na_values=":",
)
sheet.pop("Cover")
return pd.concat(sheet)
@ -499,9 +499,8 @@ def idees_per_country(ct: str, base_dir: str) -> pd.DataFrame:
assert df.index[9] == "Domestic"
assert df.index[10] == "International - Intra-EEAwUK"
ct_totals["total domestic aviation freight"] = df.iloc[[9,10]].sum()
ct_totals["total domestic aviation freight"] = df.iloc[[9, 10]].sum()
assert df.index[11] == "International - Extra-EEAwUK"
ct_totals["total international aviation freight"] = df.iloc[11]

View File

@ -172,14 +172,15 @@ ch_mapping = {
"Textil / Leder": "Textiles and leather",
"Papier / Druck": "Pulp, paper and printing",
"Chemie / Pharma": "Chemical industry",
"Zement / Beton": "Non-metallic mineral products",
"Zement / Beton": "Non-metallic mineral products",
"Andere NE-Mineralien": "Other non-ferrous metals",
"Metall / Eisen": "Iron and steel",
"NE-Metall": "Non Ferrous Metals",
"Metall / Geräte" : "Transport equipment",
"Metall / Geräte": "Transport equipment",
"Maschinen": "Machinery equipment",
"Andere Industrien": "Other industrial sectors",
}
"Andere Industrien": "Other industrial sectors",
}
def find_physical_output(df):
start = np.where(df.index.str.contains("Physical output", na=""))[0][0]
@ -191,11 +192,12 @@ def find_physical_output(df):
def get_energy_ratio(country, eurostat_dir, jrc_dir, year):
if country == "CH":
# data ranges between 2014-2023
e_country = pd.read_csv(snakemake.input.ch_industrial_production,
index_col=0).dropna()
e_country = pd.read_csv(
snakemake.input.ch_industrial_production, index_col=0
).dropna()
e_country = e_country.rename(index=ch_mapping).groupby(level=0).sum()
e_country = e_country[str(min(2019, year))]
e_country *= tj_to_ktoe
e_country *= tj_to_ktoe
else:
ct_eurostat = country.replace("GB", "UK")
# estimate physical output, energy consumption in the sector and country
@ -298,7 +300,9 @@ def separate_basic_chemicals(demand, year):
year_to_use = min(max(year, 2018), 2022)
if year_to_use != year:
logger.info(f"Year {year} outside data range. Using data from {year_to_use} for ammonia production.")
logger.info(
f"Year {year} outside data range. Using data from {year_to_use} for ammonia production."
)
demand.loc[there, "Ammonia"] = ammonia.loc[there, str(year_to_use)]
demand["Basic chemicals"] -= demand["Ammonia"]