Add visualization for LCOW and SEC breakdowns - #1848
Draft
kurbansitterley wants to merge 20 commits into
Draft
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…to create-lcow-breakdown-method
…to create-lcow-breakdown-method
This reverts commit b36b4c0.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes/Resolves:
maybe #1820
Summary/Motivation:
Plots that break down the LCOW into component parts (CAPEX + OPEX for each unit) has been done many times in publications that use WaterTAP. In addition to being a great way to visualize results, it is also a good "smell check" for your results when, despite the aggregate LCOW being reasonable, you can see what is making up the LCOW and if any unit is contributing too much/little.
Many users of WaterTAP likely do not have the plotting chops to make these visualizations themselves and might appreciate a method on the costing package that will do it for them.
Changes proposed in this PR:
This PR will add two methods to the WaterTAP costing package:
-
plot_LCOW_breakdown-
plot_SEC_breakdownEach of these will use the
add_flow_component_breakdownmethod that already exists to create stacked bar plots of the results for either metric. Each has similar keyword arguments that dictate the type of breakdown:byindicates if the breakdown should be made by each component (e.g., include each pump separately for a flowsheet with multiple pumps) or by the aggregate of all like units (e.g., combine all the pumps into one)separate_flowsis a bool that indicates whether the flows should be combined into the OPEX portion of the plot or plotted separatelyrelativeindicates whether or not the plot should be the fractional contribution of each component (e.g., % of total LCOW) or use the apparent valueOther keywords are:
save_asis the filename to save the figure astolis the tolerance to use when checking the calculated breakdown against the value on the flowsheetcolormapis the matplotlib colormap to use for the plotI will also say this loudly and clearly:
These are not meant to be publication-ready figures
These methods are meant to be "quick and dirty" and create simple visualizations as a starting point or troubleshooting tool for identifying where goofy costing results are coming from. I have also intentionally created these methods to not accept many keywords for customization and for many of the plotting decisions to be made for you (mostly by using matplotlib defaults). Adding too many ways for the user to customize the plot is a slippery slope.
Everyone (including myself) has their own tastes or "theory" for what makes a good visualization. I have intentionally tried to make these as vanilla as possible. I have included the
colormapkeyword only for the case where the defaulttab20is not sufficient to distinguish between components (which would be a pretty big flowsheet).Both of these methods return
fig, axso a savvy user can add further customizations if they desire.Lastly- I use the LSRRO flowsheet to test this functionality, so as part of this PR I added a
mainfunction to the LSRRO flowsheet and a test file.Here are a few examples:
MVC flowsheet
LSRRO
TODO:
relative=True, by="aggregate", separate_flows=FalseLegal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: