windkit.spatial.interp_unstructured

windkit.spatial.interp_unstructured(obj, west_east=None, south_north=None, height=None, method='linear', **kwargs)[source]

Interpolate spatially from unstructured dataset/dataarray to new coordinates.

Parameters:
  • obj (xarray.Dataset or xarray.DataArray) – Source dataset/dataarray with spatial coordinates. Can be a cuboid, stacked_point or point. Must have the same crs as the west_east, south_north and height coordinates provided.

  • west_east (xarray.DataArray, optional) – Target dataarray with spatial coordinates. Can be in cuboid, stacked_point or point structure

  • south_north (xarray.DataArray, optional) – Target dataarray with spatial coordinates. Can be in cuboid, stacked_point or point structure

  • height (xarray.DataArray, optional) – Target dataarray with spatial coordinates. Can be in cuboid, stacked_point or point structure

  • method (str, optional) – Interpolation method. Must be ‘nearest’, ‘linear’, ‘cubic’, or ‘natural. Default is ‘linear’

  • **kwargs (dict) – Keyword arguments passed to interpolation function

Returns:

Interpolated dataset/dataarray with spatial coordinates provided.

Return type:

xarray.Dataset or xarray.DataArray

Raises:
  • ValueError – If obj is not an xarray.Dataset or xarray.DataArray

  • ValueError – If any of the coordinates in coords_kwargs are not xarray.DataArray

  • ValueError – If any of the coordinates in coords_kwargs are not in obj

Warning

If any of the variables in obj are not numeric, they will be skipped and a warning will be raised.