xoa.regrid.grid2loc

xoa.regrid.grid2loc(da, loc, compat='warn')[source]

Interpolate a gridded data array to random locations

da and loc must comply with CF conventions.

Parameters:
  • da (xarray.DataArray) – A data array with at least an horizontal rectilinear or a curvilinear grid.

  • loc (xarray.Dataset, xarray.DataArray, pandas.DataFrame) –

    A dataset or data array with coordinates as 1d arrays that share the same dimension. For example, such dataset may be initialized as follows:

    loc = xr.Dataset(coords={
        'lon': ('npts', [5, 6]),
        'lat': ('npts', [4, 5]),
        'depth': ('npts',  [-10, -20])
        })
    

  • compat ({"ignore", "warn"}) – In case a requested coordinate is not found in the input dataset.

Returns:

xarray.dataArray – The interpolated data array.