foxes.output.results_writer.ResultsWriter

class foxes.output.results_writer.ResultsWriter[source]

Bases: Output

Writes results farm data to file.

Parameters:
  • farm_results (xarray.Dataset, optional) – The farm results, if data is None

  • data (pandas.DataFrame, optional) – The data, if farm_results is None

data

The farm results

Type:

pandas.DataFrame

__init__(farm_results=None, data=None)[source]

Methods

__init__([farm_results, data])

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[, variables, ...])

Writes a csv file

__init__(farm_results=None, data=None)[source]
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, variables=None, turbine_names=False, verbosity=1, **kwargs)[source]

Writes a csv file

Parameters:
  • file_path (str) – Path the the csv file

  • variables (dict or list of str, optional) – The variables to be written. If a dict, then the keys are the foxes variables and the values the column names. If None, then all data will be written.

  • turbine_names (bool) – Use turbine names instead of turbine indices

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

  • kwargs (dict, optional) – Additional parameters for Output.write()