windkit.generalized_wind_climate.interpolate_gwc

windkit.generalized_wind_climate.interpolate_gwc(gwc, /, output_locs, method='linear')[source]

Spatially interpolate GWC data to a grid of locations.

The interpolation is done in several steps:
  1. Calculate the moments of the Weibull distribution from the A and k parameters.

  2. Spatially interpolate the moments to the output locations.

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

Parameters:
  • gwc (xr.Dataset) – GWC dataset.

  • output_locs (windkit.spatial.BBox) – Output locations.

  • method (str, optional) –

    Interpolation method. By default “linear”. Options are:

    • ”nearest” for nearest neighbor interpolation

    • ”linear” for bilinear interpolation

    • ”cubic” for bicubic interpolation

    • ”natural” for natural neighbor interpolation

    • ”given” for using the given values in the GWC dataset in this case the shapes of the output dataset and the GWC dataset must be the same.

Returns:

Interpolated GWC dataset.

Return type:

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