regrid#

regridding.regrid(coordinates_input, coordinates_output, values_input, values_output=None, axis_input=None, axis_output=None, method='multilinear', perturb=None)[source]#

Regrid an array of values defined on a logically-rectangular curvilinear grid onto a new logically-rectangular curvilinear grid.

Parameters:
  • coordinates_input (tuple[ndarray, ...]) – Coordinates of the input grid.

  • coordinates_output (tuple[ndarray, ...]) – Coordinates of the output grid. Should have the same number of coordinates as the input grid.

  • values_input (ndarray) – Input array of values to be resampled.

  • values_output (None | ndarray) – Optional array in which to place the output.

  • axis_input (None | int | Sequence[int]) – Logical axes of the input grid to resample. If None, resample all the axes of the input grid. The number of axes should be equal to the number of coordinates in the input grid.

  • axis_output (None | int | Sequence[int]) – Logical axes of the output grid corresponding to the resampled axes of the input grid. If None, all the axes of the output grid correspond to resampled axes in the input grid. The number of axes should be equal to the number of coordinates in the output grid.

  • method (Literal['multilinear', 'conservative']) – The type of regridding to use. The conservative method uses the algorithm described in Ramshaw[1].

  • perturb (None | bool) – Whether to perturb coordinates_output by a small value to avoid degenerate grids. This is helpful for some methods, like conservative, which sometimes cannot handle degenerate grids. If None (the default), no perturbation is applied unless method is conservative and the dimensions of the grid are 2D or higher. If True, each point is perturbed using a normal distribution with standard deviation equal to 1e-9 of the grid width.

Return type:

ndarray

References