Skip to content

feat: add plot tornado function and state mappers from spot check#66

Merged
merrielle merged 3 commits intodevelopfrom
tornadoPlot
Feb 13, 2020
Merged

feat: add plot tornado function and state mappers from spot check#66
merrielle merged 3 commits intodevelopfrom
tornadoPlot

Conversation

@merrielle
Copy link
Copy Markdown
Collaborator

@merrielle merrielle commented Jan 29, 2020

This code is adding the most useful bits from the most recent spot check notebooks. It has plotting code to gracefully show a horizontal bar graph with both positive and negative values. It also adds some dictionaries to help map state abbreviations to state names and also loadzones to states.
EDIT: The dictionaries have been moved to PreREISE.

download

Ideally the PR should be quick and easy. :)

@kasparm
Copy link
Copy Markdown
Contributor

kasparm commented Jan 31, 2020

The following test fails for me. Maybe I am doing something wrong:

postreise/plot/multi/tests/test_plot_pie.py ....                                                                                             [ 72%]
postreise/plot/multi/tests/test_plot_shortfall.py .........                                                                                  [ 83%]
postreise/plot/tests/test_plot_shadowprice.py .....FFFF                                                                                      [ 94%]
postreise/process/test/test_transfer.py ..                                                                                                   [ 96%]
postreise/tests/test_mocks.py ...                                                                                                            [100%]

===================================================================== FAILURES =====================================================================
_______________________________________________________ test_get_bus_legend_bars_and_labels ________________________________________________________

    def test_get_bus_legend_bars_and_labels():
        mock_split_points = [-1, 1, 2, 3, 4]
>       bars, labels = _get_bus_legend_bars_and_labels(mock_split_points, [''])
E       ValueError: too many values to unpack (expected 2)

postreise/plot/tests/test_plot_shadowprice.py:113: ValueError
________________________________________________ test_get_bus_legend_bars_and_labels_with_rounding _________________________________________________

    def test_get_bus_legend_bars_and_labels_with_rounding():
        mock_split_points = [-1, 1, 1.9999, 3, 4]
>       bars, labels = _get_bus_legend_bars_and_labels(mock_split_points, [''])
E       ValueError: too many values to unpack (expected 2)

postreise/plot/tests/test_plot_shadowprice.py:121: ValueError
_________________________________________ test_get_bus_legend_bars_and_labels_clamps_large_numbers_on_end __________________________________________

    def test_get_bus_legend_bars_and_labels_clamps_large_numbers_on_end():
        mock_split_points = [-500, 100, 200, 300, 400]
>       bars, labels = _get_bus_legend_bars_and_labels(mock_split_points, [''])
E       ValueError: too many values to unpack (expected 2)

postreise/plot/tests/test_plot_shadowprice.py:129: ValueError
______________________________________________ test_get_bus_legend_bars_and_labels_min_bar_len_is_one ______________________________________________

    def test_get_bus_legend_bars_and_labels_min_bar_len_is_one():
        mock_split_points = [-.9, .1, .2, .3, .4]
>       bars, labels = _get_bus_legend_bars_and_labels(mock_split_points, [''])
E       ValueError: too many values to unpack (expected 2)

postreise/plot/tests/test_plot_shadowprice.py:137: ValueError
======================================================= 4 failed, 80 passed in 4.82 seconds =======

@merrielle
Copy link
Copy Markdown
Collaborator Author

@kasparm Ben noticed that as well so I'm addressing it here #68

@victoriahunt
Copy link
Copy Markdown
Contributor

Is there a demo that shows how to use this? If not, I think would be helpful to add a quick demo.
Code for tornado plot working for me as it did above, except that in the above it has "zones" as label on the y axis, and there's no y axis (category) label currently. I think that's fine, but it was a difference. I noted that label is currently set to 'not visible'.

tornado_simple

@victoriahunt
Copy link
Copy Markdown
Contributor

the 3 tests in postreise/tests passed for me, but I also got deprecation warnings. I don't think these have to do with the tornado code at all, but I'm going to record them here for our collective memory:

image

@victoriahunt
Copy link
Copy Markdown
Contributor

4 of the 9 test in postreise/plot/tests failed for me. I'm still learning about testing - maybe it's an error on my side?

In summary, the tornado plot code seemed to work well for me and looked good in review, but these tests are not all passing.

tests_postreise_02_03_2020.pdf

@danielolsen
Copy link
Copy Markdown
Contributor

@victoriahunt I ran into the ipywidgets warning previously, and solved it by doing a pip upgrade on that package.

@merrielle
Copy link
Copy Markdown
Collaborator Author

@victoriahunt I added a demo notebook! I fixed the broken tests in this pr #68. It's already been merged so if you update PostREISE the tests in plot should all work. :)

@victoriahunt
Copy link
Copy Markdown
Contributor

All tests passed. Heads up that I did get 3 warnings on tests which were all the same issue and read as follows: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Mapping. Thanks for adding the demo.

Copy link
Copy Markdown
Contributor

@victoriahunt victoriahunt left a comment

Choose a reason for hiding this comment

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

Tornado plot will be useful and the demo is helpful in showing the basics of how it works. All tests are passing.

@merrielle merrielle merged commit 78b12e5 into develop Feb 13, 2020
@merrielle merrielle deleted the tornadoPlot branch February 13, 2020 20:04
@ahurli ahurli mentioned this pull request Mar 16, 2021
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.

4 participants