zoom_xarray#

metpy.calc.zoom_xarray(input_field, zoom, output=None, order=3, mode='constant', cval=0.0, prefilter=True)[source]#

Apply a spline interpolation to the data to effectively reduce the grid spacing.

This function applies scipy.ndimage.zoom to increase the number of grid points and effectively reduce the grid spacing over the data provided.

Parameters:
  • input_field (xarray.DataArray) – The 2D data array to be interpolated.

  • zoom (float or Sequence[float]) – The zoom factor along the axes. If a float, zoom is the same for each axis. If a sequence, zoom should contain one value for each axis.

  • order (int, optional) – The order of the spline interpolation, default is 3. The order has to be in the range 0-5.

  • mode (str, optional) – One of {‘reflect’, ‘grid-mirror’, ‘constant’, ‘grid-constant’, ‘nearest’, ‘mirror’, ‘grid-wrap’, ‘wrap’}. See scipy.ndimage.zoom documentation for details.

  • cval (float or int, optional) – See scipy.ndimage.zoom documentation for details.

  • prefilter (bool, optional) – See scipy.ndimage.zoom documentation for details. Defaults to True.

Returns:

zoomed_data (xarray.DataArray) – The zoomed input with its associated coordinates and coordinate reference system, if available.