html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/191#issuecomment-454164740,https://api.github.com/repos/pydata/xarray/issues/191,454164740,MDEyOklzc3VlQ29tbWVudDQ1NDE2NDc0MA==,6815844,2019-01-14T21:17:37Z,2019-01-14T21:17:37Z,MEMBER,closed via #2104 ,"{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-454163673,https://api.github.com/repos/pydata/xarray/issues/191,454163673,MDEyOklzc3VlQ29tbWVudDQ1NDE2MzY3Mw==,5635139,2019-01-14T21:14:15Z,2019-01-14T21:14:15Z,MEMBER,@fujiisoup could we close this given your recent work,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-204440000,https://api.github.com/repos/pydata/xarray/issues/191,204440000,MDEyOklzc3VlQ29tbWVudDIwNDQ0MDAwMA==,1217238,2016-04-01T15:35:14Z,2016-04-01T15:35:14Z,MEMBER,"Yes, this like looks useful to me!
On Fri, Apr 1, 2016 at 7:32 AM, Stefan Pfenninger notifications@github.com
wrote:
> I've written a wrapper around scipy's map_coordinates. I cleaned this up
> a bit and pushed it here: sjpfenninger@0e0d88d
> https://github.com/sjpfenninger/xray/commit/0e0d88d6dc6f428d24ae3df2161ff10deded2a5a
>
> It's not exactly fully-featured but scratches the itch I had, which is to
> pass DataArrays through map_coordinates with support for xarray's
> coordinates.
>
> @shoyer https://github.com/shoyer If this seems of use, I could add
> some tests and perhaps an example, then submit a pull request?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub
> https://github.com/pydata/xarray/issues/191#issuecomment-204418102
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-150733056,https://api.github.com/repos/pydata/xarray/issues/191,150733056,MDEyOklzc3VlQ29tbWVudDE1MDczMzA1Ng==,1217238,2015-10-24T01:31:32Z,2015-10-24T01:31:32Z,MEMBER,"@saulomeirelles I don't have any progress to share on this issue. If this issue is important to you, contributions would be gratefully accepted!
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-50437246,https://api.github.com/repos/pydata/xarray/issues/191,50437246,MDEyOklzc3VlQ29tbWVudDUwNDM3MjQ2,1217238,2014-07-29T05:56:26Z,2014-07-29T05:57:36Z,MEMBER,"Actually, I'm thinking now that we could probably (theoretically) fit all interpolation strategies into a single `interpolate` method, where the specific type of interpolation (e.g., grid -> grid, grid -> unstructured, unstructured -> grid) is selected based on the shape of source and destination.
That said... perhaps its better to stick with a simpler function for now and we can figure out the bigger picture later. Looking at all the scipy functions, there are a lot of hypothetical options and I'm not sure which we'd want to keep in the final method. Also, kitchen sink type functions (e.g., `pandas.DataFrame.plot`) are not necessarily well-advised.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-50425930,https://api.github.com/repos/pydata/xarray/issues/191,50425930,MDEyOklzc3VlQ29tbWVudDUwNDI1OTMw,1217238,2014-07-29T01:56:53Z,2014-07-29T05:48:55Z,MEMBER,"So I would definitely still wrap the scipy functions for any interpolation routines for xray. It's not worth rewriting any of them twice! Scipy is an optional dependency for xray, but it would be fine to require it for the interpolation routines.
Yes, there do seems to be a few different interpolation routines in scipy. Naming the function you're thinking of something like `xray.interpolation.map_coordinates` would leave plenty of room for alternative interpolation methods.
In xray, we have DataArray objects (corresponding to a particular variable in a netCDF file along with its coordinates) as well as Datasets (corresponding to entire netCDFs). I think it makes a bit more sense to interpolate individual variables, so I guess you would want this function to have a signature something like the following:
```
Parameters
------------
source : DataArray
Gridded source data.
destination : ndarray or dict-like (e.g., xray.Dataset or pandas.DataFrame)
Array of points of points to sample at (n_obs * n_dim)
or mapping from dimension names to coordinate values.
order : int, optional
mode : {'constant', 'nearest'}, optional
cval : scalar, optional
Maybe defaulting to NaN instead of 0?
Returns
---------
interpolated : DataArray
Data array with interpolated values. Coordinates and
dimensions are copied from points.
```
You don't need to necessarily handle all the edge cases of possible input to `destination`, but it would be nice to handle destinations with labeled dimensions (e.g., in the form of a dictionary or xray.Dataset), and return labeled data in the form of an xray DataArray, with the same coordinate values (if they were supplied).
The DataArray constructor isn't in the currently released version of xray but it will be a major feature of the next release (hopefully to be released in a week or two) and it might be worth using here. It should be clearly documented in the docstring of `DataArray.__init__` but let me know if you have any questions.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807
https://github.com/pydata/xarray/issues/191#issuecomment-50296450,https://api.github.com/repos/pydata/xarray/issues/191,50296450,MDEyOklzc3VlQ29tbWVudDUwMjk2NDUw,1217238,2014-07-28T03:07:04Z,2014-07-28T03:07:04Z,MEMBER,"Hi Richard,
Your question is actually very timely. We don't have any routines yet to do interpolation, although one of my colleagues (not sure if he's on GitHub) was looking into 1-dimensional interpolation last week.
A contribution to add interpolation to xray would certainly be very welcome!
I would not recommend wrapping the pandas routines -- they just use their own wrapper over scipy and only interpolate in 1D. They also have somewhat unusual API -- they support interpolation only to fill in missing values (marked with `NaN`).
Scipy has a wide variety of [interpolation options](http://docs.scipy.org/doc/scipy/reference/interpolate.html), most of which I have not used. I'm guessing you're most immediately interested in doing something with map_coordinates? What were you thinking for the function signature?
As for where to put it, we have two options:
1. Add a method `DataArray.interpolate`.
2. If we don't think we can come up with a generic enough API to hold all interpolation strategies in a single method (quite likely!), add a new module `xray.interpolation`.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,38849807