pywasp.wasp.interpolate_gwc
- pywasp.wasp.interpolate_gwc(gwc, /, output_locs, method='given', use_moments=True, engine='fortran')[source]
Spatially interpolate GWC data to a grid of locations.
- The interpolation is done in several steps:
Calculate the moments of the Weibull distribution from the A and k parameters.
Spatially interpolate the moments to the output locations.
Fit new A and k parameters from the interpolated moments.
The first and third moments as well as the frequency of wind speeds greater than the mean are used, corresponding to WASP methodology.
Warning
This function is experimental and its signature may change. The default engine is “fortran”, but this will be deprecated in the future and the default will be “windkit”.
- Parameters:
gwc (
Dataset
) – GWC datasetoutput_locs (
windkit.spatial.BBox
) – Output locationsmethod (
str
, optional) – Interpolation method. By default “given” Options are:“given” for using the given values in the GWC dataset (shapes must be the same)
“nearest” for nearest neighbor interpolation
“linear” for bilinear interpolation
“cubic” for bicubic interpolation
“natural” for natural neighbor interpolation
use_moments (
bool
) – Only used when the gwc is a geostrophic binned wind climate. Whether to use the moments in the binned wind climate for interpolation or interpolate the histogram directly using the specified ‘method’.engine (
{'windkit','fortran'}
) – Backend to use for interpolation.
- Returns:
Dataset
– Interpolated GWC dataset.- Raises:
ValueError – If the GWC and output locations do not have the same CRS.
ValueError – If the GWC contains any of “__m1__”, “__m3__”, “__fgtm__”. These are reserved for internal use.
ValueError – If the shape of GWC and output locations are not the same when method is “given”.
UserWarning – If the GWC is in geographic coordinates and method is “nearest”, “linear”, “cubic”, or “natural”. Interpolation in geographic coordinates can be inaccurate.