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/2605#issuecomment-562654929,https://api.github.com/repos/pydata/xarray/issues/2605,562654929,MDEyOklzc3VlQ29tbWVudDU2MjY1NDkyOQ==,32069530,2019-12-06T17:02:05Z,2019-12-06T17:02:05Z,NONE,"Ho, sorry... I just see the PR... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-562652648,https://api.github.com/repos/pydata/xarray/issues/2605,562652648,MDEyOklzc3VlQ29tbWVudDU2MjY1MjY0OA==,32069530,2019-12-06T16:56:20Z,2019-12-06T16:56:20Z,NONE,"Hi, I was looking to some xarray padding function and get this issue. For the moment, I made a function of my own based on numpy.pad and xr.apply_ufunc When possible, it also pad associated coordinates. If it can be of any help here... Here it is: ``` def xpad(ds, dims={}): """""" Padding of xarray. Coordinate are linearly padded if original coordinates are evenly spaced. Otherwise, no new coordinates are affected to padded axis. Padded dimension is named with prefix 'padded_' Args: ds (xarray): xarray dims (dict): keys are dimensions along which to pad and values are padding tuple (see np.pad). (ex {'pulse:(10,0)}) Returns: (xarray) : same as input with padded axis. """""" mypad = [(0,0) for n in ds.dims if n not in dims.keys()] mypad+=list(dims.values()) padded_ds = xr.apply_ufunc(np.pad, ds, mypad,input_core_dims=[list(dims.keys()),[]], output_core_dims=[['padded_'+d for d in dims.keys()]], keep_attrs=True) for var, ext in dims.items(): dvar = np.diff(ds[var]) if np.allclose(dvar, dvar[0]): dvar = dvar[0] left_bound, right_bound = (np.min(ds[var]).data, np.max(ds[var]).data) if dvar>0. else (np.max(ds[var]).data, np.min(ds[var]).data) extended_var = np.append(ds[var].data, np.max(ds[var]).data+np.arange(1,ext[1]+1)*dvar) extended_var = np.append(np.min(ds[var]).data+np.arange(-ext[0],0)*dvar, extended_var) padded_ds = padded_ds.assign_coords(**{'padded_'+var:extended_var}) else: print('Coordinates {} are not evenly spaced, padding is impossible'.format(var)) return padded_ds ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-561372979,https://api.github.com/repos/pydata/xarray/issues/2605,561372979,MDEyOklzc3VlQ29tbWVudDU2MTM3Mjk3OQ==,12862013,2019-12-03T21:50:53Z,2019-12-03T21:50:53Z,CONTRIBUTOR,I will create a WIP pull request tommorow.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-561336318,https://api.github.com/repos/pydata/xarray/issues/2605,561336318,MDEyOklzc3VlQ29tbWVudDU2MTMzNjMxOA==,2448579,2019-12-03T20:10:54Z,2019-12-03T20:10:54Z,MEMBER,Also see #3587 ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-555065766,https://api.github.com/repos/pydata/xarray/issues/2605,555065766,MDEyOklzc3VlQ29tbWVudDU1NTA2NTc2Ng==,2448579,2019-11-18T15:28:18Z,2019-11-18T15:28:18Z,MEMBER,"You can copy over `dask.array.pad` to `dask_array_compat.py` and do something like ``` python if LooseVersion(dask_version) >= LooseVersion(""1.7.0""): pad = dask.array.pad else: # copied from dask.array def pad(...): ... ``` > mode=""mean"" converts an array of integers to floats in Dask, but in numpy it keeps it an array of integers. That's weird. Open an issue at the dask repo with an example? Feel free to open an in-progress PR. Thanks for working on this. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-554998976,https://api.github.com/repos/pydata/xarray/issues/2605,554998976,MDEyOklzc3VlQ29tbWVudDU1NDk5ODk3Ng==,12862013,2019-11-18T12:41:33Z,2019-11-18T12:41:33Z,CONTRIBUTOR,"@dcherian Thx! I found the `Variable.pad_with_fill_value` already, but I will also have a look at rolling and coarsen. I have some questions related to this issue, I hope this is the correct place to ask those: Dask added the pad method in version 1.7.0 according to its documentation. What is the minimum version of Dask that should be supported, I found Dask=1.2 is the continuous integration requirements. Also, how should I handle implementation differences between numpy and Dask? E.g. in the current version of Dask and numpy I'm using: `mode=""mean""` converts an array of integers to floats in Dask, but in numpy it keeps it an array of integers.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-551984679,https://api.github.com/repos/pydata/xarray/issues/2605,551984679,MDEyOklzc3VlQ29tbWVudDU1MTk4NDY3OQ==,2448579,2019-11-08T20:49:33Z,2019-11-08T20:49:33Z,MEMBER,@mark-boer Note that we have a `Variable.pad_with_fill_value` method and some other padding code in `rolling` and `coarsen` that could be consolidated.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-549068438,https://api.github.com/repos/pydata/xarray/issues/2605,549068438,MDEyOklzc3VlQ29tbWVudDU0OTA2ODQzOA==,2443309,2019-11-02T18:18:27Z,2019-11-02T18:18:27Z,MEMBER,@mark-boer - I don't think so. Give it a go!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883 https://github.com/pydata/xarray/issues/2605#issuecomment-549058104,https://api.github.com/repos/pydata/xarray/issues/2605,549058104,MDEyOklzc3VlQ29tbWVudDU0OTA1ODEwNA==,12862013,2019-11-02T16:16:27Z,2019-11-02T16:16:27Z,CONTRIBUTOR,Has some1 started working on this? I thought I might give it a try ;-),"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,390774883