floris.layout_visualization#
Functions
|
Calculates the wind direction at which the wake of turbine i would impact turbine j. |
|
Adds a text label to a matplotlib line, with options to specify label placement. |
|
Creates a filled contour plot visualizing terrain-corrected wind turbine hub heights. |
|
Adds turbine labels to a turbine layout plot. |
|
Plots turbine layout from a FlorisModel object. |
|
Plots wind turbine rotors on an existing axes, visually representing their yaw angles. |
|
Plots lines representing potential waking directions between wind turbines in a layout. |
|
Shades a region defined by a set of vertices and optionally plots the vertices. |
- floris.layout_visualization.plot_turbine_points(fmodel, ax=None, turbine_indices=None, plotting_dict={})[source]#
Plots turbine layout from a FlorisModel object.
- Return type:
Axes
- Parameters:
fmodel (FlorisModel)
ax (Axes)
turbine_indices (List[int])
plotting_dict (Dict[str, Any])
- Args:
fmodel (FlorisModel): The FlorisModel object containing layout data. ax (plt.Axes, optional): An existing axes object to plot on. If None,
a new figure and axes will be created. Defaults to None.
- turbine_indices (List[int], optional): A list of turbine indices to plot.
If None, all turbines will be plotted. Defaults to None.
- plotting_dict (Dict[str, Any], optional): A dictionary to customize plot
- appearance. Valid keys include:
'color' (str): Turbine marker color. Defaults to 'black'.
'marker' (str): Turbine marker style. Defaults to '.'.
'markersize' (int): Turbine marker size. Defaults to 10.
'label' (str): Label for the legend. Defaults to None.
- Returns:
plt.Axes: The axes object used for the plot.
- Raises:
IndexError: If any value in turbine_indices is an invalid turbine index.
- floris.layout_visualization.plot_turbine_labels(fmodel, ax=None, turbine_names=None, turbine_indices=None, label_offset=None, show_bbox=False, bbox_dict={}, plotting_dict={})[source]#
Adds turbine labels to a turbine layout plot.
- Return type:
Axes
- Parameters:
fmodel (FlorisModel)
ax (Axes)
turbine_names (List[str])
turbine_indices (List[int])
label_offset (float)
show_bbox (bool)
bbox_dict (Dict[str, Any])
plotting_dict (Dict[str, Any])
- Args:
fmodel (FlorisModel): The FlorisModel object containing layout data. ax (plt.Axes, optional): An existing axes object to plot on. If None,
a new figure and axes will be created. Defaults to None.
- turbine_names (List[str], optional): Custom turbine labels. If None,
defaults to turbine indices (e.g., '000', '001'). Defaults to None.
- turbine_indices (List[int], optional): Indices of turbines to label.
If None, all turbines will be labeled. Defaults to None.
- label_offset (float, optional): Distance to offset labels from turbine
points (in meters). If None, defaults to rotor_diameter/8. Defaults to None.
- show_bbox (bool, optional): If True, adds a bounding box around each label.
Defaults to False.
- bbox_dict (Dict[str, Any], optional): Dictionary to customize the appearance
- of bounding boxes (if show_bbox is True). Valid keys include:
'facecolor' (str): Box background color. Defaults to 'gray'.
'alpha' (float): Opacity of box. Defaults to 0.5.
'pad' (float): Padding around text. Defaults to 0.1.
'boxstyle' (str): Box style (e.g., 'round'). Defaults to 'round'.
- plotting_dict (Dict[str, Any], optional): Dictionary to control text
- appearance. Valid keys include:
'color' (str): Text color. Defaults to 'black'.
- Returns:
plt.Axes: The axes object used for the plot.
- Raises:
IndexError: If any value in turbine_indices is an invalid turbine index. ValueError: If the length of turbine_names does not match the number of turbines.
- floris.layout_visualization.plot_turbine_rotors(fmodel, ax=None, color='k', wd=None, yaw_angles=None)[source]#
Plots wind turbine rotors on an existing axes, visually representing their yaw angles.
- Return type:
Axes
- Parameters:
fmodel (FlorisModel)
ax (Axes)
color (str)
wd (float)
yaw_angles (ndarray)
- Args:
fmodel (FlorisModel): The FlorisModel object containing layout and turbine data. ax (plt.Axes, optional): An existing axes object to plot on. If None,
a new figure and axes will be created. Defaults to None.
color (str, optional): Color of the turbine rotor lines. Defaults to 'k' (black). wd (float, optional): Wind direction (in degrees) relative to global reference.
If None, the first wind direction in fmodel.core.flow_field.wind_directions is used. Defaults to None.
- yaw_angles (np.ndarray, optional): Array of turbine yaw angles (in degrees). If None,
the values from fmodel.core.farm.yaw_angles are used. Defaults to None.
- Returns:
plt.Axes: The axes object used for the plot.
- floris.layout_visualization.get_wake_direction(x_i, y_i, x_j, y_j)[source]#
Calculates the wind direction at which the wake of turbine i would impact turbine j.
- Return type:
float
- Parameters:
x_i (float)
y_i (float)
x_j (float)
y_j (float)
- Args:
x_i (float): X-coordinate of turbine i (the upstream turbine). y_i (float): Y-coordinate of turbine i. x_j (float): X-coordinate of turbine j (the downstream turbine). y_j (float): Y-coordinate of turbine j.
- Returns:
- float: Wind direction in degrees (0-360) where 0 degrees represents wind
blowing from the north, and the angle increases clockwise.
- floris.layout_visualization.label_line(line, label_text, ax, near_i=None, near_x=None, near_y=None, rotation_offset=0.0, offset=(0, 0), size=7)[source]#
Adds a text label to a matplotlib line, with options to specify label placement.
- Return type:
None
- Parameters:
line (Line2D)
label_text (str)
ax (Axes)
near_i (int)
near_x (float)
near_y (float)
rotation_offset (float)
offset (Tuple[float, float])
size (int)
- Args:
line (matplotlib.lines.Line2D): The line object to label. label_text (str): The text of the label. ax (plt.Axes): The axes object where the line is plotted. near_i (int, optional): Index near which to place the label. Defaults to None. near_x (float, optional): X-coordinate near which to place the label. Defaults to None. near_y (float, optional): Y-coordinate near which to place the label. Defaults to None. rotation_offset (float, optional): Additional rotation for the label (in degrees).
Defaults to 0.0.
- offset (Tuple[float, float], optional): X and Y offset from the label position.
Defaults to (0, 0).
size (int, optional): Font size of the label. Defaults to 7.
- Raises:
- ValueError: If none of near_i, near_x, or near_y
are provided to determine label placement.
- floris.layout_visualization.plot_waking_directions(fmodel, ax=None, turbine_indices=None, wake_plotting_dict={}, D=None, limit_dist_D=None, limit_dist_m=None, limit_num=None, wake_label_size=7)[source]#
Plots lines representing potential waking directions between wind turbines in a layout.
- Return type:
Axes
- Parameters:
fmodel (FlorisModel)
ax (Axes)
turbine_indices (List[int])
wake_plotting_dict (Dict[str, Any])
D (float)
limit_dist_D (float)
limit_dist_m (float)
limit_num (int)
wake_label_size (int)
- Args:
fmodel (FlorisModel): Instantiated FlorisModel object containing layout data. ax (plt.Axes, optional): An existing axes object to plot on. If None, a new
figure and axes will be created. Defaults to None.
- turbine_indices (List[int], optional): Indices of turbines to include in the plot.
If None, all turbines are plotted. Defaults to None.
- wake_plotting_dict (Dict[str, Any], optional): Dictionary to customize the appearance
- of waking direction lines. Valid keys include:
'color' (str): Line color. Defaults to 'black'.
'linestyle' (str): Line style (e.g., 'solid', 'dashed'). Defaults to 'solid'.
'linewidth' (float): Line width. Defaults to 0.5.
- D (float, optional): Rotor diameter. Used for distance calculations if limit_dist_D
is provided. If None, defaults to the first turbine's rotor diameter.
- limit_dist_D (float, optional): Maximum distance between turbines (in rotor diameters)
to plot waking lines. Defaults to None (no limit).
- limit_dist_m (float, optional): Maximum distance (in meters) between turbines to plot
waking lines. Overrides limit_dist_D if provided. Defaults to None (no limit).
- limit_num (int, optional): Limits the number of waking lines plotted from each turbine
to the limit_num closest neighbors. Defaults to None (no limit).
- wake_label_size (int, optional): Font size for labels showing wake distance and direction.
Defaults to 7.
- Returns:
plt.Axes: The axes object used for the plot.
- Raises:
IndexError: If any value in turbine_indices is an invalid turbine index.
- floris.layout_visualization.plot_farm_terrain(fmodel, ax=None)[source]#
Creates a filled contour plot visualizing terrain-corrected wind turbine hub heights.
- Return type:
None
- Parameters:
fmodel (FlorisModel)
ax (Axes)
- Args:
fmodel (FlorisModel): The FlorisModel object containing layout data. ax (plt.Axes, optional): An existing axes object to plot on. If None, a new
figure and axes will be created. Defaults to None.
- floris.layout_visualization.shade_region(points, show_points=False, plotting_dict_region={}, plotting_dict_points={}, ax=None)[source]#
Shades a region defined by a set of vertices and optionally plots the vertices.
- Return type:
Axes
- Parameters:
points (ndarray)
show_points (bool)
plotting_dict_region (Dict[str, Any])
plotting_dict_points (Dict[str, Any])
ax (Axes)
- Args:
points (np.ndarray): A 2D array where each row represents (x, y) coordinates of a vertex. show_points (bool, optional): If True, plots markers at the specified vertices.
Defaults to False.
- plotting_dict_region (Dict[str, Any], optional): Customization options for shaded region.
- Valid keys include:
'color' (str): Fill color. Defaults to 'black'.
'edgecolor' (str): Edge color. Defaults to None (no edge).
'alpha' (float): Opacity (transparency) of the fill. Defaults to 0.3.
'label' (str): Optional label for legend.
- plotting_dict_points (Dict[str, Any], optional): Customization options for vertex markers.
- Valid keys include:
'color' (str): Marker color. Defaults to 'black'.
'marker' (str): Marker style (e.g., '.', 'o', 'x'). Defaults to None (no marker).
's' (float): Marker size. Defaults to 10.
'label' (str): Optional label for legend.
- ax (plt.Axes, optional): An existing axes object for plotting. If None, creates a new figure
and axes. Defaults to None.
- Returns:
plt.Axes: The axes object used for the plot.