pywasp.wasp.generalize#
- pywasp.wasp.generalize(bwc, topo_map, conf=None, gen_roughnesses=array([0., 0.03, 0.1, 0.4, 1.5]), gen_heights=array([10, 25, 50, 100, 200]), n_sectors=None, allow_multiple_heights=False, mesoclimate=None, mesoclimate_interp_method='nearest', return_site_effects=False, cfd_volume=None, n_gbins=500, rotate_to_true_north=False)[source]#
Generalizes the wind climate using either the BZ model or a CFD volume.
- Parameters:
bwc (
xarray.Dataset) – The binned wind climate to be generalized.topo_map (
TopographyMap) – The topographic map used to calculate site effects.conf (
pw.Config, optional) – The configuration object for the model, by default None.gen_roughnesses (
np.array, optional) – The roughness lengths for which the wind climate is generalized, by default [0, 0.03, 0.1, 0.4, 1.5]. Must contain at least two unique items.gen_heights (
np.array, optional) – The heights for which the wind climate is generalized, by default WAsP’s [10, 25, 50, 100, 200]. Must contain at least two unique items.n_sectors (
int, optional) – The number of sectors for the site effects, by default None.allow_multiple_heights (
bool, optional) – If True, allows multiple heights for the generalized wind climate, by default False.mesoclimate (
xarray.Dataset, optional) – Mesoclimate at the site locations, e.g. frompywasp.wasp.get_climate(). If None, it is looked up from the sources selected byconf, usingmesoclimate_interp_method. A supplied mesoclimate is matched by position, not by location or CRS: it needs one point per horizontal location, in the order in which the locations first appear, or one point per location and height, in the order of the points.get_climateon those locations gives exactly that.mesoclimate_interp_method (
str, optional) – Interpolation method for the mesoclimate lookup, by default ‘nearest’. Not applied to a supplied mesoclimate.return_site_effects (
bool, optional) – If True, returns the site factors along with the wind climate data, by default False.cfd_volume (
xarray.Datasetorlistofxarray.Datasets, defaultNone) – The CFD volume(s) used to calculate site effects, by default None.n_gbins (
int, optional) – The number of bins for the calculation of the geostrophic wind speed distribution, by default 500.rotate_to_true_north (
bool, optional) – Whether to rotate the input BWC wind directions from the projected grid reference frame to true north before generalizing. WhenFalse(default), no rotation is applied; the output GWC is in the input-grid reference frame and itswind_dir_crsattribute records the CRS so a subsequentdownscale_*call can reconstruct the effective rotation automatically. WhenTrue, the meridian convergence is computed on-the-fly from the site CRS and used to rotate the BWC to true north; the output GWC stores the geodetic (geographic) CRS WKT in thewind_dir_crsattribute.
- Returns:
gwc (
xarray.Dataset) – The generalized wind climate. Always contains awind_dir_crsattribute that records the reference frame of the stored wind directions: a geodetic/geographic CRS WKT string means a rotation was applied to true north; a projected CRS WKT string means the GWC is in that projection’s grid-north reference frame.- Raises:
PywaspError – If
mesoclimatecontains more than one independent height. Select one height or use point-specificheight(point).
Notes
The function first calculates the site effects using either the BZ model or a CFD volume. Then, it generalizes the wind climate from the site effects. CFD volume must be read using
wk.read_cfdres(). Depending on the value ofreturn_site_effects, it may also return the site factors.See tutorial 9 for an in-depth discussion of meridian convergence and direction reference frames in generalization. Key points:
Input
bwcmust have grid-relative wind directions. The defaultrotate_to_true_north=Falsekeeps the GWC in the input-grid reference frame and records that CRS inwind_dir_crs, whichdownscale_*uses to compute the minimal effective rotation automatically.TopographyMap.get_site_effects()automatically computes and attachesmeridian_convergencebased on the input locations’ projection.Set
rotate_to_true_north=Trueto rotate the BWC to true north during generalisation; the GWC will store the geodetic (geographic) CRS WKT inwind_dir_crsanddownscale_*will use the natural output-site MC directly. Meridian convergence is defined positive for a clockwise rotation, so it is added in the generalization step and subtracted in the downscaling step.