Bug fix: erroneous rotation in turbine locations in horizontal flowfield plots#663
Bug fix: erroneous rotation in turbine locations in horizontal flowfield plots#663rafmudaf merged 5 commits intoNatLabRockies:developfrom Bartdoekemeijer:bugfix/plot_with_fi_rotation
Conversation
rafmudaf
left a comment
There was a problem hiding this comment.
Currently, we allow to pass yaw angles to plot_turbines_with_fi in order to rotate the lines plotted representing the turbines. However, plot_turbines does not take yaw angles so these two now have different functionality despite their intent to be equivalent. Also, note that both yaw angles and the wind direction are needed to rotate the yaw angles correctly. Somehow this difference between the two should be resolved, though I'm not sure what is best aside from finally dealing with how FLORIS handles yaw angles.
We could consider dropping plot_turbines in favor of the function requiring a FlorisInterface object for simplicity - it's the one I always use anyway.
|
I would favor the dropping plot_turbines, I also prefer the with_fi version. Also, just confirming I pulled this down and runs correctly on my machine |
|
That sounds good to me! We can maybe add a disclaimer when people run |
|
I like this approach, @rafmudaf? |
|
I agree. I'll make the change here. |
|
I've made the change suggested above. The warning message looks like this: Note I used the stdlib warnings module instead of the floris logging module because this is a specific Python idiom. See here for more info. |
|
And also here's a modified script to demo that includes a yawed leading turbine: import matplotlib.pyplot as plt
import numpy as np
import floris.tools.visualization as wakeviz
from floris.tools import FlorisInterface
from floris.tools.visualization import plot_turbines_with_fi
fi = FlorisInterface("inputs/gch.yaml")
fi.reinitialize(wind_directions=[245.0])
horizontal_plane = fi.calculate_horizontal_plane(height=90.0)
fig, ax = plt.subplots()
wakeviz.visualize_cut_plane(horizontal_plane, ax=ax, title="Horizontal")
yaw_angles = np.zeros((1,1,3))
yaw_angles[0,0,0] = 20
plot_turbines_with_fi(fi=fi, ax=ax, yaw_angles=yaw_angles)
wakeviz.show_plots() |
|
I've made note of this API change in #488. And with that, I'll go ahead and merge. Thanks for the fix @Bartdoekemeijer. |
Bug fix: Turbine locations in horizontal flow field plot
In the release version of FLORIS
v3.4, the turbine locations are always rotated with respect to the wind direction in functionsvisualization.plot_turbinesandvisualization.plot_turbines_with_fi. However, with the recent change in horizontal flow field plots #578 where the turbine locations remain fixed and instead the flow field rotates, this puts the turbines in the wrong locations in the plot.Related issue
N/A
Impacted areas of the software
Visualization.
Additional supporting information
Test results, if applicable
Here is a minimal script to reproduce the issue:
With the current

developbranch and FLORISv3.4, we find:With this Pull Request, we find:
