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 extrapolatedinput_site_effects (
xarray.Dataset) – Site effects for the input locationsoutput_site_effects (
xarray.Dataset) – Site effects for the output locationsconf (
Config) – PyWAsP configuration objectinterp_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. 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.output_mesoclimate (
xarray.Dataset, optional) – Mesoclimate at the output 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, return site factors along with the wind climate dataadd_met (
bool, optional) – If True, add meteorological fields to the wind climate databin_width (
float, default1.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 andn_gbinsare created between 0 and that value.n_wsbins_out (
int, optional) – Number of bins in the output wind speed histogram, which spans 0 ton_wsbins_out * bin_widthm/s. Defaults to 100, independently ofn_gbins, which sets the geostrophic resolution only. A too-short histogram raisesCoreErrorunlessallow_truncation=True.allow_truncation (
bool, defaultFalse) – Return a warned, raw subnormalized histogram. Requiresadd_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. WhenTrue(default, recommended), the effective convergence between input and output projections is computed automatically, minimising sector-resampling losses. PassFalseto 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_outbins of constant widthbin_width, so it spans 0 ton_wsbins_out * bin_widthm/s; the returned number of bins is the highest populated bin over all sectors. A too-short histogram raisesCoreErrorunlessallow_truncation=True; thenwsfreqis subnormalized and a warning is emitted.