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/.textsubset of the ElementTree interface is used, so bothlxml.etreeandxml.etree.ElementTreeelements 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 theDescriptionattribute"manufacturer": str or None"reference_uri": str or None"rotor_diameter": float"control_system": str or None, rawControlSystemattribute (only written by files ofFormatVersion1.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 perPerformanceTable, 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:
- Raises:
WindkitFileFormatError – If
SuggestedHeightsis absent, holds noHeightelements, or holds one that is empty or not a number; if there is noPerformanceTable; if a required attribute (Description,RotorDiameter,FormatVersion) is absent or unparseable; or ifFormatVersionis not a version number.