Skip to content

Commit

Permalink
prepare for pypsa 0.32.0 (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkstrp authored Dec 10, 2024
1 parent 920ffb4 commit feaceab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- pip

# Inhouse packages
- pypsa>=0.31
- pypsa>=0.32
- atlite>=0.2.9
- linopy
- powerplantmatching>=0.5.15,<0.6
Expand Down
4 changes: 1 addition & 3 deletions scripts/make_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,12 @@ def calculate_prices(n, label, prices):


def calculate_weighted_prices(n, label, weighted_prices):

carriers = n.buses.carrier.unique()

for carrier in carriers:
grouper = n.statistics.groupers.get_bus_and_carrier
load = (
n.statistics.withdrawal(
groupby=grouper,
groupby=pypsa.statistics.groupers["bus", "carrier"],
aggregate_time=False,
nice_names=False,
bus_carrier=carrier,
Expand Down
10 changes: 5 additions & 5 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,7 @@ def add_heat(
# add resource
heat_carrier = f"{heat_system} {heat_source} heat"
n.add("Carrier", heat_carrier)
n.madd(
n.add(
"Bus",
nodes,
suffix=f" {heat_carrier}",
Expand All @@ -2196,7 +2196,7 @@ def add_heat(
else:
capital_cost = 0.0
lifetime = np.inf
n.madd(
n.add(
"Generator",
nodes,
suffix=f" {heat_carrier}",
Expand All @@ -2209,7 +2209,7 @@ def add_heat(
)

# add heat pump converting source heat + electricity to urban central heat
n.madd(
n.add(
"Link",
nodes,
suffix=f" {heat_system} {heat_source} heat pump",
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def add_heat(
.reindex(index=n.snapshots)
)
# add link for direct usage of heat source when source temperature exceeds forward temperature
n.madd(
n.add(
"Link",
nodes,
suffix=f" {heat_system} {heat_source} heat direct utilisation",
Expand All @@ -2248,7 +2248,7 @@ def add_heat(
p_nom_extendable=True,
)
else:
n.madd(
n.add(
"Link",
nodes,
suffix=f" {heat_system} {heat_source} heat pump",
Expand Down

2 comments on commit feaceab

@martinvagle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just downloaded a fresh clone, and tried to run:
snakemake all --configfile config/test/config.myopic.yaml
This one crashes at make_summary at line 548

Fix:
#Import
from pypsa.statistics import Groupers
at line 548
groupby=Groupers.get_bus_and_carrier,

@lkstrp
Copy link
Member Author

@lkstrp lkstrp commented on feaceab Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with this PR pypsa is pinned to >=0.32. You will need to update your environment (or preferably just install the new x-pinned.yaml).

Please sign in to comment.