-
Notifications
You must be signed in to change notification settings - Fork 156
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
Collect all layout visualization tools in FLORIS #805
Conversation
Heads up the tests are still failing |
Its the examples, that is my bad, I'll get it |
I've added a small, indirectly related bugfix to this PR, introduced in #823: I noticed in a place where The solution I have was to allow the empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this now, but I do think @rafmudaf is right that the name of the file should be something more clearly to do with plotting/visualization than layout_functions.py. I've added a suggestion on that above.
|
||
def test_plotting_functions(): | ||
|
||
fi = FlorisInterface(configuration=YAML_INPUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include test for plot_turbines_rotors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this test, but it would also be good to test plot_farm_terrain
.
Also, I think I know the answer to this, but is there a better test available? It's good to run these functions, but as is this is only testing that the inputs are of the correct general data type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was a puzzle for me, since they end in a plot, my main thought was just to make sure the functions can run all the way through without erroring. I wasn't sure how to confirm if the plot is "right"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add the test for plot_farm_terrain, then merge you think if I do it tonight?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok great, done and merging!
Collect all layout visualization tools in FLORIS
Presently, tools for interrogating/plotting the layouts existing, sometimes in duplicate, across FLORIS and FLASC, and even within FLORIS, tools were duplicated between visualizations.py and layout_functions.py. The purpose of this pull request are pulling all the tools into one module (layout_functions.py) in FLORIS, and then importing into FLASC. This pull request also seeks to resolve Issue #804 by ensuring all functions accept turbine_names.
In this PR (and companion pull request in flasc (NREL/flasc#174)), functions are all moved to layout_functions.py, and their form and usage is standardized.
A new example (to be re-organized later (23_layout_visualizations is introduced). This example demonstrates the preferred usage of importing the layout_functions module as lf, and calling each function via lf.xxx().
In each case, either a pyplot axes is passed in or else a new one is created and returned. Also in each case, a FlorisInterface object is passed in to get the locations of the turbines.
The functions in layout_functions.py are intended to each implement one plotting action and can be called sequentially to add layers to the plot.
plot_turbine_points
: Plot turbines as points on axisplot_turbine_labels
: Label the turbines, in default case given FLORIS' 0-index value as a label, but can also accept provided turbine namesplot_turbines_rotors
: Indicate the turbine rotors (including yaw) on a plot. This is usually most useful for indicating turbine position onto flow visualizaitonsplot_waking_directions
Draw labeled lines in-between each turbine and label the distance (in D) and wind directions in which the turbines wake each other.shade_region
: Add a shaded region to an existing plot, can be useful to identify specific areas, or boundary boxes or phases/farmsplot_farm_terrain
: Use the hub-height information in FLORIS to make a contour plot of elevationAn example plotting script would be:
A small test module is started (layout_functions_test.py).
Finally, as shown in example above, we removed calls to plt.show() from within functions inside layout_functions.py and adopt a convention that this call should be made by user.
Related issue
#804