Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 20, 2024
1 parent fe35613 commit 1f520e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
5 changes: 3 additions & 2 deletions scripts/build_district_heat_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@
pop_layout["urban_ct_fraction"] = pop_layout.urban / pop_layout.ct.map(ct_urban.get)

# fraction of node that is urban
urban_fraction = (pop_layout.urban / pop_layout[["rural", "urban"]].sum(axis=1)).fillna(0)

urban_fraction = (
pop_layout.urban / pop_layout[["rural", "urban"]].sum(axis=1)
).fillna(0)

# maximum potential of urban demand covered by district heating
central_fraction = snakemake.config["sector"]["district_heating"]["potential"]
Expand Down
10 changes: 7 additions & 3 deletions scripts/build_energy_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,10 +1405,14 @@ def update_residential_from_eurostat(energy: pd.DataFrame) -> pd.DataFrame:
idees = build_idees(idees_countries)
else:
# e.g. UA and MD
logger.info(f"No IDEES data available for {countries} and years 2000-2015. Filling with zeros.")
logger.info(
f"No IDEES data available for {countries} and years 2000-2015. Filling with zeros."
)
years = range(2000, 2016)
idees = pd.DataFrame(
index=pd.MultiIndex.from_tuples([(country, year) for country in countries for year in years]),
index=pd.MultiIndex.from_tuples(
[(country, year) for country in countries for year in years]
),
columns=[
"passenger cars",
"passenger car efficiency",
Expand All @@ -1433,7 +1437,7 @@ def update_residential_from_eurostat(energy: pd.DataFrame) -> pd.DataFrame:
"thermal uses residential",
"thermal uses services",
],
data=0
data=0,
)

energy = build_energy_totals(countries, eurostat, swiss, idees)
Expand Down
6 changes: 4 additions & 2 deletions scripts/build_industrial_energy_demand_per_country_today.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
from functools import partial

import country_converter as coco
import pandas as pd
import numpy as np
import pandas as pd
from _helpers import set_scenario_config
from tqdm import tqdm

Expand Down Expand Up @@ -197,7 +197,9 @@ def add_non_eu28_industrial_energy_demand(countries, demand, production):

eu28_production = production.loc[countries.intersection(eu28)].sum()
if eu28_production.sum() == 0:
logger.info("EU production is zero. Fallback: Filling non EU28 countries with zeros.")
logger.info(
"EU production is zero. Fallback: Filling non EU28 countries with zeros."
)
eu28_energy = demand.groupby(level=1).sum()
eu28_averages = eu28_energy / eu28_production

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_industrial_energy_demand_per_node_today.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def build_nodal_industrial_energy_demand():
)
keys[mapping] = 0
key = keys.loc[buses, mapping].fillna(0)

demand = industrial_demand[country, sector]

outer = pd.DataFrame(
Expand Down

0 comments on commit 1f520e4

Please sign in to comment.