issue_comments: 334233567
This data as json
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/1605#issuecomment-334233567 | https://api.github.com/repos/pydata/xarray/issues/1605 | 334233567 | MDEyOklzc3VlQ29tbWVudDMzNDIzMzU2Nw== | 2443309 | 2017-10-04T17:40:00Z | 2017-10-04T17:40:00Z | MEMBER | Okay, I got it now. Consider this example ```Python dates = pd.date_range('2016-01-01', '2016-12-31', freq='D') orig = dates[dates != '2016-02-29'] # drop feb 29 and this example will workorig = dates da = xr.DataArray(np.random.random((len(orig), 2, 3)), dims=('time', 'x', 'y'), coords={'time': orig}) print(da) da.resample(time='1D').interpolate('linear')
Coordinates: * time (time) datetime64[ns] 2016-01-01 2016-01-02 2016-01-03 ... Dimensions without coordinates: x, y AttributeError Traceback (most recent call last) <ipython-input-12-e187a9baeec8> in <module>() 6 print(da) 7 ----> 8 da.resample(time='1d').interpolate('linear') ~/Dropbox/src/xarray/xarray/core/resample.py in interpolate(self, kind) 110 111 """ --> 112 return self._interpolate(kind=kind) 113 114 def _interpolate(self, kind='linear'): ~/Dropbox/src/xarray/xarray/core/resample.py in _interpolate(self, kind) 204 f = interp1d(x, y, kind=kind, axis=axis, bounds_error=True, 205 assume_sorted=True) --> 206 new_x = self._full_index.values.astype('float') 207 208 # construct new up-sampled DataArray AttributeError: 'NoneType' object has no attribute 'values' ``` The application here is that I'm doing a QC check on a dataset that is sometimes missing Feb 29. It is sufficient for my application to always resample and fill Feb 29 when its missing. The pandas equivalent works:
I think I have a fix for this which I'll push up quickly. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
262847801 |