Skip to content

bar generation stack plot#262

Merged
BainanXia merged 3 commits intodevelopfrom
bainan/bar_generation_stack
Apr 19, 2021
Merged

bar generation stack plot#262
BainanXia merged 3 commits intodevelopfrom
bainan/bar_generation_stack

Conversation

@BainanXia
Copy link
Copy Markdown
Collaborator

@BainanXia BainanXia commented Apr 14, 2021

Pull Request doc

Purpose

Integrate another plot function from NREL seam study visualizations, which addresses #258: generation stack bar plot with any number of scenarios side by side. This might be helpful during the training session.

What the code is doing

  • Implement plot function plot_bar_generation_stack.
  • Add demo notebook for the new plot function.
  • Add tests for input validations of the new plot function.

Testing

Tests for input validations are added in postreise/plot/tests/test_plot_bar_generation_stack.py
The plot function calls existing functions in analyze module for calculations.

Where to look

/postreise/plot/plot_bar_generation_stack.py
/postreise/plot/tests/test_plot_bar_generation_stack.py
/postreise/plot/demo/plot_bar_generation_stack_demo.ipynb

Usage Example/Visuals

Demos can be found in the demo notebook.

Time estimate

15 min.

@BainanXia BainanXia added the visualization Issue related to visualization label Apr 14, 2021
@BainanXia BainanXia added this to the CherryBlossoms milestone Apr 14, 2021
@BainanXia BainanXia self-assigned this Apr 14, 2021
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py Outdated
Comment thread postreise/plot/plot_bar_generation_stack.py
if t2l:
type2label.update(t2l)
if t2hc:
type2hatchcolor.update(t2hc)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are we going to compare scenarios using different grid model? If yes, we could move the above lines (starting where we create an instance of ModelImmutables) in the for loop on the scenario to get the each scenario grid model pre-defined type2color, etc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point. We can definitely compare scenarios created by different models for this figure. Will do so.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@rouille Actually, this might cause implicit conflicts as well. For example, we have two scenarios created by usa_tamu and hifld model respectively. They have different default colors for 'wind' resource. If we put two such scenarios in a list to show the generation stack bars side by side, the colors are going to be overwritten by the model of the last scenario in the list.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Given mi here is just for loading default color dicts, I suggest to keep it in its current form, i.e. always pick the default colors for the model of the first scenario in the list. We can still have scenarios with different models side by side using the default color scheme defined by the first scenario (the user can overwrite them all by these keyword arguments) as long as they have same areas which won't break area_to_loadzone as you mentioned below, otherwise, an "invalid area" error will be raised.

patches = []
fuels = []
bottom = 0
loadzone_set = area_to_loadzone(s.info["grid_model"], area, area_type)
Copy link
Copy Markdown
Collaborator

@rouille rouille Apr 19, 2021

Choose a reason for hiding this comment

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

I guess that it will break here if we have scenarios that have different grid model since an area might be defined in one grid model but not in another, e.g, Bay Area is a load zone in usa_tamu but not in hifld.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I guess that it will break here if we have scenarios that have different grid model since an area might be defined in one grid model but not in another, e.g, Bay Area is a load zone in usa_tamu but not in hifld.

Yeah, I think it should be fine to break here by printing out "invalid area" from area_to_loadzone function to let the user know a specific area is not available for a particular grid_model?

@BainanXia BainanXia force-pushed the bainan/bar_generation_stack branch from 526a409 to 78fb038 Compare April 19, 2021 18:18
Copy link
Copy Markdown
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

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

Very nice. Thanks.

@BainanXia BainanXia merged commit 00902c2 into develop Apr 19, 2021
@BainanXia BainanXia deleted the bainan/bar_generation_stack branch April 19, 2021 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

visualization Issue related to visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants