polartoolkit.resample_grid

Contents

polartoolkit.resample_grid#

resample_grid(grid, spacing=None, region=None, registration=None, **kwargs)[source]#

Resample a grid to a new spacing, region, and/or registration. Method of resampling depends on comparison with initial and supplied values for spacing, region, and registration. If initial values not supplied, will try and extract them from the grid.

Parameters:
  • grid (DataArray) – grid to resample

  • spacing (float | None) – new spacing for grid, by default None

  • region (tuple[float, float, float, float] | None) – new region for grid in format [xmin, xmax, ymin, ymax], by default None

  • registration (str | None) – new registration for grid, by default None

  • kwargs (dict[str, str])

Returns:

grid, either resampled or same as original depending on inputs. If no resampling, and supplied grid is a filepath, returns filepath.

Return type:

DataArray