issues: 374473176
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
374473176 | MDU6SXNzdWUzNzQ0NzMxNzY= | 2518 | Allow reduce to return an additional dimension | 6153603 | closed | 0 | 2 | 2018-10-26T17:15:29Z | 2018-10-27T14:14:39Z | 2018-10-27T14:14:39Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possible```python import xarray as xr from scipy.interpolate import interp1d airtemps = xr.tutorial.load_dataset('air_temperature') def interptotarget(y, axis, **kwargs): x = kwargs['x'] target = kwargs['target'] return interp1d(x, y)(target) This worksairtemps.groupby('lat').reduce(interptotarget, dim='lon', x=airtemps.lon, target=213.5) This doesn't, but I'd like it to:airtemps.groupby('lat').reduce(interptotarget, dim='lon', x=airtemps.lon, target=[213.5, 213.6]) ``` Problem descriptionIn the code above, I give an example of how I'd like to use a reduce to return an additional dimension that I will need to be defined. The scipy call to interp1d has no trouble calculating the data, but xarray issues I used the above example as a generic case. I know I could use .interp to do an interpolation, but I have different reduction functions in mind that produce an additional dimension. The scipy interp1 function just serves as a working example. Expected Output
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2518/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |