xhealpixify.interpolation.bilinear.bilinear_interpolation_weights#
- xhealpixify.interpolation.bilinear.bilinear_interpolation_weights(source_grid, target_grid, *, n_neighbors=6, metric='euclidean', coords=['longitude', 'latitude'], mask=None, min_vertices=3)#
xarray-aware bilinear interpolation weights computation
- Parameters:
source_grid (
xarray.Dataset) – The source grid. Has to have the coordinates specified bycoords.target_grid (
xarray.Dataset) – The target grid. Has to have the coordinates specified bycoords.n_neighbors (
int, default:6) – How many neighbors the to search for each target point. Minimum is 4, but with 6 the surrounding vertices are found more accurately.metric (
str, default:"euclidean") – The metric to use when find the nearest neighbors. Look at the value ofBallTree.valid_metricsfor the full list of metrics. Note that choosing metrics other than"euclidean"affects the neighbors search, but so far the weights computation itself happens in a euclidean space.coords (
listofstr, default:[``”longitude”, ``"latitude"]) – The names of the spatial coordinates in both the source and target grids.mask (
strorxarray.DataArray, optional) – If given, set the weight of input grid cells where the mask isFalseto 0. If astr, the variable of that name will be pulled from the source grid. If axarray.DataArray, has to have the same dimensions as the source grid.
- Returns:
weights (
xarray.DataArray) – The computed weights as a sparse matrix.