Improve error handling and robustness in turbine model loads#646
Merged
rafmudaf merged 15 commits intoNatLabRockies:developfrom May 5, 2023
Merged
Improve error handling and robustness in turbine model loads#646rafmudaf merged 15 commits intoNatLabRockies:developfrom
rafmudaf merged 15 commits intoNatLabRockies:developfrom
Conversation
This should always retain its data as input so that it can be propertly exported
Supporting passing a dict to a function that expects a filepath makes the calling code difficult to read. We should handle the types correctly instead.
This prevents errors when building up a dictionary to create Farm from code
7963ca9 to
0be8fe6
Compare
I guess I don’t know how to use Union…
0be8fe6 to
1c8dde0
Compare
RHammond2
reviewed
May 5, 2023
RHammond2
approved these changes
May 5, 2023
Collaborator
RHammond2
left a comment
There was a problem hiding this comment.
This looks good to me, especially the additional commentary on what's going on in each step. I was originally unsure of the change in control flow, but agree that with the expanded commentary it's worthwhile.
I would just add that one keyword argument, and then this is good to go from my perspective.
Collaborator
Author
|
Thanks for the reviews @RHammond2 @misi9170 @paulf81 |
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.
Redesign the turbine model loading routine to handle errors and be more robust
An issue was noted were the
!include turbine.yamlmethod of including a turbine model was failing. This was due to how the Farm class was supporting the various methods of loading a turbine model. Turbine definitions could be loaded in three ways:turbine_library_pathCurrently, if the second option is used, the
Farm.turbine_typeis a list of dictionaries. However, dictionaries cannot be hashed (i.e. compared) so the subsequentnp.uniquecommand in Farm's turbine loading fails. While it may have been possible to find a workaround, I decided to split the work to load the turbine definitions into distinct steps. This pull request does the following to Farm:Bonuses:
load_yamlfunction fail if the data given is invalidRelated issue
I don't see an open issue for this.
Impacted areas of the software
Primarily
farm.py. Other changes are cosmetic, related to removing JSON, or testingTest results, if applicable
All tests pass + new tests are added