pywasp.wasp.predict_bwc_from_site_effects#

pywasp.wasp.predict_bwc_from_site_effects(bwc, input_site_effects, output_site_effects, conf=None, interp_method='nearest', input_mesoclimate=None, output_mesoclimate=None, mesoclimate_interp_method='nearest', return_site_effects=False, add_met=True, bin_width=1.0, n_gbins=500, n_wsbins_out=None, align_direction_crs=True, allow_truncation=False)[source]#

Creates a binned wind climate

Warning

This function is experimental and its signature may change.

Parameters:
  • bwc (xarray.Dataset) – xr.Dataset containing binned wind climate to be extrapolated

  • input_site_effects (xarray.Dataset) – Site effects for the input locations

  • output_site_effects (xarray.Dataset) – Site effects for the output locations

  • conf (Config) – PyWAsP configuration object

  • interp_method ({'given', 'nearest'}) – Interpolation method for mesoclimate, by default ‘given’. This requires the input points to be the same as the output points. ‘nearest’ uses nearest neighbour lookup for each output point.

  • input_mesoclimate (xarray.Dataset, optional) – Mesoclimate at the input (binned wind climate) 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.

  • output_mesoclimate (xarray.Dataset, optional) – Mesoclimate at the output 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, return site factors along with the wind climate data

  • add_met (bool, optional) – If True, add meteorological fields to the wind climate data

  • bin_width (float, default 1.0) – bin width in the output histogram.

  • n_gbins (int) – Number of bins in geostrophic wind climate. The maximum geostrophic wind is found from the input histogram and n_gbins are created between 0 and that value.

  • n_wsbins_out (int, optional) – Number of bins in the output wind speed histogram, which spans 0 to n_wsbins_out * bin_width m/s. Defaults to 100, independently of n_gbins, which sets the geostrophic resolution only. A too-short histogram raises CoreError unless allow_truncation=True.

  • allow_truncation (bool, default False) – Return a warned, raw subnormalized histogram. Requires add_met=False. The caller may normalize it explicitly for a conditional distribution.

  • align_direction_crs (bool, optional) – Whether to apply the grid-convergence direction correction. When True (default, recommended), the effective convergence between input and output projections is computed automatically, minimising sector-resampling losses. Pass False to skip any direction rotation.

Returns:

bwc (xarray.Dataset) – PyWAsP binned wind climate for the locations provided in output_site_effects

Raises:

PywaspError – If an input or output mesoclimate contains more than one independent height. Select one height or use point-specific height(point).

Notes

This function takes binned wind climates and predicts binned wind climates at other locations by first generalizing the input binned wind climate from local site effects (input_site_effects) using the WAsP methodology and then dowscaling at other locations with provided local site effects (output_site_effects).

The output histogram has n_wsbins_out bins of constant width bin_width, so it spans 0 to n_wsbins_out * bin_width m/s; the returned number of bins is the highest populated bin over all sectors. A too-short histogram raises CoreError unless allow_truncation=True; then wsfreq is subnormalized and a warning is emitted.