Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: get bus_demand via Scenario method instead of import #328

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

danielolsen
Copy link
Contributor

Pull Request doc

Purpose

Get bus_demand via the Scenario.get_bus_demand() method instead of importing the get_bus_demand function, which is being removed in Breakthrough-Energy/PowerSimData#581. Closes #327.

Testing

Tested manually. With the PowerSimData branch for the PR installed:

>>> from powersimdata import Scenario
>>> from postreise.analyze.transmission.congestion import calculate_congestion_surplus
>>> calculate_congestion_surplus(Scenario(3873))
UTC
2016-10-01 00:00:00    272789.533136
2016-10-01 01:00:00    272558.733281
2016-10-01 02:00:00    252855.877419
2016-10-01 03:00:00    248522.565691
2016-10-01 04:00:00    231332.804519
                           ...
2016-10-31 19:00:00    519741.613030
2016-10-31 20:00:00    554901.191273
2016-10-31 21:00:00    533267.041210
2016-10-31 22:00:00    456426.344775
2016-10-31 23:00:00    416862.087360
Freq: H, Length: 744, dtype: float64

Time estimate

1 minute.

@danielolsen danielolsen added the bug Something isn't working label Feb 4, 2022
@danielolsen danielolsen self-assigned this Feb 4, 2022
@BainanXia
Copy link
Collaborator

Tests are failing due to black upgrade and functions calls from calculate_congestion_surplus which is as expected.

@danielolsen
Copy link
Contributor Author

Tests are failing due to black upgrade and functions calls from calculate_congestion_surplus which is as expected.

calculate_congestion_surplus fails because MockAnalyze doesn't have get_bus_demand! I need to add that to Breakthrough-Energy/PowerSimData#581 as well.

@danielolsen danielolsen force-pushed the daniel/get_bus_demand_fix branch from f5e67b4 to d2c6052 Compare February 4, 2022 20:23
@danielolsen
Copy link
Contributor Author

Tests have been updated to reflect the new expected behavior from Scenario.get_bus_demand for a Scenario in Analyze state. With the Breakthrough-Energy/PowerSimData#581 branch checked out, tests pass locally.

Copy link
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

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

All tests passed with the corresponding branch checked out.

@danielolsen danielolsen force-pushed the daniel/get_bus_demand_fix branch from d2c6052 to 1ec1edb Compare February 4, 2022 22:34
@danielolsen danielolsen merged commit 4a0da93 into develop Feb 4, 2022
@danielolsen danielolsen deleted the daniel/get_bus_demand_fix branch February 4, 2022 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling calculate_congestion_surplus on a partial-year Scenario causes an error
2 participants