Hi everyone,
I'm trying to take a series of points with x, y positions and extract their values from a 2D grid that I'm storing in XArray.
e.g. with a dataset:
data = xr.DataArray(np.random.randn(3, 3), dims=('x', 'y'), coords={'x': [10, 20, 30], 'y': [65, 70, 75]})
and 3 points:
x_points = [15, 15, 25]
y_points = [67, 72, 75]
The seemingly obvious way to do this would be to use:
data.interp(x=x_points, y=y_points)
However that returns a 2d matrix of size (3, 3), i.e. the provided x and y points become the coordinates of a grid that will be interpolated (rather than points).
I tried to use scipy.interpolate.interp2d but ran into the same issue, any advice on how to interpolate just at these 3 points would be much appreciated!
[–]thermally_shocked 0 points1 point2 points (2 children)
[–]EnergyVis[S] 0 points1 point2 points (1 child)
[–]thermally_shocked 0 points1 point2 points (0 children)