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/3252#issuecomment-583083189,https://api.github.com/repos/pydata/xarray/issues/3252,583083189,MDEyOklzc3VlQ29tbWVudDU4MzA4MzE4OQ==,81219,2020-02-06T19:59:29Z,2020-02-06T21:21:26Z,CONTRIBUTOR,"@shoyer I'm having trouble wrapping my head around this. The example above is essentially a 1D interpolation over `y`, a coordinate selection over `x`, and a broadcast over `z`. I don't think it should interpolate over x, right ?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-582987147,https://api.github.com/repos/pydata/xarray/issues/3252,582987147,MDEyOklzc3VlQ29tbWVudDU4Mjk4NzE0Nw==,1217238,2020-02-06T16:26:11Z,2020-02-06T16:26:11Z,MEMBER,"I recently wrote a version of scipy.ndimage.map_coordinates for JAX in pure
NumPt that I think could be straightforwardly ported into xarray.
On Thu, Feb 6, 2020 at 7:00 AM David Huard wrote:
> Just got bit by this as well. Computing monthly quantile correction
> factors, so I have an array with dimensions (month, quantile, lon, lat). I
> then want to apply these correction factors to a time series (time, lon,
> lat), so I compute the month and quantile of my time series, and want to
> interp into the quantile correction factors. This doesn't work because
> both the factors and the time series have (lat, lon) dimensions.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-582945608,https://api.github.com/repos/pydata/xarray/issues/3252,582945608,MDEyOklzc3VlQ29tbWVudDU4Mjk0NTYwOA==,81219,2020-02-06T15:00:57Z,2020-02-06T15:00:57Z,CONTRIBUTOR,"Just got bit by this as well. Computing monthly quantile correction factors, so I have an array with dimensions (month, quantile, lon, lat). I then want to apply these correction factors to a time series (time, lon, lat), so I compute the month and quantile of my time series, and want to `interp` into the quantile correction factors. This doesn't work because both the factors and the time series have (lat, lon) dimensions. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524579537,https://api.github.com/repos/pydata/xarray/issues/3252,524579537,MDEyOklzc3VlQ29tbWVudDUyNDU3OTUzNw==,1386642,2019-08-24T20:54:02Z,2019-08-24T20:54:02Z,CONTRIBUTOR,Ok. I realized this problem occurs only because `x` was a dimension of the new index `idx` and the original dataset. Perhaps `sel` should warn the user or raise an error when this happens.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524578659,https://api.github.com/repos/pydata/xarray/issues/3252,524578659,MDEyOklzc3VlQ29tbWVudDUyNDU3ODY1OQ==,1386642,2019-08-24T20:35:45Z,2019-08-24T20:36:30Z,CONTRIBUTOR,"Ok. I started playing around with this, but I am getting errors when indexing arrays with ND variables. `data.sel(x=nd_x)` works, but any subsequent operations complain that `IndexVariable objects must be 1-dimensional`:
```
>>> import xarray as xr
>>> import numpy as np
>>> npdata = np.tile(np.arange(10), (5, 1))
... data = xr.DataArray(npdata, dims=['y', 'x'],
... coords={'x': np.r_[:10], 'y': np.r_[:5]})
... idx = xr.DataArray(npdata, dims=['z', 'x'])
...
... ans = data.sel(x=idx, method='bfill')
... assert set(ans.dims) == {'z', 'y', 'x'}
... print(ans)
Traceback (most recent call last):
File """", line 8, in
print(ans)
File ""/Users/noah/workspace/software/xarray/xarray/core/common.py"", line 129, in __repr__
return formatting.array_repr(self)
File ""/Users/noah/workspace/software/xarray/xarray/core/formatting.py"", line 463, in array_repr
summary.append(repr(arr.coords))
File ""/Users/noah/workspace/software/xarray/xarray/core/coordinates.py"", line 78, in __repr__
return formatting.coords_repr(self)
File ""/Users/noah/workspace/software/xarray/xarray/core/formatting.py"", line 381, in coords_repr
coords, title=""Coordinates"", summarizer=summarize_coord, col_width=col_width
File ""/Users/noah/workspace/software/xarray/xarray/core/formatting.py"", line 361, in _mapping_repr
summary += [summarizer(k, v, col_width) for k, v in mapping.items()]
File ""/Users/noah/workspace/software/xarray/xarray/core/formatting.py"", line 361, in
summary += [summarizer(k, v, col_width) for k, v in mapping.items()]
File ""/Users/noah/workspace/software/xarray/xarray/core/formatting.py"", line 307, in summarize_coord
coord = var.variable.to_index_variable()
File ""/Users/noah/workspace/software/xarray/xarray/core/variable.py"", line 440, in to_index_variable
self.dims, self._data, self._attrs, encoding=self._encoding, fastpath=True
File ""/Users/noah/workspace/software/xarray/xarray/core/variable.py"", line 1943, in __init__
raise ValueError(""%s objects must be 1-dimensional"" % type(self).__name__)
ValueError: IndexVariable objects must be 1-dimensional
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524572529,https://api.github.com/repos/pydata/xarray/issues/3252,524572529,MDEyOklzc3VlQ29tbWVudDUyNDU3MjUyOQ==,1217238,2019-08-24T18:45:53Z,2019-08-24T18:45:53Z,MEMBER,We could probably use this our own version for all linear and nearest neighbor interpolation. Then we won’t need scipy installed for that.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524570552,https://api.github.com/repos/pydata/xarray/issues/3252,524570552,MDEyOklzc3VlQ29tbWVudDUyNDU3MDU1Mg==,1386642,2019-08-24T18:13:10Z,2019-08-24T18:13:10Z,CONTRIBUTOR,So when would `interp` use this manual interpolation method? Would it try it only if scipy fails or check the dimensions?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524515190,https://api.github.com/repos/pydata/xarray/issues/3252,524515190,MDEyOklzc3VlQ29tbWVudDUyNDUxNTE5MA==,1386642,2019-08-24T03:40:32Z,2019-08-24T03:40:32Z,CONTRIBUTOR,"After reading the `method='ffill'` docs, I agree with you. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524457928,https://api.github.com/repos/pydata/xarray/issues/3252,524457928,MDEyOklzc3VlQ29tbWVudDUyNDQ1NzkyOA==,1217238,2019-08-23T20:50:29Z,2019-08-23T20:50:29Z,MEMBER,"Linear interpolation for 1d -> nd is just a matter of averaging two
indexing selections. If we leverage xarray's vectorized indexing operations
to do the hard work, it should work automatically for dask arrays, sparse
arrays and xarray's internal backend array types, all with any number of
dimensions.
On Fri, Aug 23, 2019 at 2:17 PM Noah D Brenowitz
wrote:
> In my experience, computing w efficiently is the tricky part. The
> function is slightly different, but metpy
>
> uses a lot of tricks to make this work efficiently. A manual for-loop is
> much cleaner for this kind of stencil calculation IMO. What kind of duck
> arrays were you thinking of?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> ,
> or mute the thread
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524448135,https://api.github.com/repos/pydata/xarray/issues/3252,524448135,MDEyOklzc3VlQ29tbWVudDUyNDQ0ODEzNQ==,1386642,2019-08-23T20:17:06Z,2019-08-23T20:17:06Z,CONTRIBUTOR,"In my experience, computing `w` efficiently is the tricky part. The function is slightly different, but [metpy](https://unidata.github.io/MetPy/latest/api/generated/metpy.interpolate.interpolate_1d.html) uses a lot of tricks to make this work efficiently. A manual for-loop is much cleaner for this kind of stencil calculation IMO. What kind of duck arrays were you thinking of?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524439002,https://api.github.com/repos/pydata/xarray/issues/3252,524439002,MDEyOklzc3VlQ29tbWVudDUyNDQzOTAwMg==,1217238,2019-08-23T19:43:21Z,2019-08-23T19:43:21Z,MEMBER,"We could implement linear interpolation just as `w * array.sel(..., method='ffill') + (1 - w) * array.sel(..., method='bfill')`, where `w` is calculated from the indexes. This is probably about as efficient as scipy. Numba could be slightly faster (by avoiding a few memory allocations) but it will be hard to make it work as generally, especially on duck arrays.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545
https://github.com/pydata/xarray/issues/3252#issuecomment-524424788,https://api.github.com/repos/pydata/xarray/issues/3252,524424788,MDEyOklzc3VlQ29tbWVudDUyNDQyNDc4OA==,1386642,2019-08-23T18:53:26Z,2019-08-23T18:53:26Z,CONTRIBUTOR,I have some numba code which does this for linear interpolation. Does `scipy` support this pattern?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484622545