inverse_distance

metpy.gridding.inverse_distance(xp, yp, variable, grid_x, grid_y, r, gamma=None, kappa=None, min_neighbors=3, kind='cressman')[source]

Generate an inverse distance interpolation of the given points to a regular grid.

Values are assigned to the given grid using inverse distance weighting based on either [Cressman1959] or [Barnes1964]. The Barnes implementation used here based on [Koch1983].

Parameters
  • xp ((N, ) ndarray) – x-coordinates of observations.

  • yp ((N, ) ndarray) – y-coordinates of observations.

  • variable ((N, ) ndarray) – observation values associated with (xp, yp) pairs. IE, variable[i] is a unique observation at (xp[i], yp[i]).

  • grid_x ((M, 2) ndarray) – Meshgrid associated with x dimension.

  • grid_y ((M, 2) ndarray) – Meshgrid associated with y dimension.

  • r (float) – Radius from grid center, within which observations are considered and weighted.

  • gamma (float) – Adjustable smoothing parameter for the barnes interpolation. Default None.

  • kappa (float) – Response parameter for barnes interpolation. Default None.

  • min_neighbors (int) – Minimum number of neighbors needed to perform barnes or cressman interpolation for a point. Default is 3.

  • kind (str) – Specify what inverse distance weighting interpolation to use. Options: ‘cressman’ or ‘barnes’. Default ‘cressman’

Returns

img ((M, N) ndarray) – Interpolated values on a 2-dimensional grid

See also

inverse_distance_to_points()

Deprecated since version 0.9.0: Function has been renamed to inverse_distance_to_grid and will be removed from MetPy in 0.12.0.