home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 342719382

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/pull/1696#issuecomment-342719382 https://api.github.com/repos/pydata/xarray/issues/1696 342719382 MDEyOklzc3VlQ29tbWVudDM0MjcxOTM4Mg== 2443309 2017-11-08T06:01:57Z 2017-11-08T06:01:57Z MEMBER

@MaximilianR - I have rough implementation of both of these on my interpolate branch:

https://github.com/jhamman/xarray/blob/56f37144f2dc827b61aa61f94c69277e6a79c262/xarray/core/missing.py#L206-L234

some slight modifications gives this:

```Python def _bfill(arr, n=None, axis=-1): '''inverse of ffill''' import bottleneck as bn

arr = np.flip(arr, axis=axis)

# fill
arr = bn.push(arr, axis=axis, n=n)

# reverse back to original
return np.flip(arr, axis=axis)

def ffill(self, dim=None, limit=None): ''' ''' import bottleneck as bn

return apply_ufunc(bn.push, self,
                   dask='forbidden',
                   keep_attrs=True,
                   kwargs=dict(n=limit, axis=self.get_axis_num(dim))).transpose(*arr.dims)

def bfill(self, dim=None, limit=None): ''' ''' return apply_ufunc(_bfill, self, dask='forbidden', keep_attrs=True, kwargs=dict(n=limit, axis=self.get_axis_num(dim))).transpose(*arr.dims) ```

As @shoyer says, it may be possible to change to dask='parallelized' but I have tried it yet.

Feel free to take what you want from this snippet, I am moving pretty slowly on my interpolation branch but it would be great if you can get this in as a stand alone feature.

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  271991268
Powered by Datasette · Queries took 1.135ms · About: xarray-datasette