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/2518#issuecomment-433624081,https://api.github.com/repos/pydata/xarray/issues/2518,433624081,MDEyOklzc3VlQ29tbWVudDQzMzYyNDA4MQ==,6153603,2018-10-27T14:14:39Z,2018-10-27T14:14:39Z,CONTRIBUTOR,Thanks for this @shoyer.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,374473176 https://github.com/pydata/xarray/issues/2518#issuecomment-433493555,https://api.github.com/repos/pydata/xarray/issues/2518,433493555,MDEyOklzc3VlQ29tbWVudDQzMzQ5MzU1NQ==,1217238,2018-10-26T18:00:18Z,2018-10-26T18:00:18Z,MEMBER,"The general pattern of functions used with `reduce()` is that they remove a dimension. But you could do this with `apply_ufunc` instead, e.g., something like: ```python def interptotarget(y, x, target): return interp1d(x, y)(target) target = xr.DataArray([213.5, 213.6], dims='target_lon') xr.apply_ufunc(interptotarget, airtemps, airtemps.lon, target, input_core_dims=[['lon'], ['lon'], ['target_lon']], output_core_dims=[['target_lon']] ).assign_coords(target_lon=target) ``` results in ``` Dimensions: (lat: 25, target_lon: 2, time: 2920) Coordinates: * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0 * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00 * target_lon (target_lon) float64 213.5 213.6 Data variables: air (time, lat, target_lon) float64 243.8 243.8 ... 298.6 298.6 ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,374473176