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. from pywasp.wasp.get_climate(). If None, it is looked up from the sources selected by conf, using mesoclimate_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_climate on 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.Dataset or list of xarray.Datasets, default None) – 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. When False (default), no rotation is applied; the output GWC is in the input-grid reference frame and its wind_dir_crs attribute records the CRS so a subsequent downscale_* call can reconstruct the effective rotation automatically. When True, 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 the wind_dir_crs attribute.

Returns:

gwc (xarray.Dataset) – The generalized wind climate. Always contains a wind_dir_crs attribute 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 mesoclimate contains more than one independent height. Select one height or use point-specific height(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 of return_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 bwc must have grid-relative wind directions. The default rotate_to_true_north=False keeps the GWC in the input-grid reference frame and records that CRS in wind_dir_crs, which downscale_* uses to compute the minimal effective rotation automatically.

  • TopographyMap.get_site_effects() automatically computes and attaches meridian_convergence based on the input locations’ projection.

  • Set rotate_to_true_north=True to rotate the BWC to true north during generalisation; the GWC will store the geodetic (geographic) CRS WKT in wind_dir_crs and downscale_* 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.