I am looking for a way to return the interpolated coordinate value of a variable at a query variable value. I think it is the opposite use to a normal interpolation/table-look up.
For example, here is a simple, normal interpolation, From this very good tutorial:
x_data = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
f = xr.DataArray(x_data**2, dims=['x'], coords={'x': x_data})
f.plot(marker='o')
So a standard lookup (e.g. f.interp(x=4.5)) would look for the value of the variable at some coordinate value of x. But I want to look for the value of the x where the variable is equal to some value. For example in the above plot, what is the value of x where the variable equals 20.
I am ultimately trying to do this for a 3D field of temperature (longitude x latitude x depth). So, how do I find the value of depth, where the temperature field is closest to a value that I specify.
Many thanks in advance.
