windkit.io.wasp.parse_wtg_element#

windkit.io.wasp.parse_wtg_element(wtg, context='WTG element')[source]#

Parse an XML element for a wind turbine generator.

Only the .attrib / .find / .findall / .iter / .text subset of the ElementTree interface is used, so both lxml.etree and xml.etree.ElementTree elements are accepted.

Parameters:
  • wtg (lxml.etree._Element or xml.etree.ElementTree.Element) – The <WindTurbineGenerator> element.

  • context (str, optional) – Identifier used in error messages, typically the source file path.

Returns:

Dictionary with keys:

  • "name" : str, from the Description attribute

  • "manufacturer" : str or None

  • "reference_uri" : str or None

  • "rotor_diameter" : float

  • "control_system" : str or None, raw ControlSystem attribute (only written by files of FormatVersion 1.02 and later)

  • "format_version" : str

  • "lowest_compatible_format_version" : str or None

  • "suggested_heights" : ndarray, shape (n_heights,)

  • "comments" : str or None

  • "modes" : list of dict, one per PerformanceTable, each with the required "air_density", "wind_speed_cutin" and "wind_speed_cutout" floats; the optional "stationary_thrust_coefficient", "maximum_noise_level", "blade_pitch_angle", "low_speed_cutout", "high_speed_cutin", "data_status", "data_source", "reference_uri", "release_date" and "comments"; and the arrays "wind_speed", "power_output" and "thrust_coefficient". The arrays of different modes may differ in length.

Return type:

dict

Raises:

WindkitFileFormatError – If SuggestedHeights is absent, holds no Height elements, or holds one that is empty or not a number; if there is no PerformanceTable; if a required attribute (Description, RotorDiameter, FormatVersion) is absent or unparseable; or if FormatVersion is not a version number.