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

feat: allow state method passthrough in MockScenario objects #503

Merged
merged 3 commits into from
Jun 17, 2021

Conversation

danielolsen
Copy link
Contributor

Pull Request doc

Purpose

Allow state method passthrough in MockScenario objects. Closes #434.

What the code is doing

  • in mock_analyze.py:
    • we add an exported_methods class attribute, which will be accessed by the logic in the MockScenario class.
    • we also add logic to accept and return storage_e data.
  • in mock_scenario.py:

Testing

Manual.

Usage Example/Visuals

>>> from powersimdata.tests.mock_scenario import MockScenario
>>> from powersimdata import Scenario
>>> demand = Scenario(599).get_demand()
>>> mock_scenario = MockScenario(demand=demand)
>>> mock_scenario.get_demand()
                         201      202      203  ...      214      215      216
UTC Time                                        ...
2016-01-01 00:00:00  14957.1  6735.53  4364.43  ...  4239.74  1766.76  606.157
2016-01-01 01:00:00  16112.7  7123.50  4546.56  ...  4599.10  1893.96  677.637
2016-01-01 02:00:00  17131.5  7689.84  4905.41  ...  4729.24  1900.99  706.230
2016-01-01 03:00:00  16985.6  7625.47  5225.50  ...  4580.75  1861.18  685.500
2016-01-01 04:00:00  16498.0  7366.67  5187.20  ...  4585.80  1816.51  664.056
...                      ...      ...      ...  ...      ...      ...      ...
2016-12-31 19:00:00  16357.0  7042.57  4447.70  ...  4391.56  1772.38  573.275
2016-12-31 20:00:00  16186.3  6958.31  4454.60  ...  4291.82  1731.52  574.705
2016-12-31 21:00:00  15841.4  6784.84  4369.54  ...  4180.42  1694.26  563.983
2016-12-31 22:00:00  15514.9  6573.87  4297.82  ...  4122.95  1663.71  563.983
2016-12-31 23:00:00  15422.6  6501.24  4244.10  ...  4157.27  1670.22  555.405

[8784 rows x 16 columns]

Time estimate

15 minutes.

@danielolsen danielolsen self-assigned this Jun 15, 2021
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.

Looks good.

@danielolsen danielolsen merged commit 26caf6b into develop Jun 17, 2021
@danielolsen danielolsen deleted the daniel/mock_scenario_passthrough branch June 17, 2021 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Mock objects to make it capable to take alias calls for scenario object
3 participants