pywasp.wasp.generalize_from_site_effects#

pywasp.wasp.generalize_from_site_effects(bwc, site_effects, conf=None, gen_roughnesses=array([0., 0.03, 0.1, 0.4, 1.5]), gen_heights=array([10, 25, 50, 100, 200]), allow_multiple_heights=False, mesoclimate=None, mesoclimate_interp_method='nearest', return_site_effects=False, n_gbins=500, rotate_to_true_north=False)[source]#

Creates a generalized wind climate

Parameters:
  • bwc (xarray.Dataset) – PyWAsP xr.Dataset containing wind climate to be generalized. Wind direction must be grid-relative (see below).

  • site_effects (xarray.Dataset) – Site effects dataset created from TopographyMap.rose_to_site_effects or TopographyMap.get_site_effects.

  • conf (Config) – PyWAsP configuration object

  • gen_roughnesses (numpy, optional) – 1D array of roughnesses for the generalization, by default [0,0.03,0.1,0.4,1.5]. Must contain at least two unique items.

  • gen_heights (numpy, optional) – 1D array of heights for the generalization, by default WAsP’s [10,25,50,100,200]. Must contain at least two unique items.

  • allow_multiple_heights (bool, optional) – Allowing multiple heights, by default False (single height permitted)

  • 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) – Include the site_effects in the output?

  • 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 stores the CRS WKT of that projection so a subsequent downscale_* call can compute the effective rotation automatically. When True, the meridian convergence attached by get_site_effects is used to rotate the BWC to true north; the output GWC stores the geodetic (geographic) CRS WKT in the wind_dir_crs attribute (true-north reference frame).

Returns:

gwc (xarray.Dataset) – PyWAsP generalized wind climate from the binned 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

Run WAsP’s generalize function to perform the “up” part of the WAsP framework. This will take the histogram data and convert it to a generalized wind climate at the provided roughnesses and heights above ground.

The resulting Generalized Wind Climate will have the same geospatial shape as the input binned wind climate.

If allow_multiple_heights is set to True result will be a separate generalized results from each tabfile height this means that user will need to determine which gwc to use for each height before running downscale

See tutorial 9 for discussion of meridian convergence 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.

  • 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.