Skip to content

Commit

Permalink
use da.pad when dealing with dask arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Jan 20, 2020
1 parent 88320ef commit 1e07dce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,12 @@ def _shift_one_dim(self, dim, count, fill_value=dtypes.NA):
dim_pad = (width, 0) if count >= 0 else (0, width)
pads = [(0, 0) if d != dim else dim_pad for d in self.dims]

data = np.pad(
if isinstance(trimmed_data, dask_array_type):
pad_func = da.pad
else:
pad_func = np.pad

data = pad_func(
trimmed_data.astype(dtype),
pads,
mode="constant",
Expand Down

0 comments on commit 1e07dce

Please sign in to comment.