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 Jan 6, 2025
1 parent 50be5d6 commit 8e04539
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
update_config_from_wildcards,
)
from add_electricity import sanitize_carriers
from build_energy_totals import cartesian
from definitions.heat_system import HeatSystem
from prepare_sector_network import cluster_heat_buses, define_spatial, prepare_costs
from build_energy_totals import cartesian

logger = logging.getLogger(__name__)
cc = coco.CountryConverter()
Expand Down Expand Up @@ -87,7 +87,9 @@ def add_existing_renewables(df_agg, costs):
gen_i = n.generators.query("carrier == @carrier").index
carrier_gens = n.generators.loc[gen_i]
res_capacities = []
for country, group in carrier_gens.groupby(carrier_gens.bus.map(n.buses.country)):
for country, group in carrier_gens.groupby(
carrier_gens.bus.map(n.buses.country)
):
fraction = group.p_nom_max / group.p_nom_max.sum()
res_capacities.append(cartesian(df.loc[country], fraction))
res_capacities = pd.concat(res_capacities, axis=1).T
Expand Down
6 changes: 1 addition & 5 deletions scripts/solve_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ def add_land_use_constraint(n):
]:
ext_i = (n.generators.carrier == carrier) & ~n.generators.p_nom_extendable
grouper = n.generators.loc[ext_i].index.str.split(" ").str[:3].str.join(" ")
existing = (
n.generators.loc[ext_i, "p_nom"]
.groupby(grouper)
.sum()
)
existing = n.generators.loc[ext_i, "p_nom"].groupby(grouper).sum()
existing.index += " " + carrier + "-" + snakemake.wildcards.planning_horizons
n.generators.loc[existing.index, "p_nom_max"] -= existing

Expand Down

0 comments on commit 8e04539

Please sign in to comment.