windkit.io.wasp.parse_gwc_element#
- windkit.io.wasp.parse_gwc_element(gwc, context='GWC element')[source]#
Parse a
RveaGeneralisedMeanWindClimateXML element.Only the
.tag/.attrib/.find/.findallsubset of the ElementTree interface is used, so bothlxml.etreeandxml.etree.ElementTreeelements are accepted.- Parameters:
gwc (lxml.etree._Element or xml.etree.ElementTree.Element) – The
RveaGeneralisedMeanWindClimateelement.context (str, optional) – Identifier used in error messages, typically the source file path.
- Returns:
Dictionary with keys:
"A": ndarray, shape (n_sectors, n_heights, n_roughnesses)"k": ndarray, same shape as A"wdfreq": ndarray, same shape as A, normalized along the sector axis (0-1)"sector": ndarray, shape (n_sectors,), sector centre angles in degrees"gen_roughness": ndarray, shape (n_roughnesses,)"gen_height": ndarray, shape (n_heights,)"coords": dict with"west_east","south_north","height"; the first two come from an embeddedRveaLatitudeLongitudeCoordinateand"height"is alwaysNone(the element does not carry one). Values areNonewhen absent."metadata": dict with"description"(theDescriptionattribute, orNonewhen absent)"barometric_reference": dict with the floats"source_elevation","source_elevation_temperature","surface_pressure"(Pa),"temperature_celcius","relative_humidity"(%) and"lapse_rate"(K/m,Nonebefore WAsP 12.6), fromBarometricReferenceData"stability_inputs": dict with arrays of shape (n_sectors,)"sector","mean_temp_scale_land","rms_temp_scale_land","mean_temp_scale_sea","rms_temp_scale_sea","mean_pblh_scale_land"and"mean_pblh_scale_sea", fromStabilityInputs"geostrophic_shear": dict with arrays of shape (n_sectors,)"sector","mean_dgdz"(1/s) and"mean_dgdz_dir"(degrees), fromGeostrophicShearRose
The last three are
Nonewhen the element does not carry them.- Return type:
- Raises:
WindkitFileFormatError – If a required attribute is missing or an attribute does not parse, or the stability inputs or geostrophic shear lack a sector or repeat one.
ValueError – If the element has another tag, holds no
WindAtlasWeibullWindRose, the grid size cannot be determined, a wind rose cannot be placed on the grid, a grid cell has no rose or more than one, or a rose lacks a sector or repeats one.WindkitFileFormatErrorsubclasses it.