foxes.output.farm_results_eval.FarmResultsEval

class foxes.output.farm_results_eval.FarmResultsEval[source]

Bases: Output

Evaluates farm results data.

This sums over turbines and/or states, given the state-turbine farm_calc results.

Parameters:

farm_results (xarray.Dataset) – The farm results

results

The farm results

Type:

xarray.Dataset

__init__(farm_results)[source]

Methods

__init__(farm_results)

add_capacity([algo, P_nom, ambient, verbosity])

Adds capacity to the farm results

add_efficiency([verbosity])

Adds efficiency to the farm results

calc_farm_efficiency()

Calculates farm efficiency

calc_farm_mean(vars)

Calculates the mean over states and turbines.

calc_farm_sum(vars)

Calculates the sum over states and turbines.

calc_farm_yield([turbine_yield, power_uncert])

Calculates yield, P75 and P90 at the farm level

calc_mean_farm_power([ambient])

Calculates the mean total farm power.

calc_states_mean(vars)

Calculates the mean wrt states.

calc_states_std(vars)

Calculates the standard deviation wrt states.

calc_states_sum(vars)

Calculates the sum wrt states.

calc_turbine_mean(vars)

Calculates the mean wrt turbines.

calc_turbine_sum(vars)

Calculates the sum wrt turbines.

calc_turbine_yield([algo, annual, ambient, ...])

Calculates the yield per turbine

new(model_type, **kwargs)

Run-time output model factory.

print_models()

Prints all model names.

reduce_all(states_op, turbines_op)

Reduces states and turbine dimension by some operation

reduce_states(vars_op)

Reduces the states dimension by some operation

reduce_turbines(vars_op)

Reduces the turbine dimension by some operation

weinsum(rhs, *vars)

Calculates Einstein sum, adding weights as last argument to the given fields.

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

Writes data to file via pandas.

__init__(farm_results)[source]
add_capacity(algo=None, P_nom=None, ambient=False, verbosity=1)[source]

Adds capacity to the farm results

Parameters:
  • algo (foxes.core.Algorithm, optional) – The algorithm, for nominal power calculation

  • P_nom (list of float, optional) – Nominal power values for each turbine, if algo not given

  • ambient (bool, optional) – Flag for calculating ambient capacity, by default False

  • verbosity (int) – The verbosity level, 0 = silent

add_efficiency(verbosity=1)[source]

Adds efficiency to the farm results

Parameters:

verbosity (int) – The verbosity level, 0 = silent

calc_farm_efficiency()[source]

Calculates farm efficiency

Returns:

eff – The farm efficiency

Return type:

float

calc_farm_mean(vars)[source]

Calculates the mean over states and turbines.

Parameters:

vars (list of str) – The variables

Returns:

data – The fully contracted results

Return type:

dict

calc_farm_sum(vars)[source]

Calculates the sum over states and turbines.

Parameters:

vars (list of str) – The variables

Returns:

data – The fully contracted results

Return type:

dict

calc_farm_yield(turbine_yield=None, power_uncert=None, **kwargs)[source]

Calculates yield, P75 and P90 at the farm level

Parameters:
  • turbine_yield (pandas.DataFrame, optional) – Yield values by turbine

  • power_uncert (float, optional) – Uncertainty in the power value. Triggers P75 and P90 outputs

  • kwargs (dict, optional) – Parameters for calc_turbine_yield(). Apply if turbine_yield is not given

Returns:

  • farm_yield (float) – Farm yield result, same unit as turbine yield

  • P75 (float, optional) – The P75 value, same unit as turbine yield

  • P90 (float, optional) – The P90 value, same unit as turbine yield

calc_mean_farm_power(ambient=False)[source]

Calculates the mean total farm power.

Parameters:

ambient (bool) – Flag for ambient power

Returns:

data – The mean wind farm power

Return type:

float

calc_states_mean(vars)[source]

Calculates the mean wrt states.

Parameters:

vars (list of str) – The variables

Returns:

data – The results per turbine

Return type:

pandas.DataFrame

calc_states_std(vars)[source]

Calculates the standard deviation wrt states.

Parameters:

vars (_type_) – _description_

Returns:

_description_

Return type:

_type_

calc_states_sum(vars)[source]

Calculates the sum wrt states.

Parameters:

vars (list of str) – The variables

Returns:

data – The results per turbine

Return type:

pandas.DataFrame

calc_turbine_mean(vars)[source]

Calculates the mean wrt turbines.

Parameters:

vars (list of str) – The variables

Returns:

data – The results per state

Return type:

pandas.DataFrame

calc_turbine_sum(vars)[source]

Calculates the sum wrt turbines.

Parameters:

vars (list of str) – The variables

Returns:

data – The results per state

Return type:

pandas.DataFrame

calc_turbine_yield(algo=None, annual=False, ambient=False, hours=None, delta_t=None, P_unit_W=None)[source]

Calculates the yield per turbine

Parameters:
  • algo (foxes.core.Algorithm, optional) – The algorithm, for P_nominal lookup

  • annual (bool, optional) – Flag for returing annual results, by default False

  • ambient (bool, optional) – Flag for ambient power, by default False

  • hours (int, optional) – The duration time in hours, if not timeseries states

  • delta_t (np.datetime64, optional) – The time delta step in case of time series data, by default automatically determined

  • P_unit_W (float) – The power unit in Watts, 1000 for kW. Looked up in algorithm if not given

Returns:

A dataframe of yield values by turbine in GWh

Return type:

pandas.DataFrame

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.

reduce_all(states_op, turbines_op)[source]

Reduces states and turbine dimension by some operation

Parameters:
  • states_op (dict) – The states contraction operations. Key: str, the variable name. Value: str, the operation, choices are: sum, mean, min, max.

  • turbines_op (dict) – The turbines contraction operations. Key: str, the variable name. Value: str, the operation, choices are: sum, mean, min, max.

Returns:

data – The fully contracted results

Return type:

dict

reduce_states(vars_op)[source]

Reduces the states dimension by some operation

Parameters:

vars_op (dict) – The operation per variable. Key: str, the variable name. Value: str, the operation, choices are: sum, mean, min, max.

Returns:

data – The results per turbine

Return type:

pandas.DataFrame

reduce_turbines(vars_op)[source]

Reduces the turbine dimension by some operation

Parameters:

vars_op (dict) – The operation per variable. Key: str, the variable name. Value: str, the operation, choices are: sum, mean, min, max.

Returns:

data – The results per state

Return type:

pandas.DataFrame

weinsum(rhs, *vars)[source]

Calculates Einstein sum, adding weights as last argument to the given fields.

It’s all about treating NaN values.

Parameters:
  • rhs (str) – The right-hand side of the einsum expression. Convention: ‘s’ for states, ‘t’ for turbines

  • vars (tuple of str or np.ndarray) – The variables mentioned in the expression, but without the obligatory weights that will be added at the end

Returns:

result – The results array

Return type:

np.ndarray

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