foxes.output.farm_layout.FarmLayoutOutput

class foxes.output.farm_layout.FarmLayoutOutput[source]

Bases: Output

Plot the farm layout

Parameters:
  • farm (foxes.WindFarm) – The wind farm

  • farm_results (xarray.Dataset, optional) – The wind farm calculation results

  • from_results (bool, optional) – Flag for coordinates from results data

  • results_state (int, optional) – The state index, for from_res

  • D (float, optional) – The rotor diameter, if not from data

farm

The wind farm

Type:

foxes.WindFarm

fres

The wind farm calculation results

Type:

xarray.Dataset

from_res

Flag for coordinates from results data

Type:

bool

results_state

The state index, for from_res

Type:

int

D

The rotor diameter, if not from data

Type:

float

__init__(farm, farm_results=None, from_results=False, results_state=None, D=None)[source]

Methods

__init__(farm[, farm_results, from_results, ...])

get_figure([color_by, fontsize, figsize, ...])

Creates farm layout figure.

get_layout_data()

Returns wind farm layout.

get_layout_dict()

Returns wind farm layout.

new(model_type, **kwargs)

Run-time output model factory.

print_models()

Prints all model names.

write(file_path, data[, format_col2var, ...])

Writes data to file via pandas.

write_csv([file_path])

Writes csv layout file.

write_json([file_path])

Writes xyh layout file.

write_plot([file_path, fontsize])

Writes the layout plot to file.

write_xyh([file_path])

Writes xyh layout file.

__init__(farm, farm_results=None, from_results=False, results_state=None, D=None)[source]
get_figure(color_by=None, fontsize=8, figsize=None, annotate=1, title=None, fig=None, ax=None, normalize_D=False, ret_im=False, bargs={}, **kwargs)[source]

Creates farm layout figure.

Parameters:
  • color_by (str, optional) – Set scatter color by variable results. Use “mean_REWS” etc for means, also min, max, sum. All wrt states

  • fontsize (int, optional) – Size of the turbine numbers

  • figsize (tuple, optional) – The figsize for plt.Figure

  • annotate (int, optional) – Turbine index printing, Choices: 0 = No annotation 1 = Turbine indices 2 = Turbine names

  • title (str, optional) – The plot title, or None for automatic

  • fig (matplotlib.pyplot.Figure, optional) – The figure object to which to add

  • ax (matplotlib.pyplot.Axis, optional) – The axis object, to which to add

  • normalize_D (bool) – Normalize x, y wrt rotor diameter

  • ret_im (bool) – Flag for returned image object

  • bargs (dict) – Arguments for boundary plotting

  • kwargs (dict, optional) – Parameters forwarded to matplotlib.pyplot.scatter

Returns:

  • ax (matplotlib.pyplot.Axis) – The axis object

  • im (matplotlib.pyplot.PathCollection, optional) – The image object

get_layout_data()[source]

Returns wind farm layout.

Returns:

The wind farm layout, shape: (n_turbines, 3) where the 3 represents x, y, h

Return type:

numpy.ndarray

get_layout_dict()[source]

Returns wind farm layout.

Returns:

The wind farm layout in dict format, as in json output

Return type:

dict

classmethod new(model_type, **kwargs)

Run-time output model factory.

Parameters:

model_type (string) – The selected derived class name

classmethod print_models()

Prints all model names.

classmethod write(file_path, data, format_col2var={}, format_dict={}, **kwargs)

Writes data to file via pandas.

The kwargs are forwarded to the underlying pandas writing function.

Parameters:
  • file_path (string) – The path to the output file

  • data (pandas.DataFrame) – The data

  • format_col2var (dict) – Mapping from column names to flappy variables, for formatting

  • format_dict (dict) – Dictionary with format entries for columns, e.g. {FV.P: ‘{:.4f}’}. Note that the keys are flappy variables

write_csv(file_path=None)[source]

Writes csv layout file.

Parameters:

file_path (str) – The file into which to plot, or None for default

write_json(file_path=None)[source]

Writes xyh layout file.

Parameters:

file_path (str) – The file into which to plot, or None for default

write_plot(file_path=None, fontsize=8, **kwargs)[source]

Writes the layout plot to file.

The kwargs are forwarded to self.get_figure

Parameters:
  • file_path (str) – The file into which to plot, or None for default

  • fontsize (int) – Size of the turbine numbers

write_xyh(file_path=None)[source]

Writes xyh layout file.

Parameters:

file_path (str) – The file into which to plot, or None for default