Skip to content

PyPSA v1.1.x regression causes empty transmission statistics since at_port="all" by default #2121

@pworschischek-aggmag

Description

@pworschischek-aggmag

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

A PyPSA v1.1.x regression causes

flow = n.statistics.transmission(groupby=False, bus_carrier=carrier)

to return an empty series because at_port in transmission() changed its default from False (port 0 only) to None. When bus_carrier is specified, None now resolves to "all" ports — meaning p0 and p1 cancel each other out (opposite sign), summing to zero and being dropped. Result: empty Series.

I suposedly fixed it using at_port=[0]

flow = n.statistics.transmission(groupby=False, bus_carrier=carrier, at_port=[0])

and results show up again. I did not open the PR with a fix, because I suspect there are more places where transmission(...) is used.

Reproducible Example

running with pypsa < 1.1
n.statistics.transmission(groupby=False, bus_carrier=carrier)
# expected non-empty 

running with pypsa >= 1.1
n.statistics.transmission(groupby=False, bus_carrier=carrier)
# returns empty Series (bug)

running with pypsa >= 1.1
n.statistics.transmission(groupby=False, bus_carrier=carrier, at_port=[0])
# returns same as before v1.1

Expected Behavior

# with pypsa >= 1.1
n.statistics.transmission(groupby=False, bus_carrier=carrier, at_port=[0])

returns same as

# with pypsa < 1.1
n.statistics.transmission(groupby=False, bus_carrier=carrier)

Installed Versions

Details pypsa 1.1.2 pyhd8ed1ab_0 236.6 KiB conda https://conda.anaconda.org/conda-forge/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions