Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xarray's interpolator behavior compared to scipy with a numpy array: new keyword behavior requested #5861

Open
rebeccaringuette opened this issue Oct 12, 2021 · 0 comments

Comments

@rebeccaringuette
Copy link

rebeccaringuette commented Oct 12, 2021

I'm having trouble with the differing behavior between giving an xarray object to scipy's interpolating functions (particularly the RegularGridInterpolator and the one xarray's interpn is based on) versus giving a numpy array. When giving the interpolator a numpy array, I get a 1D array returned with one value for every point given. When an xarray object is given instead, I get an N dimensional array, as if a np.meshgrid statement is executed on the given points. I have provided more detail at the link below. This differing return behavior and the additional demand for the calculation for a grid made from the points (rather than the points themselves) is much slower than the numpy approach, but I can't use numpy arrays for medium data (because it won't all fit in my memory). Can a feature be added, maybe a 'numpy-like' keyword, to xarray's version of the scipy interpolator to only execute for the points given rather than a grid made from the points? Such a keyword would enable backwards-compatibility and reduce the computational demand for those interested in interpolating along a curved trajectory (such as in my case).

Note: the same differing behavior occurs when I give scipy's RegularGridInterpolator an xarray object.

scipy/scipy#14824 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant