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/pull/3302#issuecomment-554503077,https://api.github.com/repos/pydata/xarray/issues/3302,554503077,MDEyOklzc3VlQ29tbWVudDU1NDUwMzA3Nw==,5635139,2019-11-15T19:49:12Z,2019-11-15T19:49:12Z,MEMBER,"Great, thanks @dcherian !","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-554389294,https://api.github.com/repos/pydata/xarray/issues/3302,554389294,MDEyOklzc3VlQ29tbWVudDU1NDM4OTI5NA==,2448579,2019-11-15T14:53:12Z,2019-11-15T14:53:12Z,MEMBER,I'm going to merge this. Happy to make any other changes.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-549595749,https://api.github.com/repos/pydata/xarray/issues/3302,549595749,MDEyOklzc3VlQ29tbWVudDU0OTU5NTc0OQ==,13837821,2019-11-04T23:34:12Z,2019-11-04T23:34:12Z,CONTRIBUTOR,Thanks for all your work @dcherian! Did a quick test with some real-world timeseries data I've been wanting to use with `max_gap` and it looks good to me. I will definitely be using this in the future! 👍 ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-549561349,https://api.github.com/repos/pydata/xarray/issues/3302,549561349,MDEyOklzc3VlQ29tbWVudDU0OTU2MTM0OQ==,2448579,2019-11-04T21:44:49Z,2019-11-04T21:44:49Z,MEMBER,"This could use another round of testing / review
(cc @dnowacki-usgs @stefraynaud @max-sixty )","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-545009960,https://api.github.com/repos/pydata/xarray/issues/3302,545009960,MDEyOklzc3VlQ29tbWVudDU0NTAwOTk2MA==,2448579,2019-10-22T15:10:19Z,2019-11-04T21:44:07Z,MEMBER,"Thanks @dnowacki-usgs that's a nice test. I think the right fix is to make `index` a `Variable` so that we get automatic broadcasting.
Things left to do (or at least add xfail tests + errors):
- [x] support for cftime indexes and offsets
- [x] what to do when `use_coordinate=False`
- [x] what to do with unlabeled dimensions
- [x] document convention for gap length
- [x] add examples to docs","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-546395069,https://api.github.com/repos/pydata/xarray/issues/3302,546395069,MDEyOklzc3VlQ29tbWVudDU0NjM5NTA2OQ==,2448579,2019-10-25T15:14:51Z,2019-10-25T15:14:51Z,MEMBER,Done for now. Ready for final review / testing.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-543393942,https://api.github.com/repos/pydata/xarray/issues/3302,543393942,MDEyOklzc3VlQ29tbWVudDU0MzM5Mzk0Mg==,13837821,2019-10-17T22:48:45Z,2019-10-17T22:51:36Z,CONTRIBUTOR,"Thanks so much for taking this on. Not sure how I missed the notification that you had done so.
@dcherian I checked out your branch and did some testing and found that testing this against `dim=""x""` fails with a `ValueError`.
```python
arr = np.array([
[np.nan, np.nan, np.nan, 1, 2, 3, 4, np.nan, 6, 7, np.nan, np.nan, np.nan, 11, np.nan, np.nan, ],
[np.nan, np.nan, np.nan, 1, 2, 3, np.nan, np.nan, 6, 7, np.nan, np.nan, np.nan, 11, np.nan, np.nan, ],
[np.nan, np.nan, np.nan, 1, 2, 3, np.nan, np.nan, 6, 7, np.nan, np.nan, np.nan, 11, np.nan, np.nan, ],
[np.nan, np.nan, np.nan, 1, 2, 3, 4, np.nan, 6, 7, np.nan, np.nan, np.nan, 11, np.nan, np.nan, ],
])
da = xr.DataArray(arr, dims=[""x"", ""y""], coords={""x"": np.arange(arr.shape[0]), ""y"": np.arange(arr.shape[1])})
actual = da.interpolate_na(""y"", max_gap=2) # this works as in your test example
actual = da.interpolate_na(""x"", max_gap=2) # this fails
```
Error:
```
>>> actual = da.interpolate_na(""x"", max_gap=2)
Traceback (most recent call last):
File """", line 1, in
File ""/Users/dnowacki/Documents/xarray/xarray/core/dataarray.py"", line 2026, in interpolate_na
**kwargs
File ""/Users/dnowacki/Documents/xarray/xarray/core/missing.py"", line 302, in interp_na
nan_block_lengths = _get_nan_block_lengths(self, dim, index)
File ""/Users/dnowacki/Documents/xarray/xarray/core/missing.py"", line 23, in _get_nan_block_lengths
arange = ones_like(obj) * index + (index[1] - index[0])
File ""/Users/dnowacki/Documents/xarray/xarray/core/dataarray.py"", line 2500, in func
if not reflexive
File ""/Users/dnowacki/Documents/xarray/xarray/core/variable.py"", line 1884, in func
if not reflexive
ValueError: operands could not be broadcast together with shapes (4,16) (4,)
```
I fixed it by changing this line
https://github.com/dcherian/xarray/blob/8899f05a13533e10c8972836afda089b5b792ca0/xarray/core/missing.py#L23
to this:
```python
if index.shape[0] == obj.shape[0]:
arange = ones_like(obj) * index[:, None] + (index[1] - index[0])
else:
arange = ones_like(obj) * index + (index[1] - index[0])
```
Does this seem reasonable?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-532257718,https://api.github.com/repos/pydata/xarray/issues/3302,532257718,MDEyOklzc3VlQ29tbWVudDUzMjI1NzcxOA==,2448579,2019-09-17T14:53:52Z,2019-09-17T14:53:52Z,MEMBER,"yes, I think you are right. I was thinking that it would be nice to have the number-of-nan-points and gap-length metrics converge for uniformly spaced coordinates but I don't think that's possible in any sensible way.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531843795,https://api.github.com/repos/pydata/xarray/issues/3302,531843795,MDEyOklzc3VlQ29tbWVudDUzMTg0Mzc5NQ==,5635139,2019-09-16T16:02:57Z,2019-09-16T16:02:57Z,MEMBER,"IIUC, and please correct me if I'm wrong, the pandas version counts points rather than the distance between locations. Ideally we'd be able to do both, but even if we can only have one working correctly, that would be v good","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531807552,https://api.github.com/repos/pydata/xarray/issues/3302,531807552,MDEyOklzc3VlQ29tbWVudDUzMTgwNzU1Mg==,2448579,2019-09-16T14:39:41Z,2019-09-16T14:39:41Z,MEMBER,"The thing I find weird is that for
```
array([nan, nan, nan, 1., nan, nan, 4., nan, nan])
Coordinates:
* y (y) int64 0 1 2 3 4 5 6 7 8
```
the center gap's length = `7-4 = 3` which is the number of NaNs + 1. But maybe this is OK.
1. We should check what that pandas PR does and align with that
2. `interp` calls `scipy.interpolate.interp` which does do extrapolation, so we should figure out a sensible solution for the edges (extrapolating coordinates using the first and last spacing seems reasonable to me).
@stefraynaud I don't have time to work on this now. Please feel free to modify this and open a new PR. You could try to push to this branch but I'm not sure it will work.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531674432,https://api.github.com/repos/pydata/xarray/issues/3302,531674432,MDEyOklzc3VlQ29tbWVudDUzMTY3NDQzMg==,1941408,2019-09-16T07:50:26Z,2019-09-16T07:50:26Z,CONTRIBUTOR,">
>
> Thanks @stefraynaud . I'm having trouble figuring out defining the length of a gap in the irregular coordinate case.
>
> e.g.
>
> ```
> da4 = xr.DataArray([np.nan, np.nan, np.nan, 1, np.nan, np.nan, 4, np.nan, np.nan],
> dims=[""y""], coords={""y"": [0, 2, 5, 6, 7, 8, 10, 12, 14]})
> ```
>
> ```
>
> array([nan, nan, nan, 1., nan, nan, 4., nan, nan])
> Coordinates:
> * y (y) int64 0 2 5 6 7 8 10 12 14
> ```
>
> What is the length of these three gaps given that xarray doesn't have any understanding of grids?
@dcherian In your example, as said @max-sixty, the middle gap has a length of `10-6=4`. The length gaps at the edges cannot be computed but it doesn't matter, and the algo should work as when simply counting the nans.
I'll have a look the code, maybe for a new PR after this one.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531294795,https://api.github.com/repos/pydata/xarray/issues/3302,531294795,MDEyOklzc3VlQ29tbWVudDUzMTI5NDc5NQ==,2448579,2019-09-13T16:00:33Z,2019-09-13T16:00:33Z,MEMBER,OK added test and now raises error for irregularly spaced coordinates. I agree that this should be good for now.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531286079,https://api.github.com/repos/pydata/xarray/issues/3302,531286079,MDEyOklzc3VlQ29tbWVudDUzMTI4NjA3OQ==,5635139,2019-09-13T15:36:08Z,2019-09-13T15:36:08Z,MEMBER,"I think using locations rather than counts would be great, but harder and doesn't have to be part of this PR.
In the example above, it looks like 1 is aligned with 6 and 4 with 10, so the gap in locations along the y dimension would be 4?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531283688,https://api.github.com/repos/pydata/xarray/issues/3302,531283688,MDEyOklzc3VlQ29tbWVudDUzMTI4MzY4OA==,2448579,2019-09-13T15:29:34Z,2019-09-13T15:29:34Z,MEMBER,"Thanks @stefraynaud . I'm having trouble figuring out defining the length of a gap in the irregular coordinate case.
e.g.
```
da4 = xr.DataArray([np.nan, np.nan, np.nan, 1, np.nan, np.nan, 4, np.nan, np.nan],
dims=[""y""], coords={""y"": [0, 2, 5, 6, 7, 8, 10, 12, 14]})
```
```
array([nan, nan, nan, 1., nan, nan, 4., nan, nan])
Coordinates:
* y (y) int64 0 2 5 6 7 8 10 12 14
```
What is the length of these three gaps given that xarray doesn't have any understanding of grids?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531248632,https://api.github.com/repos/pydata/xarray/issues/3302,531248632,MDEyOklzc3VlQ29tbWVudDUzMTI0ODYzMg==,1941408,2019-09-13T14:00:30Z,2019-09-13T14:00:30Z,CONTRIBUTOR,"Nice feature.
How about adding the support max gaps expressed in physical units, since coordinates may be irregular?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531080613,https://api.github.com/repos/pydata/xarray/issues/3302,531080613,MDEyOklzc3VlQ29tbWVudDUzMTA4MDYxMw==,2448579,2019-09-13T03:00:42Z,2019-09-13T03:00:42Z,MEMBER,":+1:
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-531036675,https://api.github.com/repos/pydata/xarray/issues/3302,531036675,MDEyOklzc3VlQ29tbWVudDUzMTAzNjY3NQ==,5635139,2019-09-12T22:52:24Z,2019-09-12T22:52:24Z,MEMBER,"As per the pandas issue, sounds like `max_gap` is consensus","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-530899448,https://api.github.com/repos/pydata/xarray/issues/3302,530899448,MDEyOklzc3VlQ29tbWVudDUzMDg5OTQ0OA==,5635139,2019-09-12T16:17:46Z,2019-09-12T16:17:46Z,MEMBER,"> OK it looks like that PR is alive again, so maybe it's good to keep the same kwarg?
Ah, agree we should align. I'm really not keen on that name but yes on balance; unless they're open to changing","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552
https://github.com/pydata/xarray/pull/3302#issuecomment-530890655,https://api.github.com/repos/pydata/xarray/issues/3302,530890655,MDEyOklzc3VlQ29tbWVudDUzMDg5MDY1NQ==,2448579,2019-09-12T15:55:49Z,2019-09-12T15:55:49Z,MEMBER,"Thanks @max-sixty I've updated the tests.
> Any thoughts on maxgap? limit_gap? Neither clicks that well!
I pulled `maxgap` from this ~stalled~ Pandas PR: https://github.com/pandas-dev/pandas/pull/25141
OK it looks like that PR is alive again, so maybe it's good to keep the same kwarg? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,492866552