pysteps.utils.interpolate.idwinterp2d

Contents

pysteps.utils.interpolate.idwinterp2d#

pysteps.utils.interpolate.idwinterp2d(xy_coord, values, xgrid, ygrid, power=0.5, k=20, dist_offset=0.5, **kwargs)#

Inverse distance weighting interpolation of a sparse (multivariate) array.

Parameters:
  • xy_coord (ndarray) – Array of shape (n, 2) containing the coordinates of the data points in a 2-dimensional space.

  • values (ndarray) – Array of shape (n) or (n, m) containing the values of the data points, where n is the number of data points and m the number of co-located variables. All elements in values are required to be finite.

  • xgrid (ndarray) – 1-D arrays representing the coordinates of the 2-D output grid.

  • ygrid (ndarray) – 1-D arrays representing the coordinates of the 2-D output grid.

  • power (positive float, optional) – The power parameter used to compute the distance weights as weight = distance ** (-power).

  • k (positive int or None, optional) – The number of nearest neighbours used for each target location. If set to None, it interpolates using all the data points at once.

  • dist_offset (float, optional) – A small, positive constant that is added to distances to avoid zero values. It has units of pixels.

  • nchunks (int, optional) – Split and process the destination grid in nchunks. Useful for large grids to limit the memory footprint.

Returns:

output_array – The interpolated field(s) having shape (ygrid.size, xgrid.size) or (m, ygrid.size, xgrid.size).

Return type:

ndarray