# Multi-height wind dataΒΆ

In this example we explore the calculation of multi-height wind data, as for example obtained from WRF results or downloaded from the NEWA website at a single point.

Here we will use the static data file WRF-Timeseries-4464.csv.gz that is part of the foxes static data. It has the following data structure:

Time,WS-50,WS-75,...,WS-500,WD-50,WD-75,...,WD-500,TKE-50,TKE-75,...,TKE-500,RHO
2009-01-01 00:00:00,7.37214,7.42685,...,1.28838
...
2009-01-31 23:50:00,10.27767,10.36368,...,1.30095


The time stamp column marks one month in 10 minute steps, and the wind speed (WS), wind direction (WD) and turbulent kinetic energy (TKE) are provided at 8 heights between 50 and 500 m. The air density (RHO) does not have height dependency but varies with time.

The basic assumption of this example is that we can calculate our wind farm results based on this data, i.e., that the horizontal variation can be neglected (for completely heterogeneous inflow data, see the corresponding example).

These are the imports for this example:

In [1]:

import matplotlib.pyplot as plt
from plotly.offline import iplot

import foxes
import foxes.variables as FV


First, we setup the model book and the wind farm. We choose 5 turbines in a row:

In [2]:

# Create model book:
mbook = foxes.ModelBook()

# create wind farm, a single row of turbines:
farm = foxes.WindFarm()
farm=farm,
xy_base=[0.0, 0.0],
xy_step=[600.0, 0.0],
n_turbines=5,
turbine_models=["NREL5MW"],
H=200.,
verbosity=0,
)

ax = foxes.output.FarmLayoutOutput(farm).get_figure(figsize=(5,3))
plt.show()


Note that we manually change the hub height from 90 m to 200 m here. Next, we create the states based on the static data file WRF-Timeseries-4464.csv.gz:

In [3]:

states = foxes.input.states.MultiHeightTimeseries(
data_source="WRF-Timeseries-4464.csv.gz",
output_vars=[FV.WS, FV.WD, FV.TI, FV.RHO],
var2col={},
heights=[50, 75, 90, 100, 150, 200, 250, 500],
fixed_vars={FV.TI: 0.05},
)

o = foxes.output.StatesRosePlotOutput(states, point=[0., 0., 100.])
fig = o.get_figure(16, FV.AMB_WS, [0, 3.5, 6, 10, 15, 20])
iplot(fig)