windkit.io.windio.wind_turbines_to_windio#

windkit.io.windio.wind_turbines_to_windio(wind_turbines, wtgs=None, level='wind_farm')[source]#

Convert windkit wind_turbines dataset to windIO data structure.

Warning

windIO support is experimental. API may change in future versions.

Combines turbine layout positions with full WTG definitions to produce schema-valid windIO output. When exporting at the "wind_farm" level, wtgs is required so that the exported turbine_types contain the performance data mandated by the windIO turbine schema. For "layout" level, wtgs is not needed.

Parameters:
  • wind_turbines (xarray.Dataset) – Wind turbines dataset with point spatial structure.

  • wtgs (dict, optional) – Dictionary mapping wtg_key strings to WTG datasets. Required when level="wind_farm" (the default). Not needed for level="layout".

  • level (str) –

    Export level controlling what part of the windIO structure to return. Options:

    • ’wind_farm’: Wind farm dict with layouts and turbine_types (default)

    • ’layout’: Just the layout dict with coordinates and turbine_types

Returns:

Dictionary at the specified level of the windIO schema structure.

Return type:

dict

Raises:
  • ValueError – If level is not one of the valid options. If wtg_key values in wind_turbines are missing from wtgs dict.

  • TypeError – If wtgs is not a dict when required.

Examples

>>> import windkit as wk
>>> from windkit.io.windio.translate import wind_turbines_to_windio
>>> turbines = wk.create_wind_turbines_from_arrays(...)
>>> wtg = wk.read_wtg("turbine.wtg")
>>>
>>> # Wind farm dict (default)
>>> wind_farm = wind_turbines_to_windio(turbines, {"IEA_10MW": wtg})
>>>
>>> # Just the layout dict (wtgs not needed)
>>> layout = wind_turbines_to_windio(turbines, level="layout")