interpolate_to_slice¶
-
metpy.interpolate.
interpolate_to_slice
(data, points, interp_type='linear')[source]¶ Obtain an interpolated slice through data using xarray.
Utilizing the interpolation functionality in
xarray
, this function takes a slice the given data (currently only regular grids are supported), which is given as anxarray.DataArray
so that we can utilize its coordinate metadata.- Parameters
data (
xarray.DataArray
orxarray.Dataset
) – Three- (or higher) dimensional field(s) to interpolate. The DataArray (or each DataArray in the Dataset) must have been parsed by MetPy and include both an x and y coordinate dimension.points ((N, 2) array_like) – A list of x, y points in the data projection at which to interpolate the data
interp_type (str, optional) – The interpolation method, either ‘linear’ or ‘nearest’ (see xarray.DataArray.interp() for details). Defaults to ‘linear’.
- Returns
xarray.DataArray
orxarray.Dataset
– The interpolated slice of data, with new index dimension of size N.
See also