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/3262#issuecomment-747145009,https://api.github.com/repos/pydata/xarray/issues/3262,747145009,MDEyOklzc3VlQ29tbWVudDc0NzE0NTAwOQ==,1386642,2020-12-17T01:29:12Z,2020-12-17T01:29:12Z,CONTRIBUTOR,I'm going to close this since I won't be working on it any longer.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-524581747,https://api.github.com/repos/pydata/xarray/issues/3262,524581747,MDEyOklzc3VlQ29tbWVudDUyNDU4MTc0Nw==,24736507,2019-08-24T21:23:23Z,2020-06-10T23:33:02Z,NONE,"Hello @nbren12! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found: * In the file [`xarray/tests/test_interp.py`](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py): > [Line 670:5](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L670): [F841](https://duckduckgo.com/?q=pep8%20F841) local variable 'old_coord' is assigned to but never used > [Line 676:36](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L676): [E226](https://duckduckgo.com/?q=pep8%20E226) missing whitespace around arithmetic operator > [Line 676:51](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L676): [E226](https://duckduckgo.com/?q=pep8%20E226) missing whitespace around arithmetic operator > [Line 679:21](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L679): [E226](https://duckduckgo.com/?q=pep8%20E226) missing whitespace around arithmetic operator > [Line 693:31](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L693): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ',' > [Line 711:1](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L711): [F811](https://duckduckgo.com/?q=pep8%20F811) redefinition of unused 'test_interp_1d_nd_targ' from line 704 > [Line 718:1](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L718): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1 > [Line 729:1](https://github.com/pydata/xarray/blob/5f90f4ed52210aaa1e3afd6c5da2f2295df31363/xarray/tests/test_interp.py#L729): [W391](https://duckduckgo.com/?q=pep8%20W391) blank line at end of file ##### Comment last updated at 2020-06-10 23:33:02 UTC","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-549088791,https://api.github.com/repos/pydata/xarray/issues/3262,549088791,MDEyOklzc3VlQ29tbWVudDU0OTA4ODc5MQ==,1217238,2019-11-02T23:01:30Z,2019-11-02T23:01:30Z,MEMBER,"No worries! You were a great help already! On Sat, Nov 2, 2019 at 3:01 PM Noah D Brenowitz wrote: > Unfortunately, I don’t think I have much time now to contribute to a > general purpose solution leveraging xarray’s built-in indexing. So feel > free to add to or close this PR. To be successful, I would need to study > xarray’s indexing internals more since I don’t think it is as easily > implemented as a routine calling DataArray methods. Some custom numba code > I wrote fits in my brain much better, and is general enough for my purposes > when wrapped with xr.apply_ufunc. I encourage someone else to pick up > where I left off, or we could close this PR. > > — > You are receiving this because you were mentioned. > 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}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-549085085,https://api.github.com/repos/pydata/xarray/issues/3262,549085085,MDEyOklzc3VlQ29tbWVudDU0OTA4NTA4NQ==,1386642,2019-11-02T22:01:10Z,2019-11-02T22:01:10Z,CONTRIBUTOR,"Unfortunately, I don’t think I have much time now to contribute to a general purpose solution leveraging xarray’s built-in indexing. So feel free to add to or close this PR. To be successful, I would need to study xarray’s indexing internals more since I don’t think it is as easily implemented as a routine calling DataArray methods. Some custom numba code I wrote fits in my brain much better, and is general enough for my purposes when wrapped with `xr.apply_ufunc`. I encourage someone else to pick up where I left off, or we could close this PR.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-549084085,https://api.github.com/repos/pydata/xarray/issues/3262,549084085,MDEyOklzc3VlQ29tbWVudDU0OTA4NDA4NQ==,1217238,2019-11-02T21:46:32Z,2019-11-02T21:46:32Z,MEMBER,"One missing part of the algorithm I wrote in https://github.com/pydata/xarray/pull/3262#issuecomment-525154116 was looping over all index/weight combinations. I recently wrote a version of this for another project that might be a good starting point here: ```python def prod(items): out = 1 for item in items: out *= item return out def index_by_linear_interpolation(array, float_indices): all_indices_and_weights = [] for origin in float_indices: lower = np.floor(origin) upper = np.ceil(origin) l_index = xlower.astype(np.int32) u_index = upper.astype(np.int32) l_weight = origin - lower u_weight = 1 - l_weight all_indices_and_weights.append( ((l_index, l_weight), (u_index, u_weight)) ) out = 0 for items in itertools.product(*all_indices_and_weights): indices, weights = zip(*items) indices = tuple(index % size for index, size in zip(indices, array.shape)) out += prod(weights) * array[indices] return out ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-525303808,https://api.github.com/repos/pydata/xarray/issues/3262,525303808,MDEyOklzc3VlQ29tbWVudDUyNTMwMzgwOA==,6213168,2019-08-27T13:34:50Z,2019-08-27T13:34:50Z,MEMBER,"For highly optimized interpolation of an N-dimensional array along any one dimension, see also https://xarray-extras.readthedocs.io/en/latest/api/interpolate.html","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-525157967,https://api.github.com/repos/pydata/xarray/issues/3262,525157967,MDEyOklzc3VlQ29tbWVudDUyNTE1Nzk2Nw==,1386642,2019-08-27T06:26:49Z,2019-08-27T06:26:49Z,CONTRIBUTOR,"Thanks so much for the help. This is a good learning experience for me. > That potentially would let you avoid redundant operations on the entire Dataset object. Yes. This is where I got stuck TBH. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-525154116,https://api.github.com/repos/pydata/xarray/issues/3262,525154116,MDEyOklzc3VlQ29tbWVudDUyNTE1NDExNg==,1217238,2019-08-27T06:12:14Z,2019-08-27T06:12:14Z,MEMBER,"Feel free to refactor as you see fit, but it may still make sense to do indexing at the Variable rather than Dataset level. That potentially would let you avoid redundant operations on the entire Dataset object. Take a look at the `_localize()` helper function in `missing.py` for an example of how to do stuff with in the underlying index. I think something like the following helper function could do the trick: ```python def linear_interp(var, indexes_coords): lower_indices = {} upper_indices = {} for dim, [x, new_x] in indexes_coords.items(): index = x.to_index() # ideally should precompute these, rather than calling get_indexer_nd for each # variable separately lower_indices[dim] = get_indexer_nd(index, new_x.values, method=""ffill"") upper_indices[dim] = get_indexer_nd(index, new_x.values, method=""bfill"") result = 0 for weight, indexes in ... # need to compute weights and all lower/upper combinations result += weight * var.isel(**indexes) return result ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660 https://github.com/pydata/xarray/pull/3262#issuecomment-525025890,https://api.github.com/repos/pydata/xarray/issues/3262,525025890,MDEyOklzc3VlQ29tbWVudDUyNTAyNTg5MA==,1386642,2019-08-26T20:47:33Z,2019-08-26T20:48:03Z,CONTRIBUTOR,"@shoyer Thanks for the comments. I was struggling to incorporate it into `Dataset.interp` since `core.missing` is a pretty complicated. Would it be worth refactoring that module to clarify how `interp` calls are mapped to a given function? Also, most of the methods in `interp` work like `Dataset -> Variables -> Numpy arrays`, but the method you proposed above operates on the `Dataset` level, so it doesn't quite fit into `core.missing.interp`. The interpolation code I was working with doesn't regrid the coordinates appropriately, so we would need to do that too.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484863660